The times I used a custom OSK I did like what @Brian_Stilson said with minor variation.
My template would have a numeric display that shows the current value and a “hitbox” which is just a button on top of the numeric display that has opacity set to 0. So basically you hit the button when you click on the numeric display. This means the base container for the template is coordinate so you can make the hitbox overlap the display layer of your template but you can make the display layer a flex container with height and width of 100% to make your template follow a flex layout.
A button with an opacity of 0 is clickable but invisible. It’s good to use a button because some touchscreen drivers will have unreliable response to click events but onActionPerformed will work (at least has so far for me).
i added a button on m screen and what action should i select
You can script an event on the label itself. You don’t need a button.
I would use “Script” for this type of thing typically.
One possible exception…
If you can get all the stuff you need to load the template it can sometimes make sense to use “Popup” because it affords you some advanced features such as relative positioning which is sometimes desirable with popups. Viewport bound is also a nice feature to consider with popups.
That’s true but a label doesn’t have the “onActionPerformed” event. I have seen some touchscreen drivers not reliably respond to normal mouse events but the “onActionPerformed” event has worked for me with all touchscreen drivers I have encountered so far out of the box without any fancy configuration. That’s why I recommend using an invisible button as a hitbox.
I think it was the Hope touchscreen driver that was not always getting the event unless I fiddled with emulation modes and whatnot. I’d rather have an invisible button in my setup than have a requirement to adjust the touchscreen configuration down the road as HMI clients are replaced.
1 Like
all i’m looking for is a popup keypad that i can use with a mouse. is this something that perspective can not do. I have used the onscreen keyboard with no issue in the vision module by enabling it in the options in the designer.
I have used many SCADA packages that do this function with out any issue.
Sure. You could use a script or popup command on an onClick or onActionPerformed event if you have a mouse.
The stuff I said about not using onClick only applies to some touchscreen drivers I have encountered.
i tried the onclick but i dont get the keyboard to popup. what am i missing?
Have it write to a log on click to make sure you’re getting your event.
is there anyone that can remote into my system to fix this issue?
Not here, give support a call if you're looking for help like that.
i cant believe something so simple is so difficult to do.
Sorry, I’ve been swamped, but if you’re using my numeric input touchscreen keypad resource from the Exchange, make sure your onMouseDown event on the numeric entry field component has this logic in it to properly set the ownerId
def runAction(self, event):
self.custom.keypad.ownerId = str(system.date.toMillis(system.date.now()))
owner = self.custom.keypad.ownerId
popParams = {'owner': owner, 'min': self.props.inputBounds.minimum, 'max': self.props.inputBounds.maximum, 'oldValue': self.props.value, 'units': self.custom.keypad.units, 'decimals': self.custom.keypad.decimals}
posit = None if self.custom.keypad.centerScreen else {'left': event.clientX, 'top': event.clientY}
system.perspective.openPopup('keypadPopup-' + owner, 'Exchange/Keypad/Numeric Popup', title=self.custom.keypad.title, params=popParams, position=posit, showCloseIcon=True, draggable=True, resizable=True, viewportBound=True, modal=True, overlayDismiss=True)
Then make sure in your scripts on that component, you have the keypadReturn
message handler using this:
def onMessageReceived(self, payload):
if self.custom.keypad.ownerId == payload['owner']:
self.props.value = float(payload['value'])