[Pythonmac-SIG] Is the menu enabled?

John W Baxter jwblist@olympus.net
Wed, 24 Nov 1999 22:30:40 -0800


>> >Now, foo is a resource object (resources and handles are the same
>> >thing in MacPython, for some odd reason).  You can get its data (it's
>> >just a member, IIRC).  That data is of the same format as documented
>> >in your favorite toolbox reference (i.e., whatever a MenuHandle
>> >refers to).  You can use the struct module to unpack this and get
>> >whatever you need out of it.
>>
>> That sounds like an impending "Carbon" problem (or an already-solved Carbon
>> problem, perhaps, if the Python object's accessors have been taught about
>> Carbon).
>
>John,
>as you seem to know more about Carbon than I do (I know little more than what
>I learned by running the carbon dating app on Python:-), maybe you can tell me
>whether the code needs fixing. Currently if X is a handle and you access
>X.data from Python what the C code does is lock the handle, create a new
>Python string object of the right size, copy the data and unlock the handle.
>Assigning to X.data does the same in reverse, with SetHandleSize() called to
>give the handle the right size.
>
>Is this something that will survive the Carbon transition? If not, where do I
>find out what I should do?

The above sequence should work...the problem is that, *probably*, the
layout of the contents of a menu handle and a menu bar (handle) will be
unknown in Carbon:  they are likely examples of the opaque data structures.
There should be accessor functions to replace direct access per the struct
definition.

Likewise, a WindowPeek no longer peeks into the structure of a window
record, etc etc.

Unfortunately, I know no details...my opportunity to attend a meeting in
Seattle a couple of Saturdays ago where I would have learned something was
foiled by the fact the the boss was in California...one of needs to be
somewhat nearby to kick the servers if necessary (our main machine just
passed one year of continuous operation today...we don't have to kick that
one much...BSDi Unix.  Unfortunately, a couple of days ago I accidentally
killed the Apache process which had been running on the machine, but not
doing much...the web servers are elsewhere, since December 8 1998).

  --John

-- 
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA