Page 1 of 2
Option Menu to show menu item by code - Solved
Posted: Sun Jul 31, 2016 10:35 pm
by DR White
I have banging my head now for over 3 hours trying to figured out,
if it is possible to get an Option Menu to show menu items with some program instructions.
If anybody knows how, I would greatly appreciated it.
Thanks,
David
Re: Option Menu to show menu item by code Not mouse click
Posted: Mon Aug 01, 2016 7:43 am
by richmond62
I wonder if you could explain what you mean a bit more clearly.
Do you mean a menu that, when you click on it, shows the underlying code/scripts
behind menu items?
If this is what you mean then it really isn't necessary as one can "fool around"
in the IDE and look at the underlying code within it as much as one wants already.
If, alternatively (and your title is a bit difficult to interpret) you want to make a menu drop down
"magically" powered by script that's a different thing altogether, and I wonder what the point of
it would be.
Re: Option Menu to show menu item by code Not mouse click
Posted: Mon Aug 01, 2016 5:08 pm
by DR White
richmond62,
I want to make a menu drop down
"magically" powered by script.
I am working on a special IOS app that I need the Option Button menu (IOS picker) to open, when the card is open.
Thanks
Re: Option Menu to show menu item by code Not mouse click
Posted: Mon Aug 01, 2016 6:09 pm
by dunbarx
LC is good at magic.
There were threads on this a while ago, but I cannot find them. But start with this. Make an option menu. Make another button. In that other button's script:
Code: Select all
on mouseUp
click at the loc of btn 1
end mouseUp
Those other threads explored similar kluge methods of selecting menuItems of interest once the menuItems were displayed. This can all be re-created. Can you get going on this?
Craig Newman
Re: Option Menu to show menu item by code Not mouse click
Posted: Mon Aug 01, 2016 7:39 pm
by DR White
Craig,
WOW! That works BEAUTIFULLY!
The LiveCode Forum with people like you and many others make using LiveCode worth every dollar!
Thanks,
David
Re: Option Menu to show menu item by code - Solved
Posted: Mon Aug 01, 2016 7:55 pm
by dunbarx
Well, glad you like it.
But as for "magic", do you see how the LC environment, in one line, can support such klugey marvels?
Craig
Re: Option Menu to show menu item by code - Solved
Posted: Mon Aug 01, 2016 8:35 pm
by richmond62
Well, up to a point.
This doesn't work:
on mouseUp
click at the loc of btn "Tools" of stack "revMenubar"
end mouseUp
nor does it work between any 2 open stacks.
This is a pity as the ability to do this would be very useful indeed.
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 3:20 am
by dunbarx
Richmond.
I think one has to be on a card in order to "click"on it. I see no reason why this should be so, as you say. So you must navigate before clicking.
Craig
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 4:55 pm
by richmond62
I suppose one could "navigate" by code as well . . .
This works:
on mouseUp
set the defaultStack to "revMenubar"
click at the loc of btn "Tools"
end mouseUp
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 5:40 pm
by FourthWorld
richmond62 wrote:I suppose one could "navigate" by code as well . . .
This works:
Zippedy_Doo_Dah.png
Good fun. If you can figure out a way to type arrow key and Enter key messages you could simulate all sorts of user actions in menus.
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 6:08 pm
by dunbarx
The way around all this is to create a "clicking" message:
and then in a card script
Code: Select all
on clicking
click at the loc of the target
end clicking
Craig
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 6:11 pm
by richmond62
Good fun.
Yup.
I wonder how one could do something like this:
(pseudocode)
send (controlKey & 3) to btn "View"
c.f:
http://runtime-revolution.278305.n4.nab ... 53818.html
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 6:45 pm
by richmond62
This works:
on mouseUp
set the defaultStack to "revMenubar"
click at the loc of btn "View"
select menuItem 3 of btn "View"
end mouseUp
Mind you; that's pretty silly when a "go next" would have done the trick anyway.
The only "slight snag" is that you don't see the menuItem high-lighted.
Also: not a bad idea to have a second "click at loc of" after the select so the
menu doesn't keep hanging down.
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 7:02 pm
by FourthWorld
That triggers the script for the menuitem, but doesn't dismiss the menu, and doesn't even require the menu be dropped down. Might be nice if there was a way to truly simulate selection of a menu, with item flash and all.
PS: Why post screen shots of your scripts instead of just posting the code? The screenshots take up more space, and don't allow anyone to copy the script, requiring them to re-type it.
Re: Option Menu to show menu item by code - Solved
Posted: Tue Aug 02, 2016 7:13 pm
by richmond62
Why post screen shots of your scripts
Point taken.
Might be nice if there was a way to truly simulate selection of a menu, with item flash and all.
click at the loc of menuItem 3 of btn "View"
didn't do any good at all.