Richard, I've been pounding the pulpit on this one for some time. Besides the default datagrid behavior, I have a whole library of handlers that I use for my datagrids that I need to access. To do this, I need my library to be inserted *between* the datagrid and the default behavior. This is not presently possible without a bit of magic someone sent to me.
The fix is simple and elegant and has worked for me since I started using it. In behaviorsdatagridbuttonbehavior.livecodescript I replaced the private function _resourceStack handler with an updated one: -- Sly Labs! Inline Custom Behaviors /* private function _ResourceStack local theStack, theCharNo put the behavior of me into theStack if theStack is not empty then put offset(" of stack", theStack) into theCharNo delete char 1 to (theCharNo + 3) of theStack end if return theStack end _ResourceStack */ local sResourceStack private function _ResourceStack local theStack, theCharNo if sResourceStack is empty then put the behavior of me into theStack repeat if trueWord -1 of theStack is "revDataGridLibrary" or theStack is empty then exit repeat else put the behavior of theStack into theStack end if end repeat if theStack is not empty then put offset(" of stack", theStack) into theCharNo delete char 1 to (theCharNo + 3) of theStack end if put theStack into sResourceStack end if return sResourceStack end _ResourceStack -- END Sly Labs! Inline Custom Behaviors If I then set the behavior of the datagrid to my custom behavior, then set that behavior to the default datagrid behavior, then I have nested datagrid behaviors. (I think it's a bit more complex but that is the idea.) What's the advantage you say? Well for instance I have a selectionChanged hander that I use for all my datagrids, preventing me from having to code it in every datagrid in my app, which is quite a few. That selectionChanged handler accomodates a FindBar object so if I am searching for a data record in a database, selecting the found record in the datagrid will reload all the other associated data. Also in that behavior I have a standard method for querying data for the datagrids, a standard method for populating fields, buttons and menus on the card the datagrid is on, and a mouseDoubleUp handler so that when a user double clicks on a datagrid row I can process it. These use custom properties I set for each datagrid so that things like the table to query, the primary key, the field to focus on when done etc. are accessible to the particular datagrid. As a result, all I have to do now to create a new datagrid is copy/paste an existing one, name it, change a few custom properties, and set the column names, and away it goes. I suppose what would be needed to support this in the release versions of LC is a way to easily "insert" a behavior "before" or "after" the default behavior. Bob S > On Apr 28, 2022, at 12:57 , Richard Gaskin via use-livecode > <use-livecode@lists.runrev.com> wrote: > > Mike Kerner wrote: > > > * This wasn't discussed, but there is supposed to be some > > fixing coming in dp's of 10 for behaviors, especially > > nested behaviors > > I missed a bug report: what are the issues with nested behaviors? > > > > * Still nothing on dealing with the way groups are handled. > > What aspects of group handling, and how should they be different? > > -- > Richard Gaskin > Fourth World Systems > Software Design and Development for the Desktop, Mobile, and the Web _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode