A number of provided javascript callbacks (events) and functions are provide to enable read/write of the screen as well as being able to enter a single screen transition's worth of keystrokes.
The provided callback event functions are:
SCOnLoad(em) | Called each time a new screen or screen update is received from the Inventu Viewer server / host. Use a set of IF statements to determine the active screen and read and write the screen accordingly. The em parameter is a handle to the active emulation object and is required for any access to the emulation screen. |
SCOnSend(em,key) | Called each time a screen is submitted based on a user pressing an ENTER, Function or other "AID" key. The em parameter is a handle to the active emulation object and is used for any access. The key parameter contains the current keystroke in mnemonic form ([enter], [pf1], [pf2] and so on). |
| Return true to indicate that the send should complete; return false to cancel the send which can be used as part of a client-side validation routine for entry data. |
SCOnResize(em) | Called each time the emulation browser frame is resized. If any content has been positioned on the screen, you can use this event to relocate the content. The values em.chrW and em.chrH provide the active emulation screen character Width and character Height, respectively. When using absolute positioning, the top of row one generally starts at a posOffset of 6px, but you may need some experimentation when locating content depending on the hosting iFrame definition. |
The provided screen read/write functions are:
SCScreenVal(em,row,col,len) | Returns a text value from the active screen. Area must be standard output (protected) text and not an INPUT (unprotected) field. To read an INPUT field, use the SCGetField function. |
em | The object passed in the SCOnLoad or SCOnSend call. |
row | The row of the text to read. |
col | The column of the text to read |
len | The length of the text to read. |
SCScreenVal(em,offset,len) | Overload of the same function using row,col,len but using offset instead of row,col. |
em | The object passed in the SCOnLoad or SCOnSend call. |
offset | The zero-based offset of the location into the screen of the text. |
len | The length of the text to read. |
SCGetField(em,row,col) | Returns a text value from the active screen. Area must be a INPUT (unprotected) field. To read a protected (standard) text area SCScreenVal function. |
em | The object passed in the SCOnLoad or SCOnSend call. |
row | The row of the field to read. |
col | The column of the text to read |
SCGetField(em,offset) | Returns a text value from the active screen. Overload of the same function but using zero-based offset instead of row,col to identify the field to read. |
em | The object passed in the SCOnLoad or SCOnSend call. |
offset | The zero-based offset of the location into the screen of the field. |
SCSetField(em,row,col,val) | Sets a text value on the active screen. Area must be a INPUT (unprotected) field. You cannot set a value unless it is an unprotected field. |
em | The object passed in the SCOnLoad or SCOnSend call. |
row | The row of the field to write. |
col | The column of the text to write |
val | The new text value for the field. |
SCSetField(em,offset,val) | Sets a text value on the active screen. Overload of the same function but using zero-based offset instead of row, col to identify the field to write. |
em | The object passed in the SCOnLoad or SCOnSend call. |
offset | The zero-based offset of the location into the screen of the field. |
val | The new text value for the field. |
SendAid(key) | Sends the currently selected emulation screen to the host using the provided key as the "enter" or AID key. |
key | The AID key in mnemonic form, such as [enter], [pf1], [pf2] and so on. |