(Data Grid) How to get the setting of the dgHeaderAlignment["column"] saved

Trevor DeVore lists at mangomultimedia.com
Fri Jan 8 16:17:38 EST 2010


On Jan 7, 2010, at 10:09 AM, Andre.Bisseret wrote:

> I have a data grid "DataGrid" defined with the Inspector. The  
> columns' headers are aligned to left.
>
> In order to get the columns headers centered I do the following :
> ------
>  put the dgProp["columns"] of group "DataGrid" into theColumns
>  repeat for each line enil in theColumns
>     set the dgHeaderAlignment[enil] of grp "DataGrid" of this cd to  
> center
>  end repeat
> -------
> Ok, that works well.
>
> I save the stack
> If I close the stack and reopen it, the headers are still centered.
>
> But if I quit Rev, when I reopen the stack, the headers are aligned  
> to left again.
>
> What am I missing?

It's a bug. The Data Grid isn't setting alignment when creating the  
headers from scratch.

You can either set the alignment each time your program opens or add a  
1 line fix to the Data Grid behavior script. Instructions follow.

======
1) Open Script
======

edit script of btn "Data Grid" of stack "revdatagridlibrary"

======
2) Locate _table.CreateHeaders command
======


======
3) Add line to _table.CreateHeaders command
======


             set the dgTooltip of theGroup to theColsA[theColumn] 
["tooltip"]
             set the dgHilite of theGroup to theColumn is  
sortByThisColumn
             #####
             ## ADD FOLLOWING LINE
            #####
             set the dgAlignment of theGroup to theColsA[theColumn] 
["header"]["alignment"]
             lock messages
         end if
     end repeat
end _table.CreateHeaders

======
4) save revDataGridLibrary stack
======

In message box execute:

save stack "revDataGridLibrary"


-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com



More information about the use-livecode mailing list