Text box questions

I am using a text box. If there is more data than the size of the text box it adds the scroll bar on the right. So here is some questions pertaining to poll rate and the function of the text box.

If I put the text box on relative poll the data updates as it should, however each time it polls it resets the scroll bar to the top.

  1. Is there a way to keep the scroll bar from resetting to the top?

  2. I have a data entry box that is like a pop up. Is there a command that I could issue at the end of the data entry configured action that would do one poll and one poll only so that the data in my text box will update with the latest information?

  3. What command could I issue so that each time the data entry box is opened the entry box is empty? Then like I mentioned I would like to issue a command that will do one poll to update the data in the text box which is fed from the data in the entry box?

  4. What command could one issue that would reset a value to 0 (zero) at the end of the configured action?

Thank you and have a great weekend.

mrtweaver,

I think I understand what you are asking. Is your scenario this: You have a pop-up that has a Text Field and you want to type something into it then have it appear in a Text Area component? There are a couple good ways to do this and I’ll describe one to you.

All these code examples are relative to your project but fill in the event.source… with whatever is required.

I assume the Text Field is hidden somehow but on the same window as the Text Area and not in another window. On the button that reveals the text box, add

event.source.parent.getComponent("Text Field").text = "")

to blank out the text box when it appears. Then on the button that submits the data from the Text Field into your database, include

fpmi.db.refresh(event.source.parent.getComponent("Text Area"), "text")

to refresh the info in the Text Area. Unfortunately, the only way I know to keep the most recent value on the screen is to reverse the order in the sql query that populates the Text Area (using the ORDER BY clause). Then you can set a value to 0 with the submit button by using

event.source.getComponent("my component").intvalue = 0 or fpmi.db.runUpdateQuery("UPDATE table SET column=0")
If you are using another window for a real pop-up, it gets a little more complicated, but it’s not too bad. Make sure to check out the help files (press F1 in the designer) and look at the example scripts for the components or the jython technical reference. They are a great help and pretty complete.

Hope that helps!

Bobby nailed your scripting options. There are 2 things that come to mind that could make life easier.

  1. I wouldn’t normally use polling with a text box. Selecting “polling off” will populate the data from the database once when the window opens. You can use Jython to refresh or reset the data on an action.

  2. For the “popup window” you can use caching to make FactoryPMI “forget” or “remember” values when closing/opening windows repeatedly. In this case save the window with an empty value and the Window Cache policy set to never.

Also the scroll bar in a text box “resets” when the query refreshes the data. Turn polling off to solve this problem. I don’t think you can prevent this action during a refresh for a text box.

The scroll bar on the text box shouldn’t behave like that - I’d consider that a bug. We’ll fix it for the next release.