Copy link to clipboard
Copied
É possivel criar um formulário onde eu possa atribuir uma área que mude de cor ao clicar?
Séria possivel ter uma lista de cores que eu possa escolher para aplicar naquela área?
Copy link to clipboard
Copied
É possivel criar um formulário onde eu possa atribuir uma área que mude de cor ao clicar?
Séria possivel ter uma lista de cores que eu possa escolher para aplicar naquela área?
Copy link to clipboard
Copied
Sure, you can do that with a button field. Do you mean that you want it to change from one color to another each time you click it, like a "traffic light" (red to yellow to green to red, etc.)?
Copy link to clipboard
Copied
Yes, that's right. How can I do that?
I looked for tutorials on the Internet but I couldn't find them.
Copy link to clipboard
Copied
Sure, here's an example. Create a button with a red (RGB 1,0,0) fill color and then set the following as its MouseUp JavaScript code:
var colors = [color.red, color.yellow, color.green];
for (var i=0; i<colors.length; i++) {
if (color.equal(event.target.fillColor, colors[i])) {
event.target.fillColor = (i==colors.length-1) ? colors[0] : colors[i+1];
break;
}
}
Each time you click it it will switch to the next color in the colors array, which can be as long as you wish.