PDA

View Full Version : Changing the color of a numbercontrol within charsheet_inventory from a script



bmos
June 21st, 2020, 20:37
PF1e 3.3.10

I've got a numbercontrol in the windowclass "charsheet_inventory" in record_char_inventory.xml that I want to change color based on the values in the field.
I have been using onValueChanged to do this, but it doesn't refresh the correct color when the value of the numbercontrol's bound databasenode is replaced by the same value that was there (I am using math.min to write the lower of two numbers to this databasenode).

See attached for a code sample.

EDIT: Of course, 30seconds after posting we found a workaround :D
Directly before the line that sets the value, I just had it set it to a bad/never accurate value and then to the correct value.

Moon Wizard
June 21st, 2020, 22:14
Yeah, in the few cases where I've had to do something similar (but force an update anyway), I've used that workaround as well. Good job figuring it out.

Regards,
JPG