on 3/30/05 5:52 PM, Alfred Van Hoek at vanhoek at mac dot com wrote:
> Given the C++ class XMenuItem, which is a wrapper to "MenuItem" and is being
> used to create a menuItem array depicting different colors. A plugin class
> will expose these as a subclass of MenuItems to the user of the plugin.
>
> The plugin defines a control, and one of its fields is the XMenuItem:
>
> // the sample struct
> typedef struct GuiseData {
> XMenuItem color;
> } GuiseData;
>
> // the sample getter
> static REALobject Guise_TextColorMenuGet(REALobject instance)
> {
> ControlData(GuiseClass, instance, GuiseData, data);
> data->color.lock();
> return data->color;
> }
>
> // the sample setter
> static void Guise_TextColorMenuSet(REALobject instance, REALobject menu)
> {
> ControlData(GuiseClass, instance, GuiseData, data);
> XMenuItem m = menu;
>
> if (!m) {
> data->color.unlock();
> return;
> }
>
> XMenuItem subm; // each subm will get different tag, text, name...
>
> subm = REALnewInstance("MenuItem");
> m.append(subm);
> subm.unlock();
>
> subm = REALnewInstance("MenuItem");
> m.append(subm);
> subm.unlock();
>
> subm = REALnewInstance("MenuItem");
> m.append(subm);
> subm.unlock();
>
> m.lock();
> data->color.unlock();
> data->color = m;
> }
>
> Declaration:
>
> { (REALproc) Guise_TextColorMenuGet,
> (REALproc) Guise_TextColorMenuSet,
> "TextColorMenuItems() as GuiseMenuItem" },
>
>
> In the open event of the plugin control the following is called:
>
> me.ColorMenuItems = new GuiseMenuItem
> me.ColorMenuItems.text = "Color"
> MenuBar1.append me.TextColorMenuItems
>
> and this is ok for MacOS, but not for windows. On windows a
> classNilObjectException is raised. Commenting out these lines will cure it,
> so something seems to be wrong with the getter function, which is called
> twice here.
>
> What's wrong?
It appears that the number of menuItems appended to the menubar is limited
to the windows width when the menuItems are dynamically created and
appended. Once the windows width is made large enough, everything is fine,
including when the window is resized to smaller width after appending to the
menubar; Then the menuItems appear in rewrapped appearance....
What should I report?
Alfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|