Hi. Based on a Tag value a need to be able to disable a Multistate Push Button so it has no functionality. It still must be visible. Would I use VBA code for this or an expression? Thank you for your response.
Why not use 2 versions of the button based on the tag value and use visibility to display the correct one? That would appear to be the easiest solution, but it's early in the day yet!
Hi Mark. I do not see any Events for a Multistate Push Button. Basically the Multistate Push Button current state sends a interger value to the PLC. Unless the Key Selector swith is turned on you cannot change the States of the Multistate PB.
I would agree with MartB - Overlay a "dead button" over your button that is tied to correct bit and use animation to choose visibility. Quick and easy fix.
For the "dead button" wouldn't you want to use a rectangle or polygon, made to look like the button?
Reason I suggest this is I thought that if you make a button and there isn't a connection, or the tag is invalid, pressing it will make the diagnostic window pop up with an error.
Thing is I need the Button to be able to show its current State (1 of 10 States) at all times. There are 24 buttons on the screen. So there are too many combinations to use overlays.
It would not pop up with an error - I usally create a memory tag called nothing and asign the button to the nothing tag. Yeah that is a lot of buttons to do an overlay.
What I do is put a visibility animation on the button to hide it then use the same animation on a multi-state indicator (except it is shown instead of hidden) that has the same states and styles as the button.
I used to make the indicator look exactly like the button, but I've gotten complaints since it looks like the button is still there, and when people press it, they expect something to happen. I started using a line border to get rid of the 3D button look so people know it isn't a button.
Awh figured it out using VBA code and a large transparent button covering all the buttons.
Private Sub Button1_Press()
Dim fileName As String
fileName = InputBox("Please Enter Password To Make Changes", "Pass Word")
If fileName = "password" Then
ThisDisplay.Button1.Enabled = False
End If