1. Daniel Vivier
  2. PowerBuilder
  3. Tuesday, 13 April 2021 19:11 PM UTC

This is a continuation of my question about saving screenshots of windows, which has been well answered.

Now ideally we would want to make this functionality obvious to users, and one idea would be to have a little camera icon (or something like that) in the title bar of all of our windows, just to the left of any top-right controls for minimize, maximize/restore and close that are present on the window. 

I've done some Googling and while there are C-language solutions out there, they are quite complex and seem to require having full control of the windowproc, which I'm not convinced we do in PB. I can also see that this could be done with a ribbonbar, but we're not using those now, and I'm looking for a minimal change. 

I'm open to other at least somewhat obvious options. I can easily implement an invisible keystroke to do it (with a pbm_keydown event) but that isn't discoverable by users.

Any bright ideas or solutions?

Thanks.

Daniel Vivier Accepted Answer Pending Moderation
  1. Sunday, 2 May 2021 21:25 PM UTC
  2. PowerBuilder
  3. # 1

My final solution was to add a small camera image to our base window, which defaults to being visible at the bottom right corner of the window, and stays there with code in the Resize event. Instance variables we added allow individual windows to specify to omit the camera, or move it to the top of the window instead of the bottom, or to the left of the window instead of the right. (That means we can put it in any of the 4 corners - though I never use top left, too distracting!) In almost all windows, that allowed us to find a location for the image that didn't unduly distract from its existing contents, or touch other controls in a problematic way. In a few windows we needed to size them a bit to make room for the camera image in an appropriate corner.

Then that image has a tooltip saying what it does (which is take a screenshot and then offer to email it to us for support). And it has a Clicked event that triggers that process. 

Our applications with that added have just been released, but I think many of our users who just aren't very computer literate (and have trouble with our standard screenshot instructions for using Alt+PrtScn then pasting the result into an email) will find it helpful when they have problems with windows, or questions about them.

We actually also added the same screenshot then email functionality to our custom HTMLMessageBox DLL (that, duh, allows us to use minimal HTML in messageboxes, and choose the font). To do that, I took Roland Smith's screenshot code from his Bitmap sample and translated it back from PB external function calls to C, which I could then put into the HtmlMessageBox DLL. Then I call that same C function for the screenshots from the camera images on PB windows as well, so I'm not repeating code unnecessarily by keeping Roland's PB code too.

I'd be happy to share any of this.

Comment
  1. Olan Knight
  2. Thursday, 6 May 2021 14:18 PM UTC
That's a great answer, Dan!
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 6 May 2021 22:29 PM UTC
Great idea for user support!
  1. Helpful
There are no comments made yet.
Marc Wietscher Accepted Answer Pending Moderation
  1. Wednesday, 14 April 2021 19:18 PM UTC
  2. PowerBuilder
  3. # 2

Hi Dan,

 

have you considered to open a popup window for each of your main and response windows and place these popup windows on top of their respective "parent" windows?

Your popup windows would have the size of your icon,  no titlebar, controlmenu, border etc. and your existing main and response windows just need to have a reference to their respective popup. Then you only need to code a few lines in the move event of your "parent" windows (I guess they have common ancestor like w_base).

Not quite sophisticated approach but should be ready to go in a couple of hours.

 

Good luck and best regards

Marc

Comment
  1. Daniel Vivier
  2. Wednesday, 14 April 2021 20:56 PM UTC
Thanks, Marc. It seems like that would require more coding, and be a more heavyweight solution, that John Fauss' solution of just putting a clickable image in a corner of each window, with a tiny bit of code in the Resize event to keep it in that corner. That's what I'm working on now.
  1. Helpful
  1. Daniel Vivier
  2. Sunday, 2 May 2021 21:14 PM UTC
I actually tried this, and even found some somewhat complex Windows API code that allowed me to figure out a location that I could move the popup window to that put it on the PB window's title bar, just to the left of whichever of the minimize, maximize/restore and close controls are on it at the left.

