Security confirmation dialog

hi all,

newbie question, how to add security confirmation in button that bind to UDT parameter (boolean)?

so, i have 2 momentary button that handle Open and Close, i use UDT parameter for this button. im bit confuse how to add security confirmation on this button, coz i only find the security confirmation on the scripting properties.

Thanks.

There should be a security tab on the property editor window that you can change security on each component by role. Is this what you’re talking about?


thanks duffanator for your reply,

but this is what i need


so i bind this momentary button to boolean tag in UDT, for open and close.

so, when someone click the button, the confirmation dialog will popup, after they click yes, the the value of the UDT tag will change from 0 to 1.

but i dont know how to do this for the UDT tags.

thanks

1 Like

So something like this?

tagpath = 'Path to UDT' 
if system.gui.confirm(u'Are you sure?', 'Confirm'):
	value = event.source.close
	system.tag.writeToTag(tagpath + '/CLOSE', value)

Hi CPowell,

yes thats what i need

[code]if system.gui.confirm(u’Are you sure?’, ‘Confirm’):
value = event.source.parent.getComponent(‘Temperature Sensor 5’).getComponent(‘Momentary Button’).controlValue

event.source.parent.MOV.OPEN = value[/code]


so i set the UDT tag value based on the momentary button control value.

but there still a problem,


the value has change even before i click Yes as confirmation to change the value from 0 to 1, so the confirmation dialog is useless.

any idea

thanks

Any idea for this problem?

Please any one?

Can you go into your MousePressed Property and select Script Editor and show what has been generated there? That should show when the write is happening.

I have posted the script…

Actually there is two problem when using confirmation dialog, first, the value changed before i click yes.
second, when i use this function in momentary button, the value stay at 1 after you click yes or no, momentary button should back to 0.

There are two actions happening when you click the momentary button. The button automatically sets its Control Value property to the On Value for the required amount of time and then resets it. That is what the momentary button is supposed to do and you can’t really stop this from happening.

The button is also going to run your mouse click event script. Your script is separate from the momentary action of the button. Your script asks for confirmation (not the default action of the button), and your script will write a value to the specified property (not the default action of the button). Your script has no instructions to reset the value.

If you don’t have anything bound to the button’s control value, then don’t worry about what that is doing. In your script you are modifying a property of a UDT type. Focus on making that set and then reset. I used the following script still on the button’s click event to achieve what I think you are after:

[code]if system.gui.confirm(u’Are you sure?’, ‘Confirm’):
event.source.parent.MOV.CLOSE = 1

def reset():
  import system
  event.source.parent.MOV.CLOSE = 0

system.util.invokeLater(reset, 5000)

[/code]

Sorry for the late reply…

Thanks jmartell, the script did the job… PERFECT

Thank you