Page 1 of 1

Where is the detailed doco for LiveCode datagrid?

Posted: Mon Aug 08, 2011 12:05 am
by BarrySumpter
I just finished my research on the basic table field.
I had deduced that the basic table field was so "very basic" that it didnt' get a mention in the dictionary.

I was suprised to find that the DataGrid isn't mentioned in the dictionary either.

However, I did find a excellent start on the datagrid here:

LiveCode | User Samples | Data Grids Tour

and here as well:

7343-Data-Grid-Properties
http://lessons.runrev.com/spaces/lesson ... Properties

----

The very first scipt has to do with the datagrid property of "header text style":

Code: Select all

set the dgProps["header text style"] of group "DataGrid1" to "normal"
Is there any detailed doco on the other settings for "header text style" property of the DataGrid?
i.e. "not-normal", "super-normal", etc.

Along with detailed doco on other properties for the DataGrid?

Is there a way to enumerate the possible values in "header text style" property of the DataGrid
using the Message Box as with other objects?

Re: Where is the detailed doco for LiveCode datagrid?

Posted: Mon Aug 08, 2011 12:23 am
by SparkOut
http://lessons.runrev.com/spaces/lesson ... s/datagrid is the root for a wealth of information about the datagrid. Also on the right hand pane you will see the link to download the datagrid pdf manual.

Re: Where is the detailed doco for LiveCode datagrid?

Posted: Mon Aug 08, 2011 12:27 am
by BarrySumpter
Wow! That should keep me busy for about a month.

I'll have to see if there is any detailed doco to the "Header text style" property.

Many thanks

Re: Where is the detailed doco for LiveCode datagrid?

Posted: Mon Aug 08, 2011 12:28 pm
by Klaus
DocO? 8)

Re: Where is the detailed doco for LiveCode datagrid?

Posted: Tue Aug 09, 2011 12:54 am
by BarrySumpter
Just a first effort quick n dirty DataGrid project I'll be using as a quick start cheat sheet.

Create a new mainstack
add a datagrid control
and rename the datagrid control to DataGrid2
Mostly just a practical use quick start - with a couple o gotchas.

I kinda like it when I add data with no headers the headers are built for me.

Still enjoying researching the DataGrid.

DataGrid AutoSize Column Widths

Posted: Tue Aug 09, 2011 1:50 am
by BarrySumpter
DataGrid AutoSize Column Widths
http://forums.runrev.com/phpBB2/viewtop ... 773#p41773

Now we're talkin!

Very cool!

Code: Select all

Command dgAutoSizeColumnWidth
   
   local theColWidthsA ## when all done has a key for each column name. Value of key is max width.
   
   put the dgData of group DataGrid2 into theDataA
   put the dgIndexes of group DataGrid2 into theIndexes
   put the dgProps["columns"] of group DataGrid2 into theColumns
   
   ## Loop through all records
   repeat for each item theIndex in theIndexes
      ## Loop through each column of record
      repeat for each line theColumn in theColumns
         ## Figure out width of this record's column
         set the text of field "FigureOutWidth" to theDataA[theIndex][theColumn]
         put max(the formattedwidth of field "FigureOutWidth", theColWidthsA[theColumn]) into theColWidthsA[theColumn]
      end repeat
   end repeat
   
   ## Reset field
   set the text of field "FigureOutWidth" to empty
   
   ## Set column widths
   repeat for each line theColumn in theColumns
      put theColWidthsA[theColumn] & comma after theWidths
   end repeat
   
   delete the last char of theWidths
   set the dgProps["column widths"] of group DataGrid2 to theWidths
   
   ## output max widths for testing purposes
   repeat for each line theColumn in theColumns
      put "max width for column" && theColumn & ":" && theColWidthsA[theColumn] & cr after theText
   end repeat
   
    put theText  -- into IT
    
end dgAutoSizeColumnWidth
  

Re: Where is the detailed doco for LiveCode datagrid?

Posted: Sun Jan 29, 2012 9:26 pm
by davidedynamicsGA45ff
Thanks Barry, for the scripts.
cheers David