[Datagrid] How to remove a column behavior? Bug or not?

Andre.Bisseret Andre.Bisseret at inria.fr
Sun Apr 25 14:09:18 EDT 2010


Le 25 avr. 10 à 14:30, zryip theSlug a écrit :

> Dear List,
>
> How can I remove a column behavior in a datagrid?
>
> I thought to remove the column itself and recreate it with the same
> name, but it seems that when a column with a behavior is deleted, the
> behavior still stored somewhere in the datagrid. So when you create a
> new column with the same name than the freshly deleted column, the
> column is automatically attached to the old behavior.
>
> It's pretty odd. Is it a bug or what I'm doing wrong?
>
> And I confirm the posts, if I remember correctly, of Sarah and André
> concerning datagrid columns with no name...
> I was so enthusiast to test how delete my column behavior, that I have
> progressively deleted the name of my column letter by letter, until
> there is no letter to delete...
> What a pity...
>
> Because I have to remove the datagrid, I bet it could solved all my
> problems with behavior ghosts. A radical solution, but The Slug never
> does things by halves! 8-)
>
> Thanks for any help.

I already noticed this "phenomena" on the wole datagrid:

1 - set the dgProp[columns] of a data grid to a list of cr delimited  
names >> the columns are created
2 - populate the data grid

Then
3 -set the dgProp[columns] to empty >> no columns defined anymore
But the dgText is not emptied ("ghostified" ;-))i
4 - setting again the dgProp[columns] with the same names trigger the  
re-apparition of the dgText

So, for the whole datagrid, after eliminating the columns it remains  
necessary to also set the content to empty
So it is the same for one only column
I don't know if it's possible to delete straightforwardly the text of  
one only column?

I tried the tortuous following script; seems working:

Assuming that the third column header is "age"; want to delete the  
column and recreate it but empty (might be with another content)
on mouseUp
    local tCols,tData
    --------
    put the dgProp["columns"] of grp "dataGrid 1" into tCols
    put the dgText of grp "datagrid 1" into tData
    ---
    delete line 3 of tCols -- delete column 3
    set the dgProp["columns"] of grp "dataGrid 1" to tCols
    set the itemDel to tab
    ## empty text of column 3
    repeat with x = 1 to the number of lines in tData ## killing the  
ghost ;-)
       put empty into item 3 of line x of tData
    end repeat
    wait 3 sec ## just to see the result ;-))
    ## now reinstalling the previous column 3
    put the dgProp["columns"] of grp "dataGrid 1" into tCols
    put cr & "age" after line 2 of tCols
    set the dgProp["columns"] of grp "dataGrid 1" to tCols
    set the dgText of grp "dataGrid 1" to tData
end mouseUp --- OUF! ;-))

Best regards from Grenoble

André






More information about the use-livecode mailing list