[Datagrid] How to : skip rows appearing, without deleting them in dgData?

zryip theSlug zryip.theslug at gmail.com
Sun May 23 09:50:20 EDT 2010


2010/5/23 Robert Mann <rman at free.fr>

>
> The point is to be able to navigate through a data-tree structure.
>
> Datagrid doc and runrev "how to's" show how to implement a foldable row,
> that can show more or less information but from the same row.
>
> To navigate within a data tree structure, there is a need to by-pass the
> drawing of some lines (not wanted children rows, or not wanted father
> rows).
>
> Within the layout script of a row, I tried to set the rect row to
> "0,0,0,0".
> This works fine... the line/row disappears. But then... when you navigate
> with the arrow in the datagrid, the selected line disappers, while it
> hilites the unvisible row... forcing the user to press again the navigation
> arrow at that point. So : no good!
>
> Is there a more radical and more efficient way to skip lines without
> deleting them from the dgData ?


Hi Robert,

Assuming you know the lines of the displayed child lines, a possible way
consists to add in your Data Grid object, the arrowKey handler and move the
selected line to the next or previous visible child line.

on arrowKey pTheKey

*   put* the dgIndexOfLine[the dgHilitedLines of me] of me into tTheIndex

   *put* the dgDataOfIndex[tTheIndex] of me into theDataA

   *put* theDataA["child visible"] into tChildState

   *if (*tChildState) *then*

      *pass* arrowkey

   *else*

*   if (pTheKey is "up") then*

      *set* the dgHilitedLine of me to previousVisibleChildNo

   else if (pTheKey is "down") then

*       set* the dgHilitedLine of me to nextVisibleChildNo

   else

       pass arrowkey

   *end* *if*

*end arrowKey*
*
*

Personally to build the Data Grid Helper palette, I'm using that you call
the radical way. I find this way efficient for my needs.
I'm using another Data Grid as a data base to fill dynamically the tree of
my second datagrids.


Regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc



More information about the use-livecode mailing list