Datagrids and Geometry

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Datagrids and Geometry

Post by xclntdesign » Tue Nov 06, 2012 4:41 pm

I have a created a Datagrid with the both scrollbars set to Auto. I have also assigned Geometry to this Datagrid, so that when the stack resizes, the datagrid resizes with it (attached to the right and bottom of the stack). When I make the width of the stack smaller, I do not get the horizontal scrollbar on my datagrid (because of the amount of data, the vertical scrollbar is always visible).

Did I miss something?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Datagrids and Geometry

Post by Mark » Thu Nov 08, 2012 11:08 pm

Hi,

Do you get the horizontal scrollbar if you resize the datagrid manually? Do the columns resize automatically when you resize the datagrid?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Re: Datagrids and Geometry

Post by xclntdesign » Fri Nov 09, 2012 3:33 pm

No and No. When I drag the right side handles in the IDE, I get no scrollbars and the columns do not resize.

I have a behavior assigned to this DataGrid. Could it be that a message isn't being passed, so it doesn't know what to do?

xclntdesign
Posts: 34
Joined: Sun Feb 06, 2011 8:33 pm

Re: Datagrids and Geometry

Post by xclntdesign » Fri Nov 09, 2012 4:31 pm

I was able to fix the scrollbar issue by making the initial column widths large enough to force the scrollbar to appear in the IDE.

How do I make the columns automatically resize?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Datagrids and Geometry

Post by Mark » Fri Nov 09, 2012 10:14 pm

Hi,

I asked if the columns resized automatically, because that would explain why there is no horizontal scroll bar. I don't if there is a way to do this automatically without a script, but if I understand the documentation correctly, you can use the layoutControl message to resize controls and columns.

Honestly, I don't use the datagrid, so you'd probably better refer to the datagrid documentation. Perhaps, you can do the following in a datagrid group script (provided that you have 3 columns):

Code: Select all

on resizeControl
   set the dgColumnWidth["Name"] of group "DataGrid" to the widht of grp "Data Grid" / 3
   pass resizeControl
end resizeControl
and probably this script in a field of your DG template:

Code: Select all

on layoutControl theRect
  set the rect of fld "My Only Field" to theRect
end layoutControl
This script would assume that the DG has 3 columns and in one of those columns 1 single field.

I hope this helps.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply