I've gone back through my notes and figured out what I was talking about...
I'm using popup heirchical menus from controls, I should have made that clearer earlier, sorry. To attach the heirchical menu I'm using SetItemMark, which takes a char parameter, hence the 255 upper bound. The lower bound I had originally (220) I can't figure out where I got, so it was probably my own insanity. I shouldn't have blamed Alan :-). Again, sorry. I'm now using 134-255, skipping 192 (used for the popup in the MacPerl "Save As" dialog) plus skipping anything I find during a GetMenuHandle scan (I rescan everytime I need to allocate a new ID). The lower bound (134) avoids all the standard MacPerl menus while the upper bound (255) avoids the menus created by Alan's (excellent) MacTE and most menubar extensions (Seti@Home, Instant Palm Desktop, etc.). This leaves me with just two questions: 1. Is there a way to attach a (generated) heirchical menu without SetItemMark, thereby avoiding the 255 limit? 2. Has anyone played around with using Appearance controls (notably disclosure triangles) under MacPerl? I've plugged in the right constants and established that MacPerl will in fact create controls of those types on Appearance enabled systems, but there's probably some gotchas. Or is this just something I need to wait on the Carbon Mac toolbox modules (has development on these started?). Using better controls would let me ditch the (very long) popup. Thanks, as always, for everyone's help, Alex -- Alex Harper [EMAIL PROTECTED] Configuration Manager [EMAIL PROTECTED] "Use whatever you think of first" -- Larry Wall > -----Original Message----- > From: Alan Fry [mailto:[EMAIL PROTECTED]] > Sent: Saturday, April 20, 2002 7:37 AM > To: MacPerl > Subject: Re: [MacPerl] Menu ID's greater than 255 > > > At 5:40 pm -0500 19/04/02, Alex Harper wrote: > > >At one point Alan Fry indicated to me on this list that > Mac::Menus could > >only handle menu IDs in the 128-255 range (actually he > suggested 200-255 > >was the safest). As I recall he indicated that this was due > to a bug in > >Menus.xs, but for the life of me I can't find the mail > (Google search of > >the old bumppo.net archive is no help). > > The extract Chris found: > > >> The 'tutorial' script below gives an example with some notes. Two > >> other details come to mind: > >> > >> a) the popup ID must be capable of representation by an ASCII > >> character -- i.e. in the range 0-255 (taking care not to > >> trample on some other existing ID) > >> > >> b) the need for the line "InsertMenu(HANDLE, -1)", which is not > >> documented anywhere I think. > > is correct I think. > > Popup menus are odd beasts being part 'Menu' and part 'Control'. In > particular the manner in which the popup is built as a control is > somewhat convoluted and not altogether satisfactory. If you look in > 'DialogBuilder' (on my site see below) you will find examples of > scripts using 'popups' which you might find helpful. > > Menus generally (in the MenuBar) take ID's in the range from 128 > (which is always the 'Apple' Menu) to 65535. Again the problem is to > avoid trampling on an existing menu ID. David Seay some time ago > suggested doing a loop of the kind: > > use Mac::Menus; > > for my $m (128..65535) { > $menuHandle = GetMenuHandle($m); > if($menuHandle) { ... ID in use ....} > } > > and that is probably the safest thing to do. The difficulty is you > never know what things other people have in their Menu Bars, (like > 'FreePPP' for instance). These 'third party' applications usually use > highish Menu ID's reflecting their attempts to avoid stepping on some > other apps' toes. > > However beware of a trap. The loop will only return handles for Menus > that are currently in the MenuBar. For instance it will never return > the handle for MacPerl's 'Script' Menu, since that is always removed > (by MacPerl) when the script runs. > > So far as I am aware there are no bugs in Menus.pm. Some of the > 'popup' options (Controls.pm) didn't work in MacPerl 5.2.1a1 -- I > regret I haven't got around to looking at 'Menus.pm' in MP 5.6.1r1 > yet. > > There are some mis-attributions in the Controls.pm 'pod'. For > instance 'popupFixedWidth' is listed as for use in the 'value > parameter of the control creation' whereas it should be 'anded' with > the 'control definition'. > > As I said it's all a little convoluted... > > HTH, > > Alan Fry > <http://www.afco.demon.co.uk> > > > >