Page 1 of 1

What is the correct way to install the menubar on Mac?

Posted: Fri Nov 25, 2016 8:17 pm
by Mag
I created the menubar item with Menu Builder. Currently I use this code to install it:

Code: Select all

   if the environment is "standalone application" then
      set the menubar of this stack to "AppMenubar"
   end if
All works well, but, sometimes, maybe after I move to another stack, I choose a menu item and it don't wok.

Re: What is the correct way to install the menubar on Mac?

Posted: Sat Nov 26, 2016 4:34 pm
by Klaus
Hi Mag,

maybe use a more global approach :D

Code: Select all

...
   if the environment is "standalone application" then
      set the defaultmenubar to "Appmenubar"
   end if
...
Best

Klaus

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 2:24 pm
by Mag
Done in that way, unfortunately some times it don't work.

Code: Select all

on preOpenStack
     if the environment is "standalone application" then
      set the defaultMenubar to "AppMenubar"
      -- set the defaultMenubar to the long ID of group "AppMenubar" of this stack
      -- set the menubar of this stack to "AppMenubar"
   end if
end preOpenStack
PS
I have an app that opens and close substacks. 2 years of trials, read all the documentation I found on LiveCode & menus and I have not found a way to have a menubar that works fine on Mac. Surely it is I who do not understand something. Maybe the card in which I put the group of menu buttons... :roll:

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 2:39 pm
by Klaus
What exactly happens if "it don't work"? What do you see in the menubar?
Really no menubar set in the substacks?

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 2:46 pm
by Mag
The app opens different sub-stacks each of them is a copy of the main stack I use as matrix. The group of menu buttons is in that stack, so each window has the group of menu buttons.

When the menu don't work you can choose the menu item which it become selected but no action is followed and this is not trigged:

Code: Select all

on menuPick pWhich
   
   answer pWhich &return&return& the topStack &return&return& the openStacks
   exit menuPick
Maybe the card where I put the group of menu buttons is wrong, what is the best practice to choose where to put the group of menu buttons?

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 2:59 pm
by Klaus
Hi Mag,

do only use ONE group of buttons for your menubar, best in the mainstack, the one you open first
and which has the above metioned script:

Code: Select all

on preOpenStack
     if the environment is "standalone application" then
      set the defaultMenubar to "AppMenubar"
   end if
end preOpenStack
This way the menubar "AppMenubar" will be available across ALL open stacks, main and sub stacks.
And remove the menubars/group of buttons from your substacks.

Has worked for me for years! :D


Best

Klaus

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 3:16 pm
by Mag
Unfortunately the menubars/group of buttons is in the main stack and I clone the main stack to have instances of the window in my app (each window is an open document).

Code: Select all

clone invisible stack "Matrix"

Re: What is the correct way to install the menubar on Mac?

Posted: Fri Dec 02, 2016 3:25 pm
by Klaus
Hi Mag,

OK, I see!

In that case do this:
Create a substack of your mainstack, this will never be opened and only "host" your menubar group.
Name it whatever you like.
Copy your menubar to the first and only card of that substack.
Delete the menubar from your mainstack!

That's it, LC will find the menubar in your substack in your "preopenstack" script and you can happily
clone/copy your mainstack without problems or copies of your menubar!

And this will also get rid of the "shrinking" stack phenomenon if you have the menubar in your mainstack! :D


Best

Klaus

Re: What is the correct way to install the menubar on Mac?

Posted: Sat Dec 17, 2016 1:54 pm
by Mag
Done in this way, all work fine now, thank you!