Page 1 of 1

Menu PopUp

Posted: Fri Sep 16, 2011 8:20 pm
by Phil_p
Hi,

I have a pop up menu which uses a stack as the pop up menu. Within the stack there is a Scrolling List Field, some buttons and some Text Fields. The code for these controls is held within this Stacks script. When I click on the button it shows the stack in the drop down menu but when i click in the stack I can not get the code to run on the stack. The stack closes straight away and the code will only run within the dropdown script.

How can I send the menuPick message to the stack and 'cancel' the drop down cancel message

thanks

Phil

Re: Menu PopUp

Posted: Sat Sep 17, 2011 12:59 am
by Mark
Hi Phil,

Your stack should not contain any scripts that run after the stack closes. Scripts in closed stacks can't run.

You have to catch the menuPick message in the script of the button that opens the popup menu stack or higher up the message hierarchy.

If you use the scrolling field to make a choice, you could save this choice in a global variable. This variable will still be available after the stack closes. You can also use a custom property of an object that is stll available after the menu stack closes.

Kind regards,

Mark

Re: Menu PopUp

Posted: Sat Sep 17, 2011 9:00 am
by Phil_p
Hi Mark,

Thanks for your reply.

Currently I can not select items in the list box as when i click on an item in the list it closes the stack. I can use the menupick to catch the users action on buttons etc but it will only access the highlighted item in the listbox which is always the first item irrelevant of where i click.

thanks

Phil

Re: Menu PopUp

Posted: Sat Sep 17, 2011 9:05 am
by Mark
Hi Phil,

As you have probably noticed, choices in menus are never made by clicking but by moving. Use the mouseMove handler to change the selectedLine of the list field. Make the list field scroll automatically if the mouse cursor is at the bottom or top of the field. Don't use a scroll bar.

Kind regards,

Mark

Re: Menu PopUp

Posted: Sat Sep 17, 2011 9:36 am
by Phil_p
Hi Mark

Will the mousemove event still work on a iPad app?

Phil

Re: Menu PopUp

Posted: Sat Sep 17, 2011 9:38 am
by Mark
Hi Phil,

Yes, I believe it still works on an iPad, but an iPad interface is supposed to be different from a desktop interface so I wouldn't bother using LiveCode's menus.

Kind regards,

Mark

Re: Menu PopUp

Posted: Sat Sep 17, 2011 9:44 am
by Phil_p
Yeh, Im taking your advice on this and have decided to keep the app iPad native

Re: Menu PopUp

Posted: Sat Sep 17, 2011 11:32 am
by Klaus
Hi Phil,

and since iOS only supports the display of ONE stack at a time,
popping up a STACK will not work anyway!


Best

Klaus

Re: Menu PopUp

Posted: Sat Sep 17, 2011 11:39 am
by Mark
Hey Klaus! That's a nice catch. Didn't think of that. Menus work, though. I wonder how that's done, internally.

Mark