In article <
1kp37sl.1myidovxtjybiN%pip...@disney.com>,
pip...@disney.com
(Jack) wrote:
> E. Appeldoorn <
ursus...@ziggo.nl> wrote:
>
> > make the checkbox-field be a value that accepts either 1 and 0
> > (don't make it 1 and empty as you suggested)
> >
> > Basic layout of script:
> >
> > display dialog [change or revert or something like that message]
> > if pressed Revert
> > set field [checkboxfield ; not (checkboxfield)]
> > end if
>
> clever
That is a neat way of changing an "on" / "off" checkbox field (called a
Boolean field in databases and programming languages that natively support
it).
Another neat method that someone else posted quite a while back is:
Set Field [Checkboxfield; ABS(Checkboxfield - 1)]
to swap between values of 0 and 1.
> > Personally I wouldn't use a scripttrigger for this. I would disable the
> > field and lay an invisible button on top of the field. This button would
> > then fire the scipt.
> > The value wouldn't change at all until the user gives the feedback to the
> > script. Which would be safer because nothing would happen if by accident the
> > script gets halted before the user made a choice.
> > (like shutting down filemaker, or the whole computer)
>
> yes, probably better this way.
That's the best way.
If you wanted to still use a Scripttrigger, then another (long-winded) way
could be to have a second Field called Checkboxfield_OLD that stores a
copy of the current allowed value. Then the pseudo-script would be
something like:
Display Message ["Do you want to change this value?"]
If [MessageChoice = "OK"]
Set Field [Checkboxfield; Not(Checkboxfield)]
Set Field [Checkboxfield_OLD; Checkboxfield]
Else
Set Field [Checkboxfield; Checkboxfield_OLD]
End If
If the user says "OK", then the changed value is copied into
Checkboxfield_OLD. If the user says "Cancel" then the previous value is
coped from Checkboxfield_OLD back into Checkboxfield.
Helpful Harry :o)