Stack as Menu example? [SOLVED]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Stack as Menu example? [SOLVED]
Was looking around for an example of using a stack as a menu but couldn't find anything. Tried winging it and made my own.. but yeah, it don't work as it should. By chance does anyone have an example of using a stack as a menu?
Thanks,
~Garrett
Thanks,
~Garrett
Last edited by Garrett on Sun Aug 10, 2014 6:23 pm, edited 1 time in total.
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Re: Stack as Menu example?
Hi.
When you say "use stack as a menu" are you trying to create a custom "ask" or "answer" dialog?
Craig Newman
When you say "use stack as a menu" are you trying to create a custom "ask" or "answer" dialog?
Craig Newman
Re: Stack as Menu example?
No, as a pulldown menu
I can get the stack with my testing menu on it of a couple buttons to show up as a menu under the button I use the pulldown command, but I can't figure out how to get the buttons on the menu stack to actually act/react like a menu.
Displays a pulldown menu whose whose menu items are buttons in a stack.
Code: Select all
on mouseDown
pulldown stack "Lookup Options"
end mouseDown
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Re: Stack as Menu example?
Hi Garrett,
It works for me.
I think you have to use the path of the stack instead the short name
Jean-Marc
It works for me.
I think you have to use the path of the stack instead the short name
Code: Select all
on mouseDown
answer file "open"
if it = empty then exit mousedown
pulldown stack it
end mouseDown
https://alternatic.ch
Re: Stack as Menu example?
The stack itself is not the problem, when I click the button assigned to pulldown the stack as a menu, that works. What I don't know how to do is setup the stack itself with the buttons to work like a menu.
Thanks,
~Garrett
Thanks,
~Garrett
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Re: Stack as Menu example?
why a stack? put some buttons over a rectangle into a group and show or hide them on click/rollover or rollout and it keeps it all on 1 card
Re: Stack as Menu example?
Hi Garrett,
For menus I always use groups as said Da_Elf.
Something like that:
Best regards
Jean-Marc
For menus I always use groups as said Da_Elf.
If you have good reasons to use stack like menu and if it use handlers of the main stack, I think you have to use "start using stack" .how to do is setup the stack itself with the buttons to work like a menu.
Something like that:
Code: Select all
on mousedown
put the short name of this stack into tStartStack
pulldown stack the uMyStackMenu of this stack -- uMyStackMenu contains the path of menustack
if tStartStack is not among the lines of the stacksInUse then start using stack tStartStack
end mousedown
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Stack as Menu example?
Just put the buttons on with their autoArm and armFill properties set and and it works.Garrett wrote:The stack itself is not the problem, when I click the button assigned to pulldown the stack as a menu, that works. What I don't know how to do is setup the stack itself with the buttons to work like a menu.
You don't even need to use the pulldown command, instead just set the main menu's menuName property to the short name of the stack you want it to display.
There's a bug in the current stable version of LC (6.6.2) which prevents the main menu button from getting the menuPick message, but apparently this has been fixed for v6.7 dp 8 and 7.0 dp 9.
Note that using stacks as pulldown menus only works on Windows and Linux, and not on Mac. To accommodate the Mac's global menu bar, LiveCode's ordinary handling of menus is translated to Mac APIs, which aren't compatible with LC stacks.
Even on Windows and Linux, the behavior is a bit funky at times. In the olden days (early '90s), the original engine was released for Unix only, and all menus were implemented as stacks. With the Windows port in '96/'97, the menus were revamped to use a list of strings instead, and for normal-looking menus it's really much easier to just use the modern string method.
One thing stack menus can be good for is galleries or other unusual menus, but given that they can't be used on Mac as pulldowns from the global menu bar I tend to use an icon within the window for those.
Also, keep in mind that the behavior of stack menus is very limited, only supporting the same interaction as a normal menu: items hilite as the mouse is moved over them, and once anything in the stack is clicked the menu stack is dismissed. So if you need any other type of interation (controls requiring multiple clicks, sliders, etc.) better to consider a panel-like view using a borderless palette instead.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Stack as Menu example?
I'm not sure if the stack menu is for the main system menu or for a popup button. If used with a button it will work on Mac. In that case, each stack button must have its own mouseUp handler that calls a command on the current card or executes its own handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Stack as Menu example? [SOLVED]
Thank you Richard, that's what I needed 
It's a Linux only program. I just wanted to replicate the menus being used on the distribution I use. The popup menu did not quite allow for me to change it's properties enough to replicate the menus the desktop is using, mainly removing threeD, setting borderwidth to 1, width of the menu itself, margins of each entry.
~Garrett

It's a Linux only program. I just wanted to replicate the menus being used on the distribution I use. The popup menu did not quite allow for me to change it's properties enough to replicate the menus the desktop is using, mainly removing threeD, setting borderwidth to 1, width of the menu itself, margins of each entry.
~Garrett
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)