Menus across the entire stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Menus across the entire stack

Post by jalz » Thu Dec 31, 2015 2:15 pm

Hi Guys,

I've built my app, which comprises of a main stack and then multiple stacks underneath. I've created a menu on the top mainstack and I wanted it to be applied to all the cards in my application. On a Mac it seems to work ok, I think from my limited testing, but on a Windows environment, the menu is on top of the card instead of the menubar. When I switch over to another card, I lose the menu as its only applied to the main card. Am I missing something? Do the menus only work on cards on a Windows environment (testing on Win 10), or can I have them up in the toolbars like you can with the Mac application?

Many thanks as always

Jalz

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Menus across the entire stack

Post by dunbarx » Thu Dec 31, 2015 2:47 pm

Hi.

Isn't this how Windows (and Linux) works? I am a Mac guy, but for LC to be able to support all platforms, the group of buttons that actually comprise the menubar are always placed at the top of the card window, and a special action hides them for Mac, placing that group in the standard menubar.

If the group has its background behavior set to "true", it will appear on all cards. The point is that these controls are just groups of buttons with certain properties, and not a separate type of control, like HC had.

Craig Newman

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Menus across the entire stack

Post by jalz » Sun Jan 03, 2016 6:44 pm

Hi Craig,

I've looked at other applications, like FileMaker or Office for instance. They seem to have an application environment which contain the menus and then windows within this environment. I guess the stack is the application environment and each window that is loaded is a card. I suppose I am trying to mimic the same kind of functionality with my app but because I have many substacks I guess I am going to have to have a menu on each substack. In hindsight I should have created one stack and many cards within that to get the look and feel that I wanted.

Now that I've created the app with many substacks and I have defined a menu on the main stack, anyone advise me if I can can apply the same menu from the main stack to all the other stacks or do I need to recreate the menu for each stack? I was hoping something like this would work

set menu of this stack to "menu1" of stack "main"

Thanks
Jalz

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Menus across the entire stack

Post by jacque » Mon Jan 04, 2016 6:38 pm

Almost there:

Code: Select all

set the menubar of this stack to "menu1" of stack "main"
That works for Mac. On Windows you need to place the menubar on each card. Since menus are a group, use group syntax:

Code: Select all

repeat with x =1 to the number of cards 
   place group "menu1" onto card x
end repeat 
If the stack doesn't have room for the menubar you'll need to make it taller and push all the objects on each card down to leave space at the top. If that's something you need to do, let us know and I'll give you a link to an automation handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Menus across the entire stack

Post by dunbarx » Mon Jan 04, 2016 8:02 pm

Jacque.
If the group has its background behavior set to "true", it will appear on all cards.
Unless the group was already created, of course, and had to be placed on additional cards.

I just want to make sure I am not missing some aspect of Windows (ptui).

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Menus across the entire stack

Post by jacque » Mon Jan 04, 2016 9:07 pm

Unless the group was already created, of course, and had to be placed on additional cards.
Right. As far as placement is concerned, menu groups behave like any other group. Since the OP didn't have the group on the existing cards yet, it has to be placed. You can place a group that exists in another stack as long as the stack is in the object hierarchy, which a mainstack would be. It might be safer to copy the group to each substack first, I suppose.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Menus across the entire stack

Post by jalz » Mon Jan 04, 2016 10:28 pm

Thanks Guys,

Most useful, I've copied the menu group over from the main stack to one of my other stacks. That seems to work :)

I guess whenever I make a change to the menu structure in the main stack, I will need to copy and paste buttons and groups back to the other stacks?

Jalz

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Menus across the entire stack

Post by jacque » Mon Jan 04, 2016 10:58 pm

jalz wrote:I guess whenever I make a change to the menu structure in the main stack, I will need to copy and paste buttons and groups back to the other stacks?
The advantage of placing the group that lives in the mainstack is that you don't have to maintain separate copies. Otherwise, if you put a copy into every stack, then you do need to update each instance of the group if it changes.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Menus across the entire stack

Post by jalz » Tue Jan 05, 2016 2:31 pm

Thanks Jacque,

I tried the placing the group, but because my cards are in a substack below the main stack no group gets placed on the card. I tried placing the menu group on another card in the main stack and that seemed to work fine. I don't think you can place groups in cards that are in another stack even though they may be below the stack the original group is in, unless I'm doing someone wrong as usual.

Jalz

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Menus across the entire stack

Post by dunbarx » Tue Jan 05, 2016 3:38 pm

I think you are correct. The "place" command seems to only be comfortable within a single stack.

You can always embellish this, though:

Code: Select all

on mouseUp
   copy group yourGroup
   go stack "yourOtherStack"
  paste
   go back
end mouseUp
Or something like that, and you can certainly, once in the other stack, place the group onto any or all cards there.

Craig Newman

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Menus across the entire stack

Post by jacque » Tue Jan 05, 2016 8:31 pm

Yes, apparently you're both right. I had a setup in the past where I used a group across stacks but it no longer seems to work. Sorry for the misdirection.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Menus across the entire stack

Post by jalz » Tue Jan 05, 2016 9:37 pm

HI Guys,

Thank you both, no need to apologise Jacque, you've been most helpful. I'm learning by trying new things out I now know what the place group command does :). Just copied and pasted the group as per Craigs instruction, seems to work, pity they don't work as an inherited menu, but non the less its just a little more maintainenece on my part.

Thanks

Jalz

Post Reply