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

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Fri Nov 25, 2016 8:17 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Sat Nov 26, 2016 4:34 pm

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

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Fri Dec 02, 2016 2:24 pm

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:
Last edited by Mag on Fri Dec 02, 2016 2:39 pm, edited 1 time in total.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Dec 02, 2016 2:39 pm

What exactly happens if "it don't work"? What do you see in the menubar?
Really no menubar set in the substacks?

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Fri Dec 02, 2016 2:46 pm

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?
Last edited by Mag on Fri Dec 02, 2016 2:50 pm, edited 1 time in total.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Dec 02, 2016 2:59 pm

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

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Fri Dec 02, 2016 3:16 pm

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"

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Dec 02, 2016 3:25 pm

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

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Sat Dec 17, 2016 1:54 pm

Done in this way, all work fine now, thank you!

Post Reply

Return to “Mac OS”