cancel
Showing results for 
Search instead for 
Did you mean: 

Personas Slipstream - How to add functionality for the Enter key?

former_member238607
Participant

Hi,

We are running Personas 3.0 SP7.

Under the traditional rendering engine, I was able to add script like the following example to the onEnter screen event to handle events when the Enter key was pressed.

// Ignore the event if it wasn't fired by the Enter key.
if (triggerType !== source.EVENT_ENTER) return;


// If the Enter key was pressed inside a textbox, click a button.
if (focused && focused.id === session.findById("wnd[0]/usr/boxPersonas_149010509512345/txtPersonas_149434590467890").id){
    session.findById("wnd[0]/usr/btnPersonas_149019811223344").press();
  }

Under Slipstream, this code displays an error message saying "ReferenceError: triggerType is not defined".

If I remove the triggerType line of script, the code displays an error message saying "ReferenceError: focused is not defined".

I tried adding session.utils in front of triggerType and focused. The code no longer displays an error, but session.utils.triggerType and session.utils.focused both come back as 'undefined', so that is not a solution.

Does anyone know how to check if the Enter key was pressed, and determine which object had focus when it was, in Slipstream?

Thank you very much for your help!

View Entire Topic
clemens_gantert
Active Participant

Hello Jeff,

"triggerType" is not a defined parameter of the onEnter event. It's a parameter associated with the onBeforeRefresh event and I don't know why the WebGui would provide the parameter for the onEnter as well (it's definitively not an official parameter).

The "focused" parameter is defined for onEnter, but it must only be provided if there really is a focused control when the enter key is pressed. So you want to check for the parameter's presence in a safe way like:

if (typeof selected === 'object' ) ...

Also, recently defects were reported regarding onEnter in SE. Be sure you have the latest client note installed.

Best Regards,

Clemens