Option menu tagged to array
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Option menu tagged to array
Hi guys,,
Please need some help. I dont know if it is possible or not. But lets see.
I have some data array in field "mylist" in following manner:
xx,xxx
yy,yyy
zz,zzz
I am able to populate option menu ( with xx or yy or zz);
Now, Is it possible to having either option selected, retreive related data as in array like xx to retrieve xxx.....
Thanks....
Please need some help. I dont know if it is possible or not. But lets see.
I have some data array in field "mylist" in following manner:
xx,xxx
yy,yyy
zz,zzz
I am able to populate option menu ( with xx or yy or zz);
Now, Is it possible to having either option selected, retreive related data as in array like xx to retrieve xxx.....
Thanks....
Last edited by saviour on Fri Nov 13, 2015 3:22 pm, edited 1 time in total.
Re: Option menu tagged to array
Hi.
I assume you do not want to see the "related" data in the actual button, that is, you want to see "xx" but "get" "xxx". Is this true?
If so, load the array into a custom property, and grab the associated data, since it is already built. A "key" would be chosen from the option menu and the associated element pulled from the property. Do you know how to do that?
Craig Newman
I assume you do not want to see the "related" data in the actual button, that is, you want to see "xx" but "get" "xxx". Is this true?
If so, load the array into a custom property, and grab the associated data, since it is already built. A "key" would be chosen from the option menu and the associated element pulled from the property. Do you know how to do that?
Craig Newman
Re: Option menu tagged to array
Thanks for that..
Yes, I want related data 'XXX' in another custom variable or field if key "XX' chosen in the menu. Please guide me

Yes, I want related data 'XXX' in another custom variable or field if key "XX' chosen in the menu. Please guide me

Re: Option menu tagged to array
You can shorten the handler a bit:
The do what Craig said, use the selection as the array key to get the value.
Code: Select all
on preopencard
put fld "MyList" into gMyArray
split gMyArray by cr and comma
set the text of btn "listIn" to the keys of gMyArray
end preopencard
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Option menu tagged to array
OK. I am going to do this for you, but you have to examine each line (there are only a few) of the following handlers and tell me what they do. On a new card, make a field, standard button, and an option button. Name the option button "XYZ".
In the field, put your:
In the script of the standard button:
In the script of the option button:
A little Jacque, a little me. I expect comments.
Craig
In the field, put your:
Code: Select all
xx,xxx
yy,yyy
zz,zzz
Code: Select all
on mouseUp
put fld 1 into gMyArray
split gMyArray by cr and comma
set the text of btn "XYZ" to the keys of gMyArray
set the relatedData of btn "XYZ" to gMyArray
end mouseUp
Code: Select all
on menuPick pItemName
get the relatedData of me
answer it[pItemName]
end menuPick
Craig
Re: Option menu tagged to array
Thanks a lot guys.
Your suggestions are like lightbulb to me. I am able to do it by putting the menu selection in another variable and finally feeding it to the array.
put gMyArray[tOption] into tName
Answer tName
Thanks again.
Your suggestions are like lightbulb to me. I am able to do it by putting the menu selection in another variable and finally feeding it to the array.
put gMyArray[tOption] into tName
Answer tName
Thanks again.