Page 1 of 1
Dynamically controlling cursor position
Posted: Tue Jun 24, 2014 8:16 am
by pshuey@dasinc.com
I have a screen that is set to automatically update when a field is changed. When this happens, the cursor always returns to the first input field on the screen. Is there a way to dynamically control the cursor position so it does not always go back to the first field?
Re: Dynamically controlling cursor position
Posted: Tue Jun 24, 2014 9:02 am
by Scott Klement
Web pages don't normally have the concept of "cursor position" in the same sense as 5250 applications. But, for compatibility, Profound UI has some features that attempt to provide something similar to the 5250 environment.
So you have two alternatives:
1) The web way, which isn't based on cursor position, but you can set focus to a particular field.
2) The Profound UI method that strives to assist with compatibility with 5250 applications.
For #1, you can simply tell the browser to set focus to a widget on the display in JavaScript. So you'd do something like getObj("TextBox1").focus() -- this moves the browser's focus to a field that has an id of 'TextBox1'. (Web ID's are case-senstive, so please match the upper/lowercase exactly.)
For #2, each widget has a property for 'cursor row' and 'cursor column'. These properties are unset by default on new widgets, but if converted from a 5250 display, the converter will automatically put the row/col from the 5250 display into these properties. In either event, you can change these properties to the appropriate row/column in the visual designer. (So, in Profound UI these fields don't control the widgets placement on the screen or anything, they are just here for compatibilty with 5250.) Then, at the screen level there are properties called 'set cursor row' and 'set cursor column' that you can bind to variables. When the dispay starts, Profound UI will find the widget that has the row/col that matches the values sent in the 'set row/col' properties, and will move focus to that widget.
Hope that makes sense... but anyway, either of these should work for controlling the cursor position.