PDA

View Full Version : Dynamic Number of Checkboxes



bojjenclon
January 18th, 2020, 00:47
Been trying to puzzle this one out:
How do you go about making a horizontal series of checkboxes, where the amount rendered is equal to a variable set via a basicnumber element in the same window?

In other words, if I set the basicnumber field "Invokes" equal to "3," then I should see three checkboxes appear.

Using plain old CoreRPG as a base, although the extension is meant to "improve" (personal opinion of course) the Fate Core ruleset.

Trenloe
January 18th, 2020, 01:02
Couple of ways:

1) Have all of the check boxes defined (assuming you have a definite maximum) and then enable/disable the check boxes through code as the number control is updated. See the setEnabled API command: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#setEnabled
2) Dynamically build the checkboxes using the createControl API when the number control is updated - https://www.fantasygrounds.com/refdoc/windowinstance.xcp#createControl

I’d tend to go with #1 - unless you potentially have lots and lots and lots of check boxes to create.

Moon Wizard
January 18th, 2020, 01:11
Or you can look at the ammocounter template used in 3.5E and 5E rulesets that does something similar.

Regards,
JPG

Trenloe
January 18th, 2020, 01:14
Or you can look at the ammocounter template used in 3.5E and 5E rulesets that does something similar.
Oh yeah, I forgot about that. Good call! :)

bojjenclon
January 18th, 2020, 01:17
Thanks for the fast responses, guys! buttongroup_counter seems perfect for what I'm doing here. :)