DataGrid Forms, checkboxes and Pull-Down buttons

Trevor DeVore lists at mangomultimedia.com
Thu Apr 1 08:23:02 CDT 2010


On Mar 31, 2010, at 11:08 PM, John Patten wrote:

> The problem is with my checkbox button. The script I used is:
>
> Checkbox Button Column Behavior-
> getProp dgDataControl
>   return the long id of me
> end dgDataControl
>
> on mouseDown pMouseBtnNum
>   dgMouseDown pMouseBtnNum
>   setDataOfIndex the dgHilitedIndexes of me, the dgColumn of the  
> target, (the hilited of target)
> end mouseDown
>
> There are two problems. The first is that when I look at the data in  
> the Data Grid after highlighting the checkbox, the data from the  
> datagrid reports that the hilite is 'false." If I uncheck the  
> checkbox, and grab the data again, the Data Grid reports that the  
> hilite is 'true." It is reversed from what is normal.

Use mouseUp rather than mouseDown. On mouseDown the hilite of the  
checkbox has not been updated yet.

> Second problem is that if I click in the column with the check box,  
> missing the button, I get an error stating that the (column) does  
> not have that property (assume it means the hilite property). I  
> attempted to put an:

Don't use 'the target', use 'of me'. When you click in the column but  
not on the checkbox then the target is not a button with a hilited  
property. Try this:

SetDataOfIndex the dgIndex of me, the dgColumn of me, the hilited of  
button 1 of me

If you just want to update the value when the checkbox itself is  
clicked on then check the target:

if word 1 of the target is "button" then
     SetDataOfIndex the dgIndex of me, the dgColumn of me, the hilite  
of button 1 of me
end if

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