Datagrids and Nested Behaviors

Richard Gaskin ambassador at fourthworld.com
Fri Jul 20 20:13:01 EDT 2018


Bob Sneidar wrote:

 >> On Jul 20, 2018, at 15:31 , Richard Gaskin wrote:
 >>
 >> IIRC Bernd's suggestion was for global scope only, yes?  That is, it
 >> swaps the positions of the two bottom scripts shown below, and
 >> affects all DGs running in the session.
 >
 > Actually no that is why I was saying the syntax was the complete
 > opposite of what you'd expect. Bernd's solution actually produces the
 > results you see in your diagram. The custom behavior is inserted
 > between the datagrid and the default behavior. Odd, huh?

Quite, because here's what I found in Bernd's post:

    set the behavior of the behavior of the behavior of group \
      "datagrid 1" to the long id of button "myButtonName"

<http://lists.runrev.com/pipermail/use-livecode/2018-July/248461.html>


This is a normal setup:

      [ DataGrid ]
            |
            V
[ Standard DG Behavior ]


The behavior of grp "DataGrid 1" is the standard LC-supplied DG script.

If we set the behavior of the LC-supplied DG script, we get the opposite 
of my diagram:

      [ DataGrid ]
            |
            V
[ Standard DG Behavior ]
            |
            V
    [ Custom Behavior ]


That would produce an overloading of global scope, since the Standard DG 
behavior drives all DGs, and adding a custom behavior to it would then 
also apply to all DGs.

For reference, here's the diagram I've been using to show the desired 
outcome of limited scope:

       [ DataGrid ]
            |
            V
    [ Custom Behavior ]
            |
            V
[ Standard DG Behavior ]


What am I missing?

Are we talking about the same thing, but I'm writing this where the 
message path flows down and you're missing the arrows and 
conceptualizing this as messages flowing up?

If not that, what is it I'm not seeing?

---

On further consideration, there's something even odder in my 
understanding of Bernd's script.  Let me rewrite it with line breaks for 
clarity:

command:    set the behavior \
obj3:          of the behavior \
obj2:          of the behavior \
obj1:          of group "datagrid 1" \
value:            to the long id of button "myButtonName"

That's a three-deep nesting where AFAIK there are only two objects.

A group named "DataGrid 1" is obj1 there.

It's original behavior is the LC-supplied "Standard DG Behavior" - 
that's obj2.

What is obj3, the object assigned as the behavior to the "Standard DG 
Behavior"?

Can't decide if I've had too much coffee here or too little. :)

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the Use-livecode mailing list