Re: A good menu tutorial?
- From: Bruce Hartweg <bruce-news@xxxxxxxxxx>
- Date: Wed, 30 Aug 2006 23:51:34 -0500
Robert Hicks wrote:
suchenwi wrote:general approach is dead on, but be *very* careful using externally generated names (like filenames) directly as component of widget names,Robert Hicks schrieb:
That does what I want it to do, so thanks for that suggestion. What doHmm..
those cascade names become assuming the foreach brings back directory
names of dir1, dir2, dir3. Do they become: .m.mLessons.dir1
.m.mLessons.dir2 and .m.mLessons.dir3
Tcl/Tk is very simple. But some reading man pages (in this case, menu)
still helps.
As my (maybe too brief) explanation showed, to add a cascade you'd best
specify a new menu. How to call this is up to you - just make sure its
name doesn't start with an uppercase letter (that's why I put a "m" in
front).
You can call [glob] separately for subdirectories (-type d) and files
(-type f). I'd suggest first to do the directories, create a cascade
for each,
.m.whatever.m$dir create cascade -label $subdir -menu [menu
.m.whatever.m$dir.m$subdir]
and recurse into them (call the same procedure for each again). Then do
the files, adding a simple command to the current menu.
if they contain a . you will blow up as the . is the widget seperator.
so I would either keep a simple 1-up counter to make the menu widget name itself (keeping the displayed label the actual directory) or else
use string map to map any "." to "_" or something (and mayber spaces
too which don't necessarily break you but can cause headaches occasionally.
Bruce
.
- Follow-Ups:
- Re: A good menu tutorial?
- From: Robert Hicks
- Re: A good menu tutorial?
- References:
- A good menu tutorial?
- From: Robert Hicks
- Re: A good menu tutorial?
- From: suchenwi
- Re: A good menu tutorial?
- From: Robert Hicks
- Re: A good menu tutorial?
- From: suchenwi
- Re: A good menu tutorial?
- From: Robert Hicks
- A good menu tutorial?
- Prev by Date: Re: TWAPI event log code
- Next by Date: Re: Loading large data sets
- Previous by thread: Re: A good menu tutorial?
- Next by thread: Re: A good menu tutorial?
- Index(es):
Relevant Pages
|