Hilighting of selected row in Option button, doesn't hilight

J. Landman Gay jacque at hyperactivesw.com
Wed Mar 4 19:21:28 EST 2009


mfstuart wrote:
> Hi Jacque and all,
> I worked a sample script for the Option button, and I'm still not getting
> the line in the text of the button to hi-light, when clicking on the button
> a 2nd time.
> Here's my script:
> ======================
> on menuPick pItemName
>    --this script borrowed from Ken Ray from an archive search :)
>    lock messages
>    --get/set the menuHistory
>    put lineOffset(pItemName,the text of me) into tNum
>    if tNum <> 0 then
>       set the menuHistory of me to tNum
>    end if
>    unlock messages
> end menuPick
> ======================
> 
> What am I missing here?

I'm not sure, it works for me the way you want when I tested your 
script. But you don't really need any of that for a plain option button. 
Actually you don't need a script at all to get the behavior you're 
describing, since it's the default behavior. For manual selection by a 
user, the menuhistory is set automatically, so I probably misled you 
when I mentioned it. You don't need to set it in a script unless you 
want to activate the button without any user interaction.

Rev provides a template script in a new option button that is probably 
more what you'd want to use. Like this:

on menuPick pItemName
    switch pItemName
       case "one"
       -- stuff for this choice
       break
       case "two"
       -- stuff for case 2
       break
       -- etc
    end switch
end menuPick

This should behave as you expect.
-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list