use of ME in behaviors

Sivakatirswami katir at
Sat Oct 1 17:38:16 EDT 2011

I'm trying to understand behaviors so as to be more adept at using them.

I've examined the scripts of the datagrid library, which give much cause 
for wonderment.

the private command_initialize

we see references like:

  set the borderwidth of scrollbar "dgHScrollbar" of group 
"dgHorizontalComponents" of me

but all these scripts are in a button "data grid"

So I am trying to understand what "me" references.

  In order for there to be a scrollbar of a group of "me"  , "me" would 
have to refer to a card
or "bigger" parent group, or stack.

Did I get that right?

I am trying to understand how to reference controls "adjacent" to the 
child object of a parent behavior.

e.g. main stack/card 1/field "SymbolName"
       main stack/card 1/btn "Dog"  # with behavior set to the long id 
of button below:

substack ("behaviorVault")/button "showName # used as a behavior for btn 
(and other buttons on the same card)

Now, in the behavior button I want to refer to objects on the card with 
the child buttons
that use that behavior... so I'm trying to determine best practices.

When I click on a button on the main card, I want the name of the button
to pass to a field and the field to be shown, kind of like a tool tip of 

this button is in  a substack, but the child buttons and other field is 
on card 1 of the main stack
A simple reference fails...

on mouseUp
    put the loc of the target into tPosition
    put the shortname of the target into tName
    put tName # it works... I get "Dog"
    put tName into fld "symbolName" # fails
    set the loc of fld "SymbolName" to tPosition # fails; reference is 
not explicit enough
    show fld "symbolName" with visual effect dissolve # fails; reference 
is not explicit enough
    send "hideName" to me in 5 seconds
end mouseUp

on hideName
    hide fld "symbolName" with visual effect dissolve  # fails; 
reference is not explicit enough
end hideName

I guess I can set the defaultstack to the main stack but I just wanted 
to check if there is another way to establish the "card context" of the 
child objects, in the behavior script of those child objects.   It 
seemed from the data grid stack that "of me" would could work, but a fld 
on the same card is not a property of an adjacent button (whose behavior 
is on another stack/card)


Om Shanti

Kauai Aadheenam

More information about the Use-livecode mailing list