I need to have a ‘Are you sure’ pop up on numeric text field before the operator can actually enter values. I know it could be done by system.gui.confirm, but could someone please help me with the correct script for it?
Also what will happen if the operator chooses no ? will the pop up disappear and go back to the numeric text field for the operator to click on it again?
In that example code they are using system.db.runupdatequery which I dont need in my case. When I delete that code and just keep system.gui.confirm, it gives me an error. Could you please help me further? I am new to python coding.
Add a custom property holding the previous value (my example is prevValue).
In a propertyChange script:
if event.propertyName == 'value':
if event.source.value != event.source.prevValue:
if system.gui.confirm("Are you sure?"):
event.source.prevValue = event.newValue
else:
event.source.value = event.source.prevValue
EDIT: almost but not quite. I’d perhaps add one more custom property as a control value and write to that. There’s no way to intercept the value before being written to say, a tag. using a control value will help with that.
This event occurs when a component that can receive input, such as a text box, receives the input focus. This usually occurs when a user clicks on the component or tabs over to it. Link to the docs