1. Steen Jakobsen
  2. PowerBuilder
  3. Friday, 26 June 2020 05:24 AM UTC

Hi,

How can I place a button in the title bar of a main window ?

(Just like MS Office)

 

I'm using PB2019 R2 /Windows 10

 

Thanks 

Steen :-)

Steen Jakobsen Accepted Answer Pending Moderation
  1. Saturday, 4 July 2020 05:03 AM UTC
  2. PowerBuilder
  3. # 1

Thanks Roland .. love it :-)

will implement

 

//Steen

Comment
  1. Roland Smith
  2. Saturday, 4 July 2020 23:54 PM UTC
I did some testing and my suggestion only works on the window. To make a control able to drag the window, it has to 'capture' the mouse.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 2 July 2020 14:15 PM UTC
  2. PowerBuilder
  3. # 2

Apps/suites like MS Office (and presumably, PB Ultimate Suite) are able to provide these features only by taking over the complete responsibility for rendering the appearance and for managing the behavior of the window's caption from the Windows O/S, because Windows doesn't provide a convenient means of doing this. Since the Windows O/S doesn't offer this capability, PB also does not currently provide a means of accomplishing the same. Thus, you'll have to "roll your own" via the standard visual controls that are available, as Roland suggests.

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 2 July 2020 12:54 PM UTC
  2. PowerBuilder
  3. # 3

What you need to do is turn off the title bar and add a statictext control that looks like the title bar and add all the buttons yourself.

To be able to drag a window without the standard title bar, you can add this code to the mousedown event:

CONSTANT uint WM_NCLBUTTONDOWN = 161
CONSTANT uint HTCAPTION = 2

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

 

Comment
  1. Steen Jakobsen
  2. Friday, 17 July 2020 05:50 AM UTC
Roland,



That code is just AWESOME :-)

I added it to a dw control (static control don't work) and placed it on top of a Ribbon Control.

Then I used the Ribbon TabButton to simulate the window close button.



It work absolutely great!!!



Again - THANKS a lot Roland. You are a most valuable resource.



//Steen



ps. I was unable to add the code to the ribbon control it self as the ribbon button events would then not fire.





  1. Helpful
  1. Steen Jakobsen
  2. Friday, 17 July 2020 05:57 AM UTC
pps. do you by any chance know how to put the code in a ribbon control and still have the ribbon events fire ?
  1. Helpful
  1. Roland Smith
  2. Friday, 17 July 2020 15:33 PM UTC
I have not tried the ribbon control.
  1. Helpful
There are no comments made yet.
Brad Wery Accepted Answer Pending Moderation
  1. Friday, 26 June 2020 19:43 PM UTC
  2. PowerBuilder
  3. # 4

Ultimate Suite for PowerBuilder contains window objects that have a custom caption.

https://www.pbultimatesuite.com/EN/modernize-pb-interface/single-page-application.html

Having buttons in the caption is one of the options.

 

Comment
  1. Steen Jakobsen
  2. Thursday, 2 July 2020 04:01 AM UTC
Thanks Brad, But the suite is way to expensive.
  1. Helpful
  1. Brad Wery
  2. Thursday, 2 July 2020 13:54 PM UTC
Thanks for the feedback. This year some new pricing options were introduced:



https://www.pbultimatesuite.com/EN/modernize-pb-interface/pricing-price-request-buy.html



  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 26 June 2020 16:39 PM UTC
  2. PowerBuilder
  3. # 5

Hi Steen;

  I would be interested in that feature too!

  As an alternative, how about being able to add User Objects to any menu toolbar area. My framework does this automatically if a UO pointer is provided. The UO can contain as many child UO's in it as well AND the approach seems to be "Themable "(my new word for today) in my testing  ;-)

Normal:

Themed:

Food for thought. HTH

Regards ... Chris

Comment
  1. Steen Jakobsen
  2. Thursday, 2 July 2020 04:00 AM UTC
Hi Chris,

Thanks for your food :-)



I think a nice enhancement to PB would be to customize the title bat just like the MS Office applications.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 2 July 2020 12:00 PM UTC
Hi Steven;

I agree. Please create a support ticket for this feature as a GUI enhancement request.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 26 June 2020 12:15 PM UTC
  2. PowerBuilder
  3. # 6

Hi,

You could try this, but it cannot be a Main typed window:

Make a window typed "popup", "child" or "response" and uncheck the title bar in the properties.

You then simulate your own title bar with a static text.

Your window cannot be a sheet or main and of course, this won't allow you to drag the window to a different position by dragging on the title bar anymore, so it might not be what you want.

As an alternative, I'm pretty sure there'll be some windows API function that allows you to remove the title bar.

yep, like this:

https://stackoverflow.com/questions/2014014/hide-title-bar-of-program-using-api

 

 

Comment
  1. Steen Jakobsen
  2. Thursday, 2 July 2020 04:01 AM UTC
Thanks Miguel :-)



I have given up .. waiting for PB to hopefully enhance the title bar just like the MS Office apps.
  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.