select MenuItem
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
select MenuItem
Hi Again,
I am trying to simulate an option button being pressed and an item being selected from its options.
-- I am trying
select menuItem 1 of btn "Fig1_Seq1"
--
But this only occasionally works, only worked once in fact?
this button has some scripts in its mouse up that I am looking to trigger..
any ideas?
I am trying to simulate an option button being pressed and an item being selected from its options.
-- I am trying
select menuItem 1 of btn "Fig1_Seq1"
--
But this only occasionally works, only worked once in fact?
this button has some scripts in its mouse up that I am looking to trigger..
any ideas?
Re: select MenuItem
okay so this works if i have manually clicked the button at least once before trying to use this. but, i have another function which resets the label of these buttons and once this is ran I am back to the same situation. have to manually select it and select a value for the select menuItem function to work again?
Re: select MenuItem
Code: Select all
set the menuHistory of button "Fig1_Seq1" to 1
Re: select MenuItem
use this as well?
or replace menuItem with menuItem History
or replace menuItem with menuItem History
Re: select MenuItem
still no good.
here is the code I have from the card script
on zeroSequence
--Zero all 12 Figures
select menuItem 1 of button "Seq1_Fig1"
select menuItem 1 of button "Seq1_Fig2"
select menuItem 1 of button "Seq1_Fig3"
select menuItem 1 of button "Seq1_Fig4"
select menuItem 1 of button "Seq1_Fig5"
select menuItem 1 of button "Seq1_Fig6"
select menuItem 1 of button "Seq1_Fig7"
select menuItem 1 of button "Seq1_Fig8"
select menuItem 1 of button "Seq1_Fig9"
select menuItem 1 of button "Seq1_Fig10"
select menuItem 1 of button "Seq1_Fig11"
select menuItem 1 of button "Seq1_Fig12"
--
end zeroSequence
and here is the script from one of the button
--
on menuPick pItemName
put "DATA=1 - " & pItemName & " - -" into line 8 of field "ScoreRunS1"
end menuPick
here is the code I have from the card script
on zeroSequence
--Zero all 12 Figures
select menuItem 1 of button "Seq1_Fig1"
select menuItem 1 of button "Seq1_Fig2"
select menuItem 1 of button "Seq1_Fig3"
select menuItem 1 of button "Seq1_Fig4"
select menuItem 1 of button "Seq1_Fig5"
select menuItem 1 of button "Seq1_Fig6"
select menuItem 1 of button "Seq1_Fig7"
select menuItem 1 of button "Seq1_Fig8"
select menuItem 1 of button "Seq1_Fig9"
select menuItem 1 of button "Seq1_Fig10"
select menuItem 1 of button "Seq1_Fig11"
select menuItem 1 of button "Seq1_Fig12"
--
end zeroSequence
and here is the script from one of the button
--
on menuPick pItemName
put "DATA=1 - " & pItemName & " - -" into line 8 of field "ScoreRunS1"
end menuPick
Last edited by Nakia on Wed Mar 14, 2012 1:01 am, edited 1 time in total.
Re: select MenuItem
No.
Not
Instead
Not
Code: Select all
select menuItem 1 of button "Seq1_Fig1"
Code: Select all
set the menuHistory of button "Seq1_Fig1" to 1
Re: select MenuItem
I am having trouble understanding what you are doing. Are you trying to invoke the popup itself externally, that is, to make the option list appear, not by clicking on the actual button, but via a click somewhere else or from a handler running somewhere? If so, write back. I wrote a script to do this years ago. I can probably find it, or rewrite it.
Craig Newman
Craig Newman
Re: select MenuItem
doesnt workmwieder wrote:No.
NotInsteadCode: Select all
select menuItem 1 of button "Seq1_Fig1"
Code: Select all
set the menuHistory of button "Seq1_Fig1" to 1
Re: select MenuItem
No,dunbarx wrote:I am having trouble understanding what you are doing. Are you trying to invoke the popup itself externally, that is, to make the option list appear, not by clicking on the actual button, but via a click somewhere else or from a handler running somewhere? If so, write back. I wrote a script to do this years ago. I can probably find it, or rewrite it.
Craig Newman
I don't need the popup to display.
I simply have a button which calls zeroSequence (in above code)
When this is pressed I need the 12 buttons to action their script with "0" in pItemName ( as if someone selected the button and selected "0" from its option)
the button script inserts this data into a field..
make sense?
Re: select MenuItem
We are getting closer, I think. I am certain that there are many better ways to do what you want, however, whenever we figure out what that actually is. This is going to be fun. Really.
I think that you are trying to use the "select" command in the wrong way, as if this will invoke a handler in an option menu. It will not.
So you have 12 buttons. Is it true that if you manually clicked on each of them, you would select the first menuItem, and each would do something you want? Is there a "menuPick" handler that is invoked in each button so that "pItemName", as you say, and the first line in the menu would start it?
And so, are you trying, in a single click on one button, to run "zeroSequence", which will set in motion those 12 different "actions", on those 12 different buttons? Again, by "actions" do you mean invoke handlers? Write back if this is so.
In the meantime, for something completely different, does this make sense to you:
on mouseUp
repeat with y = 1 to 12
send "menuPick" && line 1 of btn ("Seq_Fig" & y) to btn ("Seq_Fig" & y) --parentheses for clarity
end repeat
end mouseUp
When I said this would be fun, I meant it. There will certainly be a way to work through your set-up. LiveCode will prevail. It seems that the way you are going about it might be a little out of the ordinary. But we will see. Write back....
Craig Newman
I think that you are trying to use the "select" command in the wrong way, as if this will invoke a handler in an option menu. It will not.
So you have 12 buttons. Is it true that if you manually clicked on each of them, you would select the first menuItem, and each would do something you want? Is there a "menuPick" handler that is invoked in each button so that "pItemName", as you say, and the first line in the menu would start it?
And so, are you trying, in a single click on one button, to run "zeroSequence", which will set in motion those 12 different "actions", on those 12 different buttons? Again, by "actions" do you mean invoke handlers? Write back if this is so.
In the meantime, for something completely different, does this make sense to you:
on mouseUp
repeat with y = 1 to 12
send "menuPick" && line 1 of btn ("Seq_Fig" & y) to btn ("Seq_Fig" & y) --parentheses for clarity
end repeat
end mouseUp
When I said this would be fun, I meant it. There will certainly be a way to work through your set-up. LiveCode will prevail. It seems that the way you are going about it might be a little out of the ordinary. But we will see. Write back....
Craig Newman
Re: select MenuItem
Thanks for your reply..
It is not true that the item that is generally selected is item 1..
Each of the 12 buttons uses its own MenuPick Message to perform its task.
-- see below example of the script in button number 1
on menuPick pItemName
put "DATA=1 - " & pItemName & " - -" into line 8 of field "ScoreRunS1"
end menuPick
So this function I am trying to create "ZeroSeq" (which is triggered by another button) needs to simulate each of the buttons being pressed and selecting "0" from its option list (as if someone actually manually performed this task) Obviously the popup doesnt need to appear...
The idea is its a shortcut to simulate someone actually pressing on each of these buttons and selecting "0" from its option list.
this is for a score keeping App I am writing..
I was previously doing this by (on the card script) changing the label of each of the buttons to "0" and writing the data to the field line by line but it seemed really long winded ( but it worked
)
I'm sure there is a better way to do it..
It is not true that the item that is generally selected is item 1..
Each of the 12 buttons uses its own MenuPick Message to perform its task.
-- see below example of the script in button number 1
on menuPick pItemName
put "DATA=1 - " & pItemName & " - -" into line 8 of field "ScoreRunS1"
end menuPick
So this function I am trying to create "ZeroSeq" (which is triggered by another button) needs to simulate each of the buttons being pressed and selecting "0" from its option list (as if someone actually manually performed this task) Obviously the popup doesnt need to appear...
The idea is its a shortcut to simulate someone actually pressing on each of these buttons and selecting "0" from its option list.
this is for a score keeping App I am writing..
I was previously doing this by (on the card script) changing the label of each of the buttons to "0" and writing the data to the field line by line but it seemed really long winded ( but it worked

I'm sure there is a better way to do it..
Re: select MenuItem
on mouseUp
repeat with y = 1 to 12
send "menuPick" && line 1 of btn ("Seq_Fig" & y) to btn ("Seq_Fig" & y) --parentheses for clarity
end repeat
end mouseUp
PERFECT THANKYOU.......
repeat with y = 1 to 12
send "menuPick" && line 1 of btn ("Seq_Fig" & y) to btn ("Seq_Fig" & y) --parentheses for clarity
end repeat
end mouseUp
PERFECT THANKYOU.......