Option Menu to show menu item by code - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Option Menu to show menu item by code - Solved
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
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
Last edited by DR White on Mon Aug 01, 2016 7:40 pm, edited 2 times in total.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code Not mouse click
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.
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
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
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
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:
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
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
Craig Newman
Re: Option Menu to show menu item by code Not mouse click
Craig,
WOW! That works BEAUTIFULLY!
The LiveCode Forum with people like you and many others make using LiveCode worth every dollar!
Thanks,
David
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
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
But as for "magic", do you see how the LC environment, in one line, can support such klugey marvels?
Craig
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code - Solved
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.
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
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
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
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code - Solved
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
This works:
on mouseUp
set the defaultStack to "revMenubar"
click at the loc of btn "Tools"
end mouseUp
Last edited by richmond62 on Tue Aug 02, 2016 7:12 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Option Menu to show menu item by code - Solved
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.richmond62 wrote:I suppose one could "navigate" by code as well . . .
This works:
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: Option Menu to show menu item by code - Solved
The way around all this is to create a "clicking" message:
and then in a card script
Craig
Code: Select all
send "clicking" to objectpathName
Code: Select all
on clicking
click at the loc of the target
end clicking
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code - Solved
Yup.Good fun.
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
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code - Solved
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.
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.
Last edited by richmond62 on Tue Aug 02, 2016 7:11 pm, edited 2 times in total.
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Option Menu to show menu item by code - Solved
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.
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.
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
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Option Menu to show menu item by code - Solved
Point taken.Why post screen shots of your scripts
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.