What property does "set as stack menubar" set?

Dr. Hawkins dochawk at gmail.com
Sun Mar 15 19:22:17 EDT 2015


On Sun, Mar 15, 2015 at 12:50 PM, J. Landman Gay <jacque at hyperactivesw.com>
wrote:

> On 3/15/2015 8:12 AM, Dr. Hawkins wrote:
>
>> put the editMenus of stack out0, the vis of grp stk_menu of stack out0,
>> the
>> menubar of stack out0
>>
>> yields
>> fase, true,
>>
>> I clone stack out0, name it to out 1, and the menu now appears on the
>> card.
>>
>
> Is it really on the card, or just in the system menu bar? The result of
> your "put" statement says there is no menubar assigned to that stack (the
> last item is empty.) Do you see the group in the App Browser when you look
> at that card?
>


Yet the group is there in the application browser.  I have no idea how to
figure out whether the displayed menu is from the source stack, or the
cloned stack itself.

But in any event, the cloned stack is not an exact clone.

I also have each "normal" (non palette) stack setting its menu as the
default menu bar when opening or resuming.


>
>
>> OK, I found it.  in my setMenus handler, I have
>>
>> set the menuBar of stack otWnNm to the long id of  group "stk_menu" of
>> stack otWnNm
>>
>> (sometimes set only for macos)
>>
>
> You've assigned a menu from a different stack. This does not copy the
> group, it just loads that menu into the Mac system menu bar. On Windows
> there will be no menus because the group isn't placed on that card.
>

Am I missing something?  both seem to be stack otWnNm (which holds a short
name)

I have a maintenance routine that runs when the filename/version changes.
It loops through the user visible stacks, copies the mcp menu to cd 1 if
there is not already a menu of one of the two defined names (i.e., mcp_menu
for generic menus, and stk_menu if the stack has it's own), and then places
the menu on cd 1 of these stacks on any other cards in the stack that lack
a menu of the same name (I understand that this is unnecessary for mack)


>
>
>> This line is making the group visible, but checking editMenus shows that
>> it
>> is still false.
>>
>
> This is confusing. If there is no physical group placed on that card,
> nothing should show. If you mean the menus are in the system menu bar, then
> it makes sense; the menus are being loaded from a group on a different
> stack, which is only possible on a Mac.
>

There are menus on every card of every stack (by a background group)


>
> I think you're making this too hard. Create the menu group in Out0, set
> its backgroundBehavior to true, and place it on every card in that stack.
> Set the menubar of Out0 to the short name of the group. You don't need to
> script anything else for menu setup, just do this once during development.
> When you clone the stack it should just work.


I think this is what I'm doing.


> Unless you are changing the content of the menu buttons dynamically, you
> won't need a setMenus handler.
>

I need to change dynamically, yes.  The first six entries of the Window
menu stay the same, but as output windows are added and deleted, it
changes.  It's even using | so that I can use the displayed value to show
the name of the card.   2-5 simultaneous output windows would probably be
typical.

The state of editMenus is not saved with the stack, it will change to its
> default of false on a Mac and true on Windows on each launch. So you don't
> really need to worry about that in the final app, it's a development tool.


I didn't realize that . . .

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list