[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Mac::Controls (Popup Menus)



Brian McNett <brianmc@telebyte.net> writes 14th August 1998;

>The excellent (but too short) chapter on GUI Toolbox routines in MPPE
>(with some very fine example code), makes no mention of popup menus.
>Yes, I know it's probably dealt with elsewhere, and I haven't taken the
>time to look.  Of all the controls I could possibly use, the only one I
>really need at the moment is a popup menu.  How does one go about
>creating one?  Inside Macintosh gives two methods.  I can create a 'CNTL'
>resource and call GetNewControl, or I can call NewControl, and define the
>control's properties in MacPerl.  The examples in Pascal are fairly
>opaque to me (I admit it:  I failed the one class I took in Pascal in
>college). For a popup menu I suspect I also need Mac::Menus, Mac::Fonts,
>Mac::Events and Mac::QuickDraw.

Yes -- Windows.pm, Events.pm, QuickDraw.pm, Controls.pm and Menus.pm are
all certainly needed.

As you note there are examples in MPPE which show how to create new menus
for the menu bar. Menus for popups are created in much the same way.

For a popup however the menu should be registered as a pane in the window
using new_control() with popupMenuProc() as one of the arguments. There is
an example in the folder 'ext' in the MacPerl distribution which shows how
it works.

Unfortunately, although that example works, in general popupmenuProc()
causes MacPerl to crash. The bug has been reported to Matthias who has
reproduced the crash but not yet had the time to delve into it.

For the moment I think you're stuck.

Alan Fry




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch