[Pythonmac-SIG] Is the menu enabled?

James B. Wilkinson jimmy@cs.cofc.edu
Tue, 12 Oct 1999 12:23:27 -0400


Is there a way to get the toolbox to tell me whether a given menu is
enabled or not at a given time. I'd prefer not to have to redraw the menu
bar if I haven't actually made any changes in that property. Right now the
only thing I can think of is to keep an instance variable in the
application that gets set every time the enabled/disabled status of a menu
changes. That would probably work, but I worry about having the variable
somehow get out of step with what it's supposed to be tracking, and I'd
prefer to have direct access to the real truth.

I see that the Menu module implements the GetMenuHandle() function, but I
have no idea how to use it in Python. In C, I think I could use the handle
to get to the MenuInfo record and look at the enableFlags. How to do that
in Python is beyond me, and I don't know how to learn anything beyond what
I've done: type "import Menu" and "dir(Menu)". That tells me that
GetMenuHandle() is there, but not how to use it. Is there a good way to
answer questions like this, or do you just have to know?

Thanks.


-------------------------------------------------------------
Jimmy Wilkinson            | Perfesser of Computer Science
jimmy@cs.CofC.edu          | The College of Charleston
(843) 953-8160             | Charleston      SC        29424

If there is one word to describe me,
that word would have to be "profectionist".