[Pythonmac-SIG] mac event loop

Bill Bedford billpy@mousa.demon.co.uk
Thu, 22 Oct 1998 14:33:58 +0100

At 11:39 am +0200 22/10/98, Jack Jansen wrote:

>> For various reasons I've made my event loop from scratch an do not use
>> FrameWork.py. As expected I've got some problems :)
>> (1) I would like to override the std zoom in / zoom out behavior for
>> something like a full screen mode. According to "Inside Macintosh" I have to
>> change the stdState of the WStateData structure in the dataHandle field of
>> the window record.
>> in PASCAL: (Toolbox Essentials 4-55)
>>     WSTateDataHandle(WindowPeek(thisWindow)^.dataHandle)^^stdState :>> zoomRect
>> Can that be done in python and if so, how ? If not I can use SizeWindow()
>> with an flag but I prefer to avoid that way.
>You cannot get at the dataHandle attribute currently. But, note that you
>need this to implement zooming: ZoomWindow() is usually enough. You only need
>to get at the stdState structure if you want to maximized state to be
>something different than (almost) the whole screen.

But you should be able to save the userstate so that the window opens as
the user left it.

>> (4) My last point is a suggestion. It is recommended by Apple to use
>> menuID's from 1 to 235 for application *submenus* and each other number >
>> 128 for menus (Toolbox Essentials 3-44). When I used 1 I got a conflict with
>> the IDE or python-out. I didn't check submenus up to now but I think there
>> is a need for two funktions like
>> GetMenuID()    -> menuID
>> GetSubMenuID() -> submenuID
>This sounds like a good idea, but I'm unsure where to add the methods.

It's not necessary you call InsertMenu(after) to actually draw the menu.
The int 'after' is: 0 if it is to be inserted at the end of the menu bar,
a positive number if it is to be inserted among the existing menus, or -1
if it is to be a submenu. This allows, for instance, a menu to be on the
menu bar in one screen and a submenu in another.

>Also, does anyone _really_ understand the section in IM (menu manager, page
>3-44)? I get the impression that the restriction that main menus should have
>IDs > 128 only holds for menus read from resources, and the description of
>NewMenu also doesn't mention the >128 restriction...

Yep, and poking about with Resedit in various apps it seems to more honored
in the breach than the observation.

PS. Jack, Writing this has forced me to look at my bFramework code, and get
the submenus to work, I'll clean it up a bit and send you a copy in the
next few days.


Bill Bedford

Owner Brit_Rail-L list for the history of railways in Britain
Subscribe at autoshare@mousa.demon.co.uk