A Little More Than a Tool Tip

Use this board to ask questions or have discussions with other Rich Displays users.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

A Little More Than a Tool Tip

Post by emhill »

I would like to place a "?" button by a dropdown to allow the user to press and get a better explanation of the dropdown options. I know about the tool tip property but I want something that will stay on the screen until the user closes it. Is there anything other than just using a regular window type format to accomplish this?

I see the dialogs widgets and think that might be the ticket. The data should all be static inside the dialog. Is there a function in PUI that will allow me to click on a button and show the dialog box without passing control back to my program? If not, how do I define the button so my program will recognize it? As a function key? If so, all my function keys are in use.

Any suggestions will be appreciated!!!

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: A Little More Than a Tool Tip

Post by Scott Klement »

There's no need to use a function key, unless you're trying to emulate 5250 behavior for some reason? I would typically use a function key if I'm trying to keep existing RPG code intact without changes -- otherwise, I'd use a named indicator.

Here's what I'm thinking, about adding the "button":
  • For something like this, I like to use an image as a button. (Though, an actual button widget would work, too.)
  • Set the image source to /profoundui/proddata/images/icons/information.png (you can set it to any image you like -- but this is a nice one for information about something.)
  • Bind the 'response' property of the image to a named indicator. Something like btnInfo might be a good name.
  • Now, when someone clicks the image you just added, control will be sent back to the RPG program, and the btnInfo indicator will be set to *ON. You can check for it, and display a dialog record format.
To add the dialog, do:
  • Create a new record format. (Click New / Record Format)
  • Drag a dialog widget to the new format. I like the "Professional Dialog", personally.
  • Add a label label, or maybe a wrapping text widget to the dialog with the info you want to say. I like wrapping text, because you can use HTML tags to do stuff like bolding, underlining, etc, plus of course, it's an easy way to type text that wraps to multiple lines.
  • Add a button to the dialog. Something like "Close". or "Ok" Bind it to an indicator like "btnClose"
  • Set the dialog title to something appropriate
  • I also like to add a "close button" (the little 'x' in the upper-right corner) to my dialogs. You can find these under the "Dialogs" section of widgets in the designer. You should also bind that to btnClose (or a different indicator if you want your RPG code to distinguish it from other stuff.)
  • Save & compile the display file.
Then change the RPG code:
  • After displaying the screen with the information button, check for the btnInfo indicator to be pressed.
  • If btnInfo is pressed, EXFMT the dialog record format.
  • When the user clicks the close button, return will come back to your RPG
  • Go back to displaying the original screen at this point.
It's possible to do all this without returning control to your RPG by writing JavaScript code that displays the dialog by calling routines in the PUI JavaScript API. So that's another option if you really want to avoid sending control back to the RPG.

But, the way I outlined above will work nicely, too... and some RPGers aren't comfortable with JavaScript. If you'd rather do it via JavaScript and would like some tips with that, let me know.

Let me know if this is a useful solution for you, or if you were looking for something different.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

Thanks Scott...I actually got around to doing almost that exact thing. After more thought I created a completely new program and display file with the dialog box as the only screen format. This way I can use it from multiple programs by passing the help text I want displayed to it. I may even create an external database to hold the title and text of the dialog box so we will not have to go into the program every time we need to tweak the help text.

Thanks so much. Some times I have to put this old noggin through the ringer to get it to work correctly!!!
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

I'm having a little problem using the image as a button. I think I am missing a property but don't know which one. What I have set now is this:

ID = HLP_SELTYP
Field Type = image
Response = HLP_SELTYP (defined as an indicator)
Image source = where I get the image
Cursor = default
onclick = pui.click("btnSubmit");

Any help on this? Do I need to set the CSS class?

Thanks!!!!
kfritz
Profound User
Posts: 64
Joined: Thu Aug 04, 2011 4:53 am
First Name: Karl
Last Name: Fritz
Company Name: Logic IT Services
Address 1: Fluhgasse 141
City: Laufenburg
Zip / Postal Code: 5080
Country: Switzerland
Location: Switzerland
Contact:

Re: A Little More Than a Tool Tip

Post by kfritz »

Hi Eric

You can add a ShotCut Key at the Field Settings of the picture:

Like this (similar a button):
shortcut key = Enter
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

The control is passed back to the program when I click the image but the response indicator I defined is never getting turned on. I put it in the IBM graphical debugger and stepped through it but the indicator never turns on.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

Never mind. I found it. Was a typo that I looked at I know 100 times. Someone looked over my shoulder and pointed it out it 2 seconds. :-)

Thanks for all the help!!!!!
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

Not so fast!!! :-)

Now whenever I press ENTER or click SUBMIT on the screen, it sets on the response indicator attached to the help image. I removed the shortcut key = ENTER and reset the onclick property to pui.click("btnSubmit"); but the indicator is never being set on when the image is clicked.

Any more suggestions?

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: A Little More Than a Tool Tip

Post by Scott Klement »

Hi Eric,

I do not recommend specifying both the "onclick" and "response" properties of the same image (or button for that matter.) Even if you can get it working, Profound Logic does not support it, so it might break in a future release. It's intended that you only use one or the other -- onclick or response.

If you specify the response property, then when the button is clicked, control will be returned to the program, and the indicator will be turned on. There is no need to specify "onclick" for this to happen. As far as I can tell, this is what you want, isn't it?

If you want the image to peform some client-side logic, and then submit with a different button on the screen (I don't understand why you would in this scenario, but maybe I don't fully understand the scenario) then I would not specify the response indicator on the image. Instead, I'd specify the onclick property, and have it run some JavaScript code, followed by pui.click("otherButton") (i.e., "btnSubmit", fi that the other button you wanted it to click). But, I'm wondering why you need that functionality, here. Can you clarify?
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: A Little More Than a Tool Tip

Post by emhill »

Scott...you are exactly right. I had it working yesterday without any trouble but for some silly reason started adding properties that I didn't need. Just having a response indicator is all I need and it is now working correctly.

Thanks to you and kfritz for your help on this!!!!!!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests