Checkboxes in a scrolling field.

Bob Sneidar bobs at twft.com
Fri Aug 31 16:33:28 EDT 2012


Don't know if this would help, but in a Datagrid, any element of an array that does not have an entry in the dgprop["columns"] will be invisible. I use this to hold a checkbox value, and then I have a group of checkboxes the height of the datagrid with the spacing set to match the height of the rows. Obviously this only works for fixed height rows, although I suppose I could get fancy and try to get a list of the heights of each row if they were variable. 

I then have some handlers that display the checkbox value for each row as the user scrolls the datagrid. Also, when the user interacts with the checkboxes, I update the array value of the datagrid appropriately for the corresponding row. 

The dueling image idea looks intriguing too. 

Bob


On Aug 31, 2012, at 12:43 PM, Peter Haworth wrote:

> I've been thinking about doing this myself but haven't implemented it yet.
> Here's what I had planned to do, there are probably better ways.
> 
> 1) Get yourself two images, one of the unchecked check box, one of the
> checked version, call 'em "Unchecked" and "Checked".
> 2) When you're putting data into your field, set the imagesource of char x
> of line y of field "your field" to the ID of Image "Unchecked" (or
> "Checked" depedning on your requirements)
> 3) Use the following mousedown handler:
> 
> on mousedown
>   switch word 2 of the clickcharchunk
>      case the ID of Image "Unchecked"
>          set the imagesource of char x of line (the clickline) of field
> "your field" to the ID of image "Checked"
>          < do whatever else is needed when the box is checked>
>          break
>      case the ID of image "Checked"
>           set the imagesource of char x of line (the clickline) of field
> "your field" to the ID of image "Unhecked"
>           < do whatever else is needed when the box is unchecked>
>           break
>   end switch
> end mousedown
> 
> All totally untested but I think would work in principle.
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> 
> 
> 
> On Fri, Aug 31, 2012 at 11:54 AM, Charles Szasz <cszasz at mac.com> wrote:
> 
>> I know this has been done before but in previous cases discussion involved
>> two or more columns. My situation does not require multiple columns. Does
>> anybody have a good idea on how to implement checkboxes in a scrolling
>> field? Thanks for your time!
>> 
>> Charles Szasz
>> cszasz at mac.com
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list