Page 1 of 1

Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 2:23 pm
by ZoOoOoP
Hello, there is a solution to add a behavior to a datagrid group ?

(no column behavior, or header behavior, but a general behavior like all other groups/buttons/etc...)

Thank you =)

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 2:48 pm
by Klaus
Hi ZoOoOop,

welcome to the forum!

Sure this is possible, you can assign a behavior to every LC object.
If it will make sense is another question. A datagrid is a complex beast! :-)

Best

Klaus

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 3:31 pm
by ZoOoOoP
Thank you for answer but for example in any "normal group" i have it but not in "datagrid group" (see attachments)

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 3:44 pm
by Klaus
Ah, OK, obviously not via the inspector, but works fine via message box:

Code: Select all

set the behavior of grp 1 to the long ID of btn 1
Tested and works! :D
Will however completely overwrite the "normal" datagrid behavior!

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 3:57 pm
by Klaus
But we can use nested behaviors with the datagrid, check a demo on Github:
https://github.com/bwmilby/lc-misc
Hope that helps.

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 5:22 pm
by ZoOoOoP
Klaus wrote:
Sun Feb 27, 2022 3:44 pm
Ah, OK, obviously not via the inspector, but works fine via message box:

Code: Select all

set the behavior of grp 1 to the long ID of btn 1
Tested and works! :D
Will however completely overwrite the "normal" datagrid behavior!
I succeed to change behavior like this OK, but :

On my data grid -> "put the behavior of group "DG_MYGRID" -> button id 1005 of stack "revDataGridLibrary"

put the behavior of button id 1005 of stack "revDataGridLibrary" -> stack "RevDataGridLibraryBehaviorsDataGridButtonBehavior"

Even if i add ["button id 1005 of stack "revDataGridLibrary"] or [stack "RevDataGridLibraryBehaviorsDataGridButtonBehavior"] in my new empty button behavior, the data grid don't work yet...

I will go to see your link now.
(edit : it's exactly that i try to do, i will debug with that to see where i'm wrong)

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 5:42 pm
by ZoOoOoP
Klaus wrote:
Sun Feb 27, 2022 3:57 pm
But we can use nested behaviors with the datagrid, check a demo on Github:
Hope that helps.
Thank you for help all is working now =)

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 6:17 pm
by Klaus
Great!

May I ask what special behavior you added to your datagrid?

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 6:47 pm
by stam
Actually that’s interesting.
I have a bunch of data grids with semi-translucent scroll bars that hide with a swift transition when the scrolling stops, and reappear and can be dragged when the scrolling starts.

I’ve had to put that code within each individual DG as you can’t really subclass stuff, would be a lot handier if this could be set as a behaviour… will definitely look into this!

Re: Add a behavior to a datagrid group ?

Posted: Sun Feb 27, 2022 8:20 pm
by ZoOoOoP
Klaus wrote:
Sun Feb 27, 2022 6:17 pm
Great!

May I ask what special behavior you added to your datagrid?
I just realize it was the opened in memory "NestedDGBehavior" who make it works :D