Checkbox/field related question

Lynch, Jonathan BNZ2 at CDC.GOV
Tue Mar 1 15:53:02 EST 2005


"Me" refers to the object in which the handler is running. It is useful,
because often times you will have a script that needs to work in a
number of different fields (like a spellcheck script). If you had to
change each script to refer to the name of the object itself, it would
get cumbersome.

For example, suppose you had 50 fields named "List Field 1", "List Field
2", etc... if you used "me" in your script rather than "field "List
Items"", you could just copy the script into each field. (actually, you
can do it even easier by calling the script, but that is another issue)

Another suggestion - the script as you have it written here only works
if the character with the image source is on character 1 of line
currentline - this limitation is not necessary:

On mouseup
   put word 2 of mousecharchunk() into aaa
    if the imageSource of character aaa of me is "Checkbox Empty" then 
      set the imageSource of character aaa of me to "Checkbox Filled"
    else if the imageSource of character aaa of me is "Checkbox Filled"
then 
	set the imageSource of character aaa of me to "Checkbox Empty"
    end if
end mouseup


If the phrase "word 2 of the mousecharchunk()" is confusing, the docs
explain it pretty well. For this purpose, mousecharchunk() returns a
phrase containing the starting and ending characters. Word 2 of that
phrase will be the character you just clicked on.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Silver,
Jason
Sent: Tuesday, March 01, 2005 3:33 PM
To: How to use Revolution
Subject: RE: Checkbox/field related question

Hi Jonathan,

Thanks for your script!  I think I see where you're going with it
(though the second line is still a little confusing; I'm still grasping
when to use "me" and/or "target").  

What I'm doing instead is using graphics for checkboxes.  So, in my if
statement, I'm checking as follows:

  if the imageSource of char 1 of line currentLine of field "List Items"
is "Checkbox Empty"  then
    set the imageSource of char 1 of line currentLine of field "List
Items" to "Checkbox Filled"
  else if the imageSource of char 1 of line currentLine of field "List
Items" is "Checkbox Filled" then
	set the imageSource of char 1 of line currentLine of field "List
Items" to "Checkbox Empty"
  end if

I wasn't able to think of this solution before looking at your script.
Thank you for shedding light; this list always does!

-Jason

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Lynch,
Jonathan
Sent: Tuesday, March 01, 2005 12:05 PM
To: How to use Revolution
Subject: RE: Checkbox/field related question

I am chiming in late on this - so I might be confused...

But if you are looking to have a checkbox in a field that switches back
and forth when checked - I have a field that does this. The following
script goes in the field:

On mouseup
   put word 2 of mousecharchunk() into aaa
    put character aaa of me into B
    if chartonum(B) = 254 then 
      put numtochar(168) into character aaa of me
      set the textfont of character aaa of me to "wingdings"
      set the textsize of character aaa of me to 16
    else if chartonum(B) = 168 then 
      put numtochar(254) into character aaa of me
      set the textfont of character aaa of me to "wingdings"
      set the textsize of character aaa of me to 16
    end if
end mouseup

just make sure the field has the checkbox character in it to start out
with: *

I know - that probably looks like a bullet point - but if you change
it's font to wingdings, it will look like a checkbox.

If this is covering old ground for you, my apologies.

----



_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list