Accessing customised columns in a datagrid

Peter Haworth pete at mollysrevenge.com
Wed Mar 30 18:08:08 EDT 2011


Hi Trevor,
The snippet below is from a post you sent me about centering a checkbox in a column.  The other method you thought might work involving the lockloc property of the column group didn't work.

I found I could do this without defining a "cancas" as you had suggested.  I got it working with the following code in the LayoutControl handler:

put ((mycolumnwidth - mybuttonwidth) / 2) into myOffset  -- mycolumnwidth and mybuttonwidth hold the the width of the column and of the button
put item 1 of myColumnRect + myOffset + 5 into item 1 of myButtonRect  -- myColumnRect and myButtonRect hold the rectangles of the column and button
add myOffset to item 3 of myButtonRect
set the rect of button 1 of me to myButtonRect

When I first tried this, I did not have the "+5" in the second line of code - the checkbox moved to the right but it still wasn't centered.  The "+5" centered things OK.  Any ideas why I need that "+5"? 

Thanks  


Pete Haworth

-------------- next part --------------






http://www.mollysrevenge.com
http://www.sonicbids.com/MollysRevenge
http://www.myspace.com/mollysrevengeband








On Mar 28, 2011, at 6:03 PM, Trevor DeVore wrote:

> 2) If (1) doesn't work then add a "canvas" to your column. This can be a
> transparent button or a graphic and you size to fit the width of the column
> in LayoutControl. You then position the checkbox in the center of the canvas
> and it will appear centered.



More information about the use-livecode mailing list