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

Andre.Bisseret Andre.Bisseret at inria.fr
Sat Jan 9 09:28:45 EST 2010


Le 8 janv. 10 à 22:17, Trevor DeVore a écrit :

> 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.

Thanks Trevor for your answer and the precisely explained procedure to  
add the line to the _tableCreateHeaders command.

But, when I do so, I get a new issue : after quitting Rev, when I  
launch my stack again, the headers of the columns, not only are not  
centered anymore but also some of them are even so shifted to the  
left, that  one can't see the first characters of them; bizarre ;-)

More precisely : could be useful to say that the data grid is on a  
substack;
Even without quitting Rev :
- if I close the substack and re-open it the headers keeps centered
- If I close the substack AND its main stack, then, when I re-open  
them, I get the headers shifted to the left.

Not a big problem anyway (I can set the alignment each time a card  
opens as you suggest); but I am curious about what is happening ;-))

It was the first time I had a look at your scripts in the  
revdatagridlibrary; very impressive; "chapeau bas" ;-))

Best regards from Grenoble
André

>
> ======
> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution






More information about the use-livecode mailing list