Page 1 of 1

Detect Column Resize In DataGrid

Posted: Thu Aug 11, 2011 4:57 am
by dickey
Hello all,

I have coded my own filters for the DataGrid object.

I have a field that performs a type ahead search across all the columns of the DataGrid (background/irrelevant), and a collection of fields sitting above the header fields of the grid which perform a cumulative type ahead search upon the column to which they relate (relevant).

I was wondering,

+ in the first instance whether each field could inherit the width property from the corresponding column in the DataGrid, and if that were not possible;

+ in the second instance whether upon column resize in the DataGrid a message fires which I could customise to resize my filter fields to maintain a coherent width/alignment. I couldn't spot what I needed in the API, but I imagined a handler something like: on ResizeDataGridColumn pColumn -- I could then grab the column width and column margins for pColumn and apply them to my filter fields (or use get the dgFormattedWidth of group "xyz").

Using a similar technique I could then maintain the width/alignment of my column totals at the base of the DataGrid.

Any assistance greatly appreciated. Kind regards, Andrew

Re: Detect Column Resize In DataGrid

Posted: Sun Aug 14, 2011 12:30 am
by dickey
zryip theSlug was so kind as to email me the following solution via the LiveCode Developer List:
Hi Andrew,

You can use the dgColumnWidth property of the datagrid on the datagrid
group script to get the size of a column being resized..

setprop dgColumnWidth [pColumn] pValue
put pColumn & "Filter" into tColumnFilterField
put pColumn & "Sum" into tColumnSumField
changeRectOfField tColumnFilterField, pValue
changeRectOfField tColumnSumField, pValue

pass dgColumnWidth
end dgColumnWidth

Where:
- pColumn is the column name
- pValue is the column width
My thanks to zryip for his response.

Kind regards, Andrew