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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Form Load Frames.

Status
Not open for further replies.

SmallProgram

Programmer
Feb 6, 2002
42
IN
Hello Friends,
I have strange problem here.I'll be very thankful to you if can solve me this problem.I am developing an application in Tcl/Tk.For this Application I need to display a series of Frames at the same place
on a click of a button.
Ulis have helped me in making my life simpler by the forget command in pack,place or grid manager.
But my problem is that I don't want to display all the frames on Loading of the Application. I want only some frames to be visible at the time of first Loading of the Application.I have an idea of not packing the frames at the first Loading of the application(Some thing Like On Form Load).But I want to know if we can hide the frames while loading the first time and at later stage I can view them.
Thank you,
Mallik.

Programmer,Amatuer
 
Yes you can hide and show your frames as needed.
In fact, what you describe is very near a tabbed widget.
Here is a simplistic example:
Code:
pack [frame .f]
foreach i {1 2 3 4} { 
  frame .f.f$i; pack [label .f.f${i}.l -text "I'm $i"] 
}
foreach i {1 2 3 4} { 
  pack [button .b$i -text "show $i" -command "show $i"] -side left 
}
proc show {n} { 
  foreach i {1 2 3 4} { pack forget .f.f$i }
  pack .f.f$n 
}

show 1

In a first time, frames are not packed (so they are hidden).
When needed, all frame are hidden and only one is shown.

Hidding is via pack forget: pack forget <widget>
Showing is via pack: pack <widget> (all previous pack options are remembered)

You can also use that with grid or place.

ulis

 
Here is a Wiki page about BWidget: &quot;a script only Tk extension that many people recommend. It provides support for more than 20 new Tk widgets, such as progres bars, button boxes, notebooks, combo boxes, spin boxes, tabbed notebook, etc. &quot;

url:
I think you can find here some great and useful code.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top