Page 1 of 1

mobilePick

Posted: Wed Apr 04, 2012 9:07 am
by Jason1234
I have a list of items to choose in the mobilePick OFF,ON,FLASHING,1 FLASH......

The result of the selected item is the index value of the item selected 1,2,3,4....

Can the text of the selected item be used... label or something?

I could do this in code depnding on the item selected but I have a few of these to do so I would prefer to be able just to use the text of the selected item not it's index value.

Currently I am having to do this

Code: Select all

   mobilePick "OFF" & return & "ON" & return & "FLASHING" & return & "1 FLASH" & return & "2 FLASHES"
    switch the result
         case "1"
         Put "OFF"  into  toperation
         break
         case "2"
         Put "ON" into toperation
         break
         case "3"
         put "FLASHING" into toperation
         break
         case "4"
         put "1 FLASH" into toperation
         break
         case "5"
         put "2 FLASHES" into toperation
          break
end switch
       set the label of btn "operation" to toperation
Can anyone help point me in the right direction?

Re: mobilePick

Posted: Wed Apr 04, 2012 5:17 pm
by jacque
Put the list into a variable before you send it to the mobilepick command. When the index value is returned, just "get line <index>" of the variable. I.e.:

Code: Select all

put "OFF" & return & "ON" & return & "FLASHING" & return & "1 FLASH" & return & "2 FLASHES" into tList
mobilePick tList
put the result into tIndex
put line tIndex of tList into tText
switch tText
 case "on"
  ... etc

Re: mobilePick

Posted: Thu Apr 05, 2012 2:41 am
by Jason1234
Thank you again, you are always so willing to help...and usually one of the first too.

I ended up needing to have different mobilePick options list so the variable option would not save that much in coding.

I got it working, perhaps not that refined but it works.

Thank you again for your suggestion.