highlight a button in standalone+.rev app

rev at armbase.com rev at armbase.com
Fri Jul 1 06:35:28 EDT 2005


Quoting Richard Gaskin <ambassador at fourthworld.com>:

Hi Richard

> rev at armbase.com wrote:
> > I'd like to have just one button injector and a system to customise the
> function
> > of the button. What I envisage is a drop down list that enters a script
> into the
> > button.
>
> Have you considered using a custom property instead?

I hadn't really considered this for one really stupid reason. I have not got a
clue how custom properties work. I struggled for ages with TAB's and then
EUREKA!!!!! :-) I cried. I got it and felt so stupid because it was so easy.

I read a lot about custom properties but I don't know of any simple examples.
>
> For example, one way to assign behaviors to objects is the define the
> behavior in a frontScript, triggered by the actions you want to respond
> to.  A custom property in the target determines whether the custom
> behavior is invoked, or the message is simply passed.
>
> For your buttons:
>
>    set the uAction of btn 1 to "AutoBehavior"
>
>
> In your frontScript:
>
>    on mouseUp
>      if the uAction of the target = "AutoBehavior" then
>          DoAutoBehavior --< your stuff here
>      else pass mouseUp
>    end mouseUp
>
>
> If you want different actions you can add lots of options without making
> it unreadable with a switch block rather than nested IFs:
>
>    on mouseUp
>       switch the uAction of the target
>       case "AutoBehavior"
>          DoAutoBehavior
>          break
>       --
>       case "AnotherBehavior"
>          DoAnotherBehavior
>          break
>       --
>       default
>         pass mouseUp
>       end switch
>    end mouseUp
>

OK I'll readup on this.
>
>
>
> As for the name of an unknown stack, usually topStack() will return what
> you need. Here are the notes from the Transcript Dictionary entry for
> the topStack function:
>
>    In most applications, the active window holds the current
>    document, and menu commands operate on the active window.
>    In Revolution, because of the ability to open stacks in
>    various modes, this is not necessarily the case.
>
>    Each open window has a mode associated with it. The
>    topStack is the frontmost stack with the lowest mode.
>
>    For example, an editable window has a mode of 1, and a
>    palette has a mode of 4. If several palettes and editable
>    windows are open, the topStack is the frontmost editable
>    stack, although palettes may be in front of it. If all
>    the editable windows are then closed, the frontmost
>    palette becomes the topStack, since there is now no
>    window with a lower mode.

Ohhhh This is very interesting.

Thanks for pointing me in the right direction. I think I'll have a lot of fun
with this.

PS sent a private mail re:revjournal.

Regards
Bob




More information about the use-livecode mailing list