List to checkboxes how to?
J. Landman Gay
jacque at hyperactivesw.com
Sat Sep 13 12:24:15 EDT 2008
Michael wrote:
> I thought I might be able to simply specify that the field is a "checkbox
> field", or is a button with contents that displays as checkboxes, but that
> doesn't seem to be the case. I can't find an example of this basic scenario
> in the manual. Is there a resource I can access for how to use checkboxes in
> this manner?
One method I've used successfully is to use "imagesource" in the field.
Put the items you want to display into in a list field as usual. Then
insert a known character as the first one in each line (I often use a
space for this.) On the card somewhere, store 2 small hidden images. One
is an image of a checkbox in its checked state, and the other is an
image of an unchecked checkbox.
Whenever you want to set the state of the checkbox, do this:
set the imagesource of char 1 of line <line number> of fld "list" to
<imgID>
The "imgID" variable is the ID of the correct image, "checked" or
"unchecked". Your scripts can determine whether the line is checked or
not by simply reading the imagesource of the first character of the
line, which will be the ID of the appropriate image.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list