Unfortunately that solution ended up being a bit too flaky. One problem was that sometimes we make windows in our application invisible, when they open a response window, and visible again when that response window closes. That would have required also making the popup on the first window invisible and visible at the same times (because otherwise the popup stays on the screen!), which would have required us to find and carefully code all such places. Another problem is it seemed flaky whether or not it appeared on response windows, and I couldn't be clear what was required to fix it. Also, while you were only supposed to have to click once on the imagein the popup window to take the screenshot, sometimes I found you had to click twice. And finally, after clicking that popup, the window with the popup on it lost control so you had to click back into it with the mouse (despite, I think, code I added to setfocus to the window) before you could do anything on it.

So I gave up on this approach, although it was certainly prettier than what we ended up with.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 14 April 2021 17:59 PM UTC
  2. PowerBuilder
  3. # 3

You could turn off the titlebar and make a fake one using window controls. Then you can have all the buttons you want.

Windows 10 uses Segoe UI. Previous versions used Marlett for window elements.

I have a window that does this. I don't have a colored background control so this code is on the window itself:

 

mousedown event

 

CONSTANT uint WM_NCLBUTTONDOWN = 161

CONSTANT uint HTCAPTION = 2

Post(Handle(this), WM_NCLBUTTONDOWN, HTCAPTION, Long(xpos, ypos))

 

The mousedown event allows for dragging the window. If you have a colored background control, you might need the mouse capture API function. I am pretty sure this has been discussed in this forum before.

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 14 April 2021 14:52 PM UTC
  2. PowerBuilder
  3. # 4

Dan -

What I did was to add a small icon to the STATUS BAR. It's available, obvious when the user seeks it, out of the  way, doesn't interfere with the real estate of the window, and is supported by PowerBuilder already.

Yes, I use the PFC.


Later -

Olan

Comment
  1. Daniel Vivier
  2. Wednesday, 14 April 2021 16:39 PM UTC
That's an interesting idea, Olan, but it appears that only MDIHelp and MDIDockHelp window types have a status bar, and I use mostly Main and Response windows. I'm not going to change my whole design for this one feature. Even that wasn't easy to find out since "status bar" isn't in the Index of the Help (nor is MicroHelp)! I also don't see how to put an icon into the status bar, or react to clicks on it (maybe those are PFC features, which I also don't use).
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 13 April 2021 20:00 PM UTC
  2. PowerBuilder
  3. # 5

Hi, Dan - 

I don't believe you'll be able to add a control to the title bar, as it is being managed by PB/Windows.

I'm obviously not familiar with your app, so my suggestions may or may not be suitable. Assuming you have a limited number of ancestor windows...

1. Dynamically add a very small (say, 3 pixels by 3 pixels, for example) visual user object to the window and place/move it so that it stays in an out-of-the-way location... maybe in the lower-left corner of the window's workspace. User can click on it, or right-click/popup menu, etc.

2. It's not too hard to dynamically add an item to the SysCommand menu (the one that drops down when you click on the window's icon in the left side of the title bar) using menu-related WinAPI calls. This isn't visible to the user, however, unless they drop down the SysCommand menu.

3. Right-click on the window (background). Again, no visible cue.

Good luck!

Comment
  1. Daniel Vivier
  2. Wednesday, 14 April 2021 17:52 PM UTC
Thanks, John, I'm working on a version of your option 2, though I found the icon had to be 20x20 pixels to be big enough to notice (and notice that it looked like a camera).
  1. Helpful
  1. John Fauss
  2. Wednesday, 14 April 2021 18:05 PM UTC
I hope it works out well for you and your customers, Dan! Let us know the results?
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 13 April 2021 19:15 PM UTC
  2. PowerBuilder
  3. # 6

Why not simplify your life and just use standard PB feature to implement, such as icon n toolbar or the new RibbonBar?

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 13 April 2021 19:29 PM UTC
So this is SDI interface not MDI?
  1. Helpful
  1. Daniel Vivier
  2. Tuesday, 13 April 2021 19:45 PM UTC
Yes, SDI with lots of response windows.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 13 April 2021 21:17 PM UTC
Oh, I see. John's idea sounds promising.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.