Skip to main content
ThermoFisherScientific
Participant
July 20, 2016
Answered

Toggle click a box to turn it black/white

  • July 20, 2016
  • 1 reply
  • 587 views

I need a checkbox of sorts, but it doesn't link to anything - all clicking it does is turn the box (rectangular) black, then click it again and it goes white again. 

For the life of me I can't figure out how to do this.  If anyone could help me I'd really appreciate it.

Using Acrobat Pro XI on Windows.

Thank you!

This topic has been closed for replies.
Correct answer try67

Use a button field, with this code as its MouseUp script (set its fill color to white manually first):

if (color.equal(event.target.fillColor, color.black)) {

    event.target.fillColor = color.white;
} else event.target.fillColor = color.black;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 20, 2016

Use a button field, with this code as its MouseUp script (set its fill color to white manually first):

if (color.equal(event.target.fillColor, color.black)) {

    event.target.fillColor = color.white;
} else event.target.fillColor = color.black;

ThermoFisherScientific
Participant
July 20, 2016

Thank you - that works!  Now I have to get better at sizing the box - I have a lot of these to put on the form and all the boxes are the same size.  Right now I can't seem to get it exactly right so that it's not covering part of the box frame or leaving too much space between the frame and the button.  Any advice there?

ThermoFisherScientific
Participant
July 20, 2016

here's an example, you can see the box I have the button in, the borders are not perfect.