Doubt on Numeric text field

Hi Guys, I am not an expert in Ignition/Java first off all, but had a quick doubt on numeric text field. In an old post I saw that we could access the underlying component (JTable) of a Power Table to do some higher level of functionality via java. This was done using the function getTable().

Similarly, is there an underlying component for numeric text field, if yes then how can I access it and what all java libraries do I have to import to do so. Thanks in Advance

Welcome to the forum!

  1. Vision or Perspective? (Edit your post and add the relevant tag. It will attract the relevant experts as well as being important for the actual answers.)
  2. Ignition can most likely do what you need without requiring library magic. What is the actual problem you’re trying to solve? You mention Numeric Text Field and then Power Table. Which is it?

I am working with numeric text field in Vision.

You don't have to import anything. It is a java component that subclasses standard Swing stuff.

Start here:

Then look here:

https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/factorypmi/application/components/PMINumericTextField.html

1 Like

Check out the introspect function @pturmel linked to, it is very useful. You can use plain old dir but the introspect gives you a bit more context.

If you don’t know how to examine components, the way I like to do it is via script console.

Open up the window that has the component in question in designer, then open script console. Then you can do

window = system.gui.getWindow("Some Window")
rc = window.getRootContainer()
someComponent = rc.getComponent("some container").getComponent("some component")
# now you can do 
result = shared.instrospect(someComponent)
print result
# or with dir
for thing in dir(someComponent):
    print thing
1 Like

Thanks guys, this was exactly what I was looking for, also @pturmel I have gone through the introspect function, its really a neat and handy thing . Let me go through the docs, will post if something comes up. Thanks.

1 Like

One quick doubt guys, PMINumericTextField is inheriting a method called removeActionListener() form JTextField. So will I be able to use this method, to not to listen to any mouse click events. If so how can I access the underlying PMINumericTextField from Numeric Text Field in ignition(like using getTable() for getting JTable from Power Table).

Can you guys provide me a sample code snippet or something, as I am having little difficulty with coding in Java. Thanks in advance.

I don’t think you should ever have to remoteActionListener via script. I think that’s probably what goes on in the background if you had an onClick event and then get rid of the whole script - then behind the scenes it’s removing the actionListener. If you never set up an action, there’s nothing to remove.

What is it you are trying to do/accomplish?

This means that PMINumericTextField IS a JTextField. That's what inheritance means. The inheriting class can change functionality in methods to support whatever functionality it added. Those would show up in the docs as defined again in the outer class.

Note that a Power Table is NOT a JTable--it uses composition, not inheritance. So the JTable is nested and the Power Table provides a convenience function to get to it.

1 Like

@bkarabinchak.psi, so basically I have few Numeric Text Fields in a window which are showing some values from PLC. Although I kept the Numeric Text Field Editable option to be false, when I double click in the Numeric Text Field its highlighting as if we double click the content on a normal text field. Also I believe focus is randomly shifting between the Numeric Text Fields. I can take care of the focus issue, but couldn’t handle the issue mentioned first. Although its not any process stopping issue, I don’t this to come back to be at sometime after we deploy the backup.

Understood @pturmel, thanks a lot for making things clear. Will go through it to have a better idea.