How to handle showNumericKeypad() so the function runs immediately with the new value?

Problem description:

In Ignition Vision 8.3, I have an Int input field bound to a tag.
When I open the numeric keypad using system.gui.showNumericKeypad(event.source.intValue),
the propertyChange event fires using the previous value, not the value entered on the keypad.

I have to input the number twice for my script (which calls a function) to execute correctly.

Goal:
Trigger a function (e.g. QuickFunctions.SelProdLineVATSelection(1)) immediately after a new number is entered using the keypad.

What I’ve tried:

  • Handling logic inside propertyChange → sees old value.

  • Handling logic inside mousePressed → keypad works, but value isn’t committed in time.

  • Setting event.source.intValue = newValue manually — still doesn’t trigger propertyChange with updated value.

Question:
What’s the correct or best-practice way in Vision to handle showNumericKeypad() so the function runs immediately with the new value?

Could you do a tag change script instead?

How, exactly, are you doing this? Can you post full code?

The propertyChange event is fired many times (for each bindable property) so you must filter by which property is changing before you run any custom logic in your script.

1 Like

Example:

# Change this property name to the name of the property that is expected to change
if event.propertyName == 'intValue':
	# nest all applicable logic here

Morning Paul, I am trying to do something like this in my input field:

import system

logger = system.util.getLogger("\*\*\*\*\*\*\*\*")

try:
lineRunning = system.tag.readBlocking(\["\[default\]Global/Line1/Running"\])\[0\].value
if lineRunning == 0:
# Show keypad and capture user input
newValue = system.gui.showNumericKeypad(event.source.intValue)

    if newValue is not None and newValue > 0:
        # Update the field value (and bound tag, if bidirectional)
        event.source.intValue = newValue

        logger.info("User selected **********.".format(newValue))
        QuickFunctions.********(1)
    else:
        logger.info("******".format(newValue))
else:
    logger.info("********")

except Exception as e:
logger.error("\*\*\*\*\*\*\*\*\*\*\*\*))

hi thanks I added this at the beggining of my code, I attached earlier, but still nothing happens I have added this line in the mouseClicked, event.source.intValue = system.gui.showNumericKeypad(event.source.intValue)
becuase I need to call the numeric keypad first right? then when the property intValue changes I will run my code right? the problem is nothing happens , the keypad shows up, I enter the value but I get nothing after that

Step 0: Stop trusting LLM output for help with Ignition. LLMs are too broad spectrum to help with Ignition outside of very narrow bands, and they are absolutely not suitable if you don't already know how to guide them to success.

Step 1:
Outline your requirement better. I could point out a handful of issues with your script, but this is an XY problem - you've already decided that you need to use showNumericKeypad and write to a tag and use a property change script, and I'm not sure that's actually what you need.

Again: LLMs cannot be trusted. If you ask an LLM to write code for you, it will happily do so, instead of telling you (as I, a human, am) - that you may not need or want to write any code. It's entirely possible you just need to set your project to touchscreen mode and use bidirectional bindings, for instance.

5 Likes

Morning Paul,

I got the project in Touch Screen mode enabled, I am transferring a SCADA app from Wonderware Intouch (the code I am familiar with) to Ignition, I am learning as I go so I am using everything I got to translate scripts and so on, LLMs speed up this process and I am totally aware they are not reliable but the save me a huge amount of time in translating big chunks of code.

The app is going to be use by PC users where they can access the app with keyboard and mouse but the app will also run in Tablets, so I am not entirely sure what is the best way to handle the inputs by the users, there are some input fields where I need the standard keyboard and others where I need the operator just to introduce a numeric number.
At the moment, I am struggling to grasp the concept inside Ignition component scripts where for example I can have a mouseclick script working alongside a propertychange one.

I do apologize if this is basic stuff I should already know before posting, I am going through the videos in the Ignition University at the moment so I am trying to fill the gaps, with documentation on the website, videos, youtube, chatgpt, … and whatever I can use to get the job done.

This is not true, as a beginner LLMs will burn huge amounts of time sending you down a rabbit hole you should have never been looking down and overcomplicating very simple tasks. You have illustrated this perfectly with your use case.

Using Vision for a tablet is not a great idea. Tablets vary in screen resolution wildly so it isn't a great option. Also the Perspective app is available for both Android and iPad and supports the onboard keyboard automatically.

Using Perspective for a fixed workstation may not be ideal either, but at least with Perspective you can build the interface once and have it work on both types of devices without rewriting the interface.

3 Likes

Morning David,

The idea with the tablets purchased will be to have the same screen resolution as the desktop application, so we were hoping to not have issues with that and be able to run the Vision app in both.

In InTouch, the keypads populated automatically adapt to a full keyboard or just a numeric pad when the tag behind it is an integer for example. I don’t think I can do that in Ignition, (if I am wrong on that assumption please correct me), so I was using to different commands to show the numeric or the regular screen keyboard.

If I have my project in Touch Screen enable, do I need to add these showNumericKeyPad to my input field MousePressed or MouseClick script at all?

the PropertyChange script I was expecting to run after the intValue was changed with the input of the user but it doesn’t seem to do anything, I have put logs in place to see if I could get any information in the console but I have no information back, so my assumption is that the propertyChange is not running at all after the script of the mouseClick has populated the keyboard and capture the data from the user.

If numeric entry on a touchscreen is your goal, why are you using scripting at all?

Use a numeric input component. It automatically displays a keypad. If you then need an action upon completion of the entry, use a tag change script, or a new value property change event on the numeric input component.

If you need the keypad only when line is running, bind the editable of the numeric input to that expression.

I too came from wonderware, and it’s much easier to do the equivalent actions in Ignition and without a lot of scripting.

2 Likes

Thank you Robertm, much appreciated, I have tried this:

the Enable option doesn’t quite work in the input field, still displays the keypad which I need to prevent the user for doing.

Sorry, editable field. This will prevent keypad. It will also allow you to change style to dim input box as notification that it’s not editable.

Thanks Robertm, this solved the issue with the input field

1 Like

Now you just need to stop using LLMs for Ignition work. (See also the rules in this forum's FAQ in that regard.)

Also:

Vision does not run in iOS or Android.

2 Likes

thanks pturmel, I read the FAQ just now thanks for pointing that out, the tablets purchased run in Windows 11

1 Like

That is a poor choice for a system for production, Windows updates and Copilot in the middle of the workday? Nope. Also no more local user accounts without online activation.

3 Likes

Well this decision about the tablets and the decision to migrate to Ignition was done by the client, I am just the engineer to implement the conversion I am not sure who recommended this to the client, maybe a very persuasive sales person that doesn’t have to deal with the consequences :slight_smile: