Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating transparant frames

Status
Not open for further replies.

japskar

Programmer
Feb 13, 2002
27
0
0
how can I use frames in such a way that the border remains visible, but the rest of it being transparant to all other objects.
Right now I more or less solve this with raise and lower, but since I don't know my widgets in advance, I can only do this once.
Namely, I tell each frame to put it directly after my toplevel in the stacking order with the lower command, but you can imagine what happens when I place frames on top of each other. Depending on size, the larger, low in the stacking order, remains visible while the rest disappears.

-Jasper
 
I know how to make transparent rectangles in canvas (-fill "") but not frames.

ulis
 
To the best of my knowledge, Tcl doesn't support transparent frames. Given the power of Tcl's geometry managers (pack, grid, and place), this shouldn't be a problem. In fact, it's been mathematically proven (don't ask me how, I never took topology in college) that any layout can be achieved using even only one of pack, grid, or place.

Perhaps if you explained what you're trying to do, we could offer you some suggestions for simplifying your layout. In all my years of Tcl programming, I've never used stacked frames for any type of layout. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Yes, so far I place all my widgets with the place command (don't ask me why I use place and not grid). The main problem is that if I've got 2 frames, and one on them is larger than the other, one of them is placed within the other, or (not preferable), one completely overlaps the other.
As far as I know this depends on the place in the stacking order. So if I can get get my frames ordened on size in the stacking order (among other widgets), my problem is solved.
The other possibility is to replace my frames by canvas with a border and a label on top.
I've no idea which is the best solution.

-Jasper
 
Yes, when widgets overlap, the widget that's visibile is the one on top. You can explicitly change the stacking order with the raise and lower commands.

But if you use pack or grid to manage your widgets, and you give your widgets proper hierarchical names (e.g. a frame called ".controls" containing two buttons called ".controls.ok" and ".controls.cancel"), then the geometry managers automatically take care of widget stacking order to make sure everything's properly visible.

That's why I almost never use place for my layouts. It places far too much of the geometry management burden on me, the programmer. I don't want to worry about masters and slaves and stacking order and such. I'm a big fan of letting Tcl do the hard work whenever possible. About the only instances where I'd use place would be if I were building my own speciality display managers, like paned windows, or doing some special tricks for Tclets displayed in the Tcl Plugin.

If possible, I'd recommend rewriting your code to make use of pack or grid. It might hurt now, but it'll be much easier for you to extend and maintain in the long run. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
:-( I already use the pack whenever possible.
I've created a tool in another programming language which creates GUI's with the Tcl plugin. The problem is that I need the freedom to move around in my toplevel and place widgets where needed.
For example:

'"title,"example,//,xcheck1,xcheck2,//!ok,!cancel' GUI 1 1

gives me a GUI with header "title",a label "example", two lines down is a checkbox "check1", right of that a checkbox "check2", two lines below an OK and CANCEL button.
The checkbuttons are both checked (1 1).

But I can also use absolute positioning like "#3.10,oRAD1" which places a radiobutton on line 3, column 10.

So what I do is this: I specify all my widgets, store the name in a variable, store the startingpoints and the size and then, the last step, I use the place command to place all the widgets at the correct place.

So I'm afraid the pack command alone doesn't give me the freedom and flexibility I need.
However, there is a step somewhere that transforms the coordinates (lines, columns) to pixels. Could I use that together with the grid? I possibly can, but doesn't solve my problem.

Still stuck,
-Jasper

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top