Re: Newby Q: Getting widgets to appear all at once.



slebetman@xxxxxxxxx wrote:
Kenny Tilton wrote:

I have a Common Lisp GUI framework that drives Tk across a pipe.

On my first go, the engine instantiated a tree of instances each of
which gets a corresponding Tk widget. The constructor for each instance
goes ahead and makes its Tk counterpart by sending the appropriate
widget command.

With a complex dialogue, I pretty much watched the dialogue grow in
front of my eyes, bit by bit. Great fun, but it might scare the users.

I looked around for some window manager mechanism to suppress updates
untila certain point but did not spot anything. What I settled on was to
iconify the window straightaway, deiconify when the window was fully
constructed. worked great.

(a) Is that how it is usually done? If so...


I usually use withdraw instead of iconify. If you iconify then
depending on your window manager, you'll either get an icon on the
desktop (windowmaker) or a button on the taskbar (kde & MS Windows). If
you withdraw then your app becomes 'invisible'.

OK, thx. I saw "withdraw" but was not sure.



(b) What do I do if, in response to user input, I want to show or hide
some new GUI elements. Can I avoid making the user watch each widget
appear/disappear one-by-one?


What I tend to do is to create all that in a frame in the background
packing/placing/gridding as appropriate and when done pack/place/grid
that frame. All the UI elements in the frame will appear
simultaneously. To hide you can do a pack forget/place forget/grid
forget on that frame:

# The frame containing GUI elements, don't pack yet:
frame .f

# GUI elements:
pack [label .f.lab -text "Simple test"]
pack [button .f.hide -text "Hide" -command {pack forget .f}]

# Button to show the hidden frame:
pack [button .show -text "Show" -command {pack .f}]


Thx, I had a feeling I could achieve Good Things with the right order of packing.

Can I just ask: are you also talking to Tk across a stream and this is the only way to go to avoid visible widget assembly steps? Another response had me thinking I might (emphasis on might) do better by writing all at once to the stream. Or is there no way to avoid Tk deciding to post an update?

Well, I can at least move packing to the end of the message stream to get a significant improvement. Thx.

kenny
.



Relevant Pages

  • Re: Aspect Ratio revisited
    ... The 'Configure' event is signalled each time the widget size ... The canvas will always have a default size: ... the main window is visible before the contents is packed/gridded, ... or the outer frame gets *smaller*, ...
    (comp.lang.tcl)
  • Re: Newby Q: Getting widgets to appear all at once.
    ... which gets a corresponding Tk widget. ... I looked around for some window manager mechanism to suppress updates ... some new GUI elements. ... What I tend to do is to create all that in a frame in the background ...
    (comp.lang.tcl)
  • Re: Packing problems
    ... but the frame there are in is centered horizontally. ... pack your text widget absolutely last and you'll get better resize behavior. ... Many windows applications put both the scrollbar and text widget inside a common frame that is sunken. ... commands and then resize the window to be smaller, you'll see the effect I describe in the tclscripting.com article where the scrollbars disappear before the text widget shrinks. ...
    (comp.lang.tcl)
  • Re: Question on scrolled frames
    ... > level window is enlarged. ... The scrollable frame is working just fine. ... scrollbars to move that window around. ... If you want widget sizes to expand and contract when the top level ...
    (comp.lang.tcl)
  • Re: Atomic clock behaviour in a gravitational field explained with 1905 Relativity
    ... in the frame of the Sun my desk has the same movement as ... Outside my window is a tree, ... Then for the same point p in X and X', the transformation ... with the same velocity, then in one anothers frame they are ...
    (sci.physics.relativity)