Getting the line number from "on menupick"

J. Landman Gay jacque at hyperactivesw.com
Thu Nov 12 18:35:28 EST 2009


Richard Miller wrote:
> I have a pulldown button with data in it that makes it act as a 
> cascading menu. When the user selects an item, I need to know which item 
> has been selected... not just the text, but the line number or some 
> other data that would let me know which item was selected, so I can get 
> more info about that item from an associated database.
> 
> The problem I have is that many of the lines in the cascading menu 
> appear identical by name, though they are not the same item. It's just 
> that the label assigned by the user is the same (they represent names of 
> videos.... and the user can name them any way they want, even though the 
> actual file names are different).

I think the only way is to simply disallow duplicate labels. That's not 
an unrealistic expectation. When the user assigns a label, check to be 
sure it isn't already in use, and prompt them to change it if it is. Or 
have a script assign a trailing number as you mentioned.

After that, you can use offset() to find the line number in the text of 
the button, but you probably won't need to. If the labels are different, 
regular menupick methods will work. Set the itemdelimiter to pipe ("|") 
and read the second "item" of the menupick parameter.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list