Ignition Perspective
8.1.1 (b2020120808)
Checkbox firing ‘onClick’ script, twice…
I ran into this problem and to confirm I made a simple perspective view with 1 Checkbox and 1 Label which has the same behavior.
I set the label’s prop.text = 1
I then added an onClick script to the Checkbox
if self.props.selected:
self.getSibling("Label").props.text += self.getSibling("Label").props.text
system.perspective.print("select")
else:
self.getSibling("Label").props.text -= self.getSibling("Label").props.text
system.perspective.print("de-select")
When I click on the checkbox to set props.selected = True
the labels text changes to 4! Which means it did 1+1=2 and then fired again to do 2+2=4.
If I click the Checkbox again the label’s text changes to 0.
This is what the console reads when clicking the checkbox once to select it and a second time to de-select it
13:23:35.988 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - select
13:23:35.989 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - select
13:23:37.138 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - de-select
13:23:37.138 [Browser Thread: 57052] INFO Perspective.Designer.Workspace - de-select
I can’t figure out why it is firing twice. I don’t recall this issue occurring in an early version of 8.0. I’m digging up an old project and an existing view, that I believe was working previously, now seems to fire twice causing an issue.
Thanks