Checkbox script

Mike Bonner bonnmike at gmail.com
Sat Jun 19 12:41:31 EDT 2010


A couple things, filter (if I recall correctly) filters lines not
words or chunks, so if all of your disability items are on the same
line it either will, or will not remove the whole line depending on if
there is a match.

Also as stated, if you're using a variable as your storage for the
data, its the variable that must be adjusted when a box is unchecked.

The easiest way by far was the other script posted that set all your
checkboxes up in a group with a group script that cycles through each
box and builds the list afresh each click or unclick.

If you wish to use the global method, the global will need to be
filtered and then put into the field, but rather than filter, you
should check out replace, and/or replacetext.  That way you can
replace whatever item you're removing  with empty. If you go with this
method you should also do a "replace space & space with space in
tConcat after you remove an item so that as you pop text out of the
string, it doesn't built up instances of duplicate spaces.  Meaning,
the replace will replace the exact text you wish, but will leave any
pre or post spaces.

Your update just came in, and you are pretty much doing as I was
suggesting.  The only thing is, you should replace with "empty" rather
than "space" as I mentioned or you'll end up with a whole bunch of
extra spaces in the field at some point. And also do the "replace
space & space with space" thing so that you don't end up with double
spaces.

On Sat, Jun 19, 2010 at 10:27 AM, wayne durden <wdurden at gmail.com> wrote:
> Hi Charles,
>
> There is a little disconnect because you have two "stores" for your data,
> your tConcat variable and your field.  When you uncheck you are removing the
> data from the field and then your tConcat global and your field are out of
> congruence.  There are several workarounds but the easiest one may be that
> after removing data from the field, simply set your global tConcat to the
> contents of the field.  Alternatively on the check portion you could filter
> the value out of the global and then add it to keep from getting duplicates
> therein...
>
> Wayne
>
> On Sat, Jun 19, 2010 at 11:05 AM, charles61 <cszasz at mac.com> wrote:
>
>>
>> Andre and Wayne,
>>
>> I tried declaring tConcat as a global. It works but each time you check and
>> uncheck and then check the same checkbox, you get multiple instances of the
>> same content. In other words, using checka as an example, I get Egg Allergy
>> added each I check and uncheck the checkbox.
>>
>> Charles Szasz
>> cszasz at mac.com
>>
>>
>>
>>
>> On Jun 19, 2010, at 10:51 AM, Andre.Bisseret [via Runtime Revolution]
>> wrote:
>>
>> > Bonjour Charles,
>> > As suggested by Wayne if you declare tConcat as global in each script
>> > then it works as expected
>> >
>> > Best
>> >
>> > André
>> >
>> > Le 19 juin 10 à 15:18, charles61 a écrit :
>> >
>> > >
>> > > I have a series of ten checkboxes. I am trying to script them so
>> > > that when
>> > > checkboxes are checked, names are put into variables and then put
>> > > into a
>> > > field "disability". I tried the following script using just two
>> > > checkboxes,
>> > > checka, checkb, to test my script:
>> > >
>> > > Checka Script:
>> > > on mouseUp
>> > global tConcat,
>> > -----------------
>> >
>> > >   if the hilite of me =true
>> > >   then
>> > >      put "Egg Allergy" & space after tConcat
>> > >      put tConcat into field "disability"
>> > >   else
>> > >      filter field "disability" without "*Egg Allergy*"
>> > >   end if
>> > > end mouseUp
>> > >
>> > > Checkb Script:
>> > > on mouseUp
>> > global tConcat,
>> > ------------------
>> >
>> > >   if the hilite of me =true
>> > >   then
>> > >      put "Fish Allergy" & space after tConcat
>> > >      put tConcat into field "disability"
>> > >   else
>> > >      filter field "disability" without "*Fish Allergy*"
>> > >   end if
>> > > end mouseUp
>> > >
>> > > Unfortunately, this script does not put "Egg Allergy" followed by
>> > > "Fish
>> > > Allergy" into field "disability" when both checkboxes are checked.
>> > > Instead,
>> > > only "Egg Allergy" or "Fish Allergy" are inserted into the field.
>> > > According
>> > > to the Rev documentation, this should work. Does anyone have a
>> > > suggestion
>> > > how I can get I both of these variables into the field?
>> > >
>> > >
>> > > --
>> > > View this message in context:
>> http://runtime-revolution.278305.n4.nabble.com/Checkbox-script-tp2261136p2261136.html
>> > > Sent from the Revolution - User mailing list archive at Nabble.com.
>> > > _______________________________________________
>> > > use-revolution mailing list
>> > > [hidden email]
>> > > Please visit this url to subscribe, unsubscribe and manage your
>> > > subscription preferences:
>> > > http://lists.runrev.com/mailman/listinfo/use-revolution
>> >
>> >
>> >
>> > _______________________________________________
>> > use-revolution mailing list
>> > [hidden email]
>> > Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> > http://lists.runrev.com/mailman/listinfo/use-revolution
>> >
>> >
>> > View message @
>> http://runtime-revolution.278305.n4.nabble.com/Checkbox-script-tp2261136p2261194.html
>> > To unsubscribe from Checkbox script, click here.
>> >
>>
>>
>> --
>> View this message in context:
>> http://runtime-revolution.278305.n4.nabble.com/Checkbox-script-tp2261136p2261206.html
>> Sent from the Revolution - User mailing list archive at Nabble.com.
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list