Skip to Content

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

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!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 18, 2018 at 05:12 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2018 at 12:14 PM

    Hi Clemens,

    I'm not sure if I did something wrong, but using if (typeof selected === 'object') in the onEnter event does not seem to ever result in a true condition; at least not when Enter is pressed inside an Input Field control.

    I was able to get the following code to work in the onEnter event.

    if (typeof focused !== "object") return;  // Ignore the event if an object doesn't have focus.
    
    // If the Enter key was pressed inside the Change Notification textbox, click the tile to fire the script.
    if (focused.id === "wnd[0]/usr/txtPersonas_123456") {
      session.findById("wnd[0]/usr/subPersonas_654321/btnPersonas_112233").press();
    }
    

    Thanks for your help!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.