Re: A good menu tutorial?




suchenwi wrote:
Robert Hicks schrieb:

So I guess I can do a foreach on "$home/Courses/" to get the dir names
and file names? I am not sure how to build a menu with that though.

Anyone done something like this?

From http://en.wikibooks.org/wiki/Programming:Tcl_Tk#menu

To add a menu to a GUI application, take steps of three kinds:

Create the toplevel horizontal menu (needed only once):
. configure -menu [menu .m]

For each item in the top menu, create a cascaded submenu, e.g.
.m add cascade -label File -menu [menu .m.mFile]

For each entry in a submenu, add it like this:
.m.mFile add command -label Open -command {openFile ...}
or
.m.mFile add separator

In your case, add a cascade for each directory, and a command for each
file that [glob] brings you.

Great! I did it and it works. : D

Robert

.