prevent Profound from setting focus

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
rjared
New User
Posts: 5
Joined: Fri Dec 12, 2014 11:43 am
First Name: Russ
Last Name: Jared
Company Name: BBCS
Contact:

prevent Profound from setting focus

Post by rjared »

I have a #pui div within a page that has other elements outside of the pui div. One of those elements is a text input field. I want to keep focus in this input field, but when the pui div loads, Profound is setting focus (it appears to be calling focusOnContainer()). I tried to set "pui["no focus"] = true", but that doesn't seem to help. Any advice on how to prevent this, or how to get focus back into my field after pui loads?
Antonio
Profound User
Posts: 82
Joined: Fri Jun 29, 2012 2:33 pm
First Name: Antonio
Last Name: Ruballos
Company Name: Profound Logic
Contact:

Re: prevent Profound from setting focus

Post by Antonio »

In the onload event property of the screen, you can do something like the following:

setTimeout( function(){
getObj('ID of widget').focus();
}, 200);


And it should focus on the element who's ID you pass. What this code will do is run the code in the anonymous function 200ms after the settimeout function has been called. So by placing it in the onload event of the screen, it will run 200ms after the onload event and the code will set the focus to the element with ID 'ID of widget'. You can play around with this 200 value and see what works best for you. Let me know if you need assistance with this or have any other questions.
rjared
New User
Posts: 5
Joined: Fri Dec 12, 2014 11:43 am
First Name: Russ
Last Name: Jared
Company Name: BBCS
Contact:

Re: prevent Profound from setting focus

Post by rjared »

Yes, that works. Thanks!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: prevent Profound from setting focus

Post by Scott Klement »

Antonio's solution should solve the problem, no need for me to reply on that...

But, if you're curious... The reason we do this "setFocusOnContainer" is due to the problems that can occur when focus goes outside of Profound UI and you hit a function key.

For example, the F5 key is widely used in IBM i applications, but in the browser it means "reload the page". If a screen is displayed, but focus is on inside a PUI field, and the user hits F5 it'll reload -- which ends the PUI session and makes them sign-on again. (Or in Genie, restarts the 5250 session.) So that can be a huge problem... and users who are used to typing and hitting F-keys without looking at the screen would get screwed up if we didn't force focus to go somewhere within PUI.

Imagine an application where you look up inventory, originally written in RPG with a green-screen, but now converted to PUI. The user's habit is to type a product code, hit enter, then on the next screen hit F5 to show the inventory locations. Without our "setFocusOnContainer" stuff, they type the code, hit enter and focus goes outside the PUI screen. Then they hit F5, and because they didn't click the mouse inside their application first, it kills their session and makes them sign on again. After a few times, this will be a very frustrated user!

Our setFocusOnContainer forces the focus to keep going back inside our application so that when they hit F5, it'll send the F5 back to the RPG program instead of activating the browser's default action of reloading the page.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest