Resizable DataGrid Question

Pete pete at mollysrevenge.com
Wed Oct 19 16:21:45 CDT 2011


I think you need to get the dgindex of the dgcontrol of me?
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Wed, Oct 19, 2011 at 1:56 PM, Mike Doub <Mike at doub.com> wrote:

> I believe that I have found a way to get the previous grid item, but I must
> have the syntax incorrect for getting the dgIndex of me.   Nothing is being
> returned.  Can any DataGrid experts give me any guidance?
>
> Thanks
>   Mike
>
>
> on FillInData pDataArray
>   set the text of field "Name" of me to pDataArray["LastName"] & \
>         comma & space & pDataArray["FirstName"] & space &
> pDataArray["MiddleName"]
>   put char 1 of fld "Name" of me into field "spacerLable" of me
>   put the dgControl of me into theGrid
>   put the dgIndex of me into tIndex
> -- get the index of the current grid item
>   put the dgIndexes of me into tList
> -- get list of grid indexes in display order
>
>   put itemoffset(tIndex,tList) into toff
> --find the current index in the ordered list
>   put item (toff -1) of tList into tpreIndex
> -- get the index of the previous grid item
>   if tpreIndex = 0 then
>
>      set the visiable of group "spacer" of me to true
> -- we are the first grid item, so show the spacer
>   else
>      put the dgDataOfIndex[tpreIndex] of me into preData         -- get the
> data for the previous grid item
>      if char 1 of preData["LastName"] = field "spacerLable" of me then
>         set the visiable of group "spacer" of me to false
> -- no difference yet
>      else
>         set the visiable of group "spacer" of me to true
> -- we found a difference
>      end if
>   end if
> end FillInData
>
>
> -----Original Message-----
> From: use-livecode-bounces at lists.runrev.com
> [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Pete
> Sent: Tuesday, October 18, 2011 3:29 PM
> To: How to use LiveCode
> Subject: Re: Resizable DataGrid Question
>
> The selectionchanged message sent to the datagrid includes the index of the
> current and previous selected datagrid rows as parameters.  I'm not sure if
> that will help though, since this happens outside of the custom behavior
> where the LayoutControl handler sits.
>
> Another way might be to store the index/line number of the row in a custom
> property of the datagrid and get it back when you need it (and before
> overwriting it with the current index/line of course!)
>
> Have you considered doing this in the source data by inserting an extra row
> with some sort of indication that it represents a sort break?
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> On Tue, Oct 18, 2011 at 10:46 AM, Mike Doub <Mike at doub.com> wrote:
>
> > I am trying to use a DataGrid to create a contact list that has a spacer
> > between each alphabetic grouping of names.   I was thinking to use the
> > non-fixed length attribute of the DataGrid and adjust the size
> > dynamically in the LayoutControl handler as well as showing a field that
> would contain
> > the spacer.   I am unclear how to determine the contents of the previous
> > grid element from within the current handler to know when expand the grid
> > for the spacer.   I also need to understand how to figure out if this is
> > the
> > first grid element.
> >
> >
> >
> > Does anyone have any examples of how this might be accomplished?
> >
> >
> >
> > Thanks
> >
> >    Mike
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


More information about the use-livecode mailing list