Page 1 of 1

Tool Tip visibility key? Like Alt in old school VB apps?

Posted: Fri Aug 18, 2017 12:07 pm
by Larelyn
I have a challenge with two different camps in my company - the heads-down-data-users and managers who want to modernize. The managers think displaying function keys F# is outdated and ages the app (the function text is fine, just leave off the F# part). The users want to see the F# function key on the screen to keep their hands on the keyboard and continue on their task with no interruption.

For now, function key text appears as a hyperlink with the function key F# in a hovering tool tip. But, this still isn't good enough for the users - it requires the mouse to hover.

Would anyone have any suggestions how I can create a javascript function that will take a keystroke (ctrl, alt, or something like that) and display ALL the tool tips?

Re: Tool Tip visibility key? Like Alt in old school VB apps?

Posted: Fri Aug 18, 2017 7:51 pm
by Scott Klement
Most customers allow both the F-keys and button/link clicks in their displays. This way both types of users can do it their way. This is the first time I've heard a complaint that text on the screen describing the keys is a problem for management. Usually they are happy with it as long as there's a GUI alternative.

If you wanted to, for example, pop up information when the user hits some sort of key, you could certainly do that. There's nothing built-in to the product for this, but there's no reason you couldn't code it.

The pseudo-code would look something like this:

1. Attach JavaScript code to the keyboard's "keydown" and "keyup" events.

2. In the JS code, check for the key... if it is the one you choose (alt?) and the key is pressed down, display a widget (or custom html?) that shows what the keys are. For the key up event for the same key, hide that key text.

3. To determine the key text, loop through all of the output fields (or hyperlinks?) on the display, and check their tool tip properties. You could do this each time a screen loads to build the help display.


We provide some tools that might be helpful. For example, in 5250 mode, the "afterLoad" function runs after every screen has been loaded. You could use code run from this event to build your help display, and to attach the keyboard events. That way, you only need do it once for all screens.
http://www.profoundlogic.com/docs/pages ... Id=5275903

In a Rich Displays (including those run from within Genie or Atrium) you can use the pui.onload event for the same purpose:
http://www.profoundlogic.com/docs/displ ... pui.onload

To attach events to the screen (so that you don't have to code them on a per-widget basis) you can use the addEvent API described here:
http://www.profoundlogic.com/docs/pages ... Id=3276841

To get all of the output fields on the display, you could use the getOutputFields() API, if desired:
http://www.profoundlogic.com/docs/pages ... Id=4850002

Though, instead of getOutputFields() you could also use the browser's built-in routines like getElementsByTagName, getElementsByClassName, querySelectorAll etc. These might work better if you only want to retrieve hyperlinks.

Any of the elements returned by the above APIs should have pui.properties["tool tip"] defined on them if they are widgets that contain tool tips. You can read that to get the tool tip values.

Hope that helps you get going...

Re: Tool Tip visibility key? Like Alt in old school VB apps?

Posted: Wed Aug 23, 2017 4:46 pm
by Larelyn
Thanks, Scott! It certainly is enough to get me moving in the right direction!