1. Brage Mogstad
  2. PowerBuilder
  3. Wednesday, 23 August 2023 14:47 PM UTC

Hello,
I was thinking of implementing the ribbonbar control to modernize the MDI app.
But I can't find any easy way to get rid of the title bar(!!)
Space is always a big issue, and so far I've managed to remove the app menu and the toolbar menu (enclosed image)
<m_menuitemname>.visible = false //on menu items totally removed the mdi menu from the frame window)
this.ToolbarVisible = False //removed the toolbar from the frame window.

The functionality needed to minimize, maximize, or close the app can be added in the ribbonbar.

Searched the forum, but there's really nowhere to describe how to resolve the matter.
Some C/C++ code is suggested, but really no working example and those cases remain unresolved.
Does anyone have any suggestions on how to remove the titlebar on the frame in an MDI app?

 

The boolean titlebar = false in my test MDI app regrettably didn't do the trick either.

global type w_ribapp_frame from window
integer x = 256
integer y = 132
integer width = 2382
integer height = 1548
string menuname = "m_ribapp_frame"
boolean border = false
boolean titlebar = false
windowtype windowtype = mdihelp!
windowstate windowstate = maximized!
long backcolor = 79416533
event type integer ue_new ( readonly string as_sheetname )
event type integer ue_open ( )
event ue_postopen ( )
event type integer ue_close ( )
event type integer ue_print ( )
event type integer ue_print_query ( )
mdi_1 mdi_1
end type
global w_ribapp_frame w_ribapp_frame

Regards
Brage Mogstad

 

Attachments (1)
Accepted Answer
Brage Mogstad Accepted Answer Pending Moderation
  1. Thursday, 24 August 2023 13:43 PM UTC
  2. PowerBuilder
  3. # Permalink

Thanks, 
Benjamin, you solved this perfectly with your last piece of the puzzle!
There's still some matters to resolve, like how to move the frame window, that I'm planning to solve today in the mousemove event of a transparent dw control placed on top of the ribbonbar menu & add those minimize, maximize, close button to the ribboinbar menu.

Some code for inspiration on how to replace old toolbar & titlebar meny of w_frame with Ribbonbar:
w_frame:
Put a rbb_1 control on top of the frame.

Instance variables:
CONSTANT long WS_VISIBLE = 268435456
/* Uncomment for non-pfc apps
CONSTANT int GWL_STYLE = -16
CONSTANT LONG WS_THICKFRAME = 262144
CONSTANT ulong WS_THICKFRAME = 262144
CONSTANT ulong WS_MINIMIZEBOX = 65536
constant long SWP_NOMOVE = 2
constant long SWP_NOSIZE = 1
constant long SWP_NOZORDER = 4
constant long SWP_FRAMECHANGED = 32
*/

Local external functions:
function long GetWindowLongW (long hWindow, integer nIndex) Library "user32.dll"
function long SetWindowLongW (long hWindow, integer nIndex, long dwNewLong) library "user32.dll"
FUNCTION Long SetWindowPos (Long hWnd, Long m, Long nleft, Long ntop, Long nwidth, Long nheight, Long flags) Library "USER32.dll"

constructor event of rbb_1:
try
lul_hwnd = handle(PARENT)
lul_style = GetWindowLongW(lul_hwnd, GWL_STYLE)
SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)

lul_style = GetWindowLongW(lul_hwnd, WS_VISIBLE)
SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)

lul_style = WS_VISIBLE + WS_THICKFRAME
SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)
SetWindowPos( lul_hwnd, lul_hwnd, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_NOZORDER + SWP_FRAMECHANGED )
catch(throwable tw1)
messagebox("Error","That could have gone smoother")
end try

open event of w_frame:
this.ToolbarVisible = False
string ls_setting
//default file as saved from Ribbonbar builder
ls_setting = 'XmlFile1.xml'
ll_ret = rbb_1.ImportFromXMLFile (ls_setting)
//Edit XML file as you like in Tools RibbonbarBuilder
//Have a look at enclosed Graph example app for coding the ribbonbar

Thats just so cool, thanks!

 Regards
Brage




Attachments (3)
Comment
There are no comments made yet.
Brage Mogstad Accepted Answer Pending Moderation
  1. Wednesday, 23 August 2023 16:46 PM UTC
  2. PowerBuilder
  3. # 1

I'm a fish out of water on this, but the window can't be created, right,
This code did remove the top titlebar of w_frame, then again now I cant move or resize the window.
Any ideas on how to make resize & move window work?

In source of w_frame add some constants:
type variables
n_ribapp_sheetmanager inv_sheetmgt
CONSTANT int GWL_STYLE = -16
CONSTANT long WS_VISIBLE = 268435456
end variables

In constructor event of rbb_1 (ribbonbar) thats on w_frame.
ULong lul_hwnd, lul_style

lul_hwnd = handle(PARENT)
lul_style = GetWindowLongW(lul_hwnd, GWL_STYLE)

SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)

lul_style = GetWindowLongW(lul_hwnd, WS_VISIBLE)
SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)


Regards
Brage

Attachments (1)
Comment
  1. Benjamin Gaesslein
  2. Thursday, 24 August 2023 10:38 AM UTC
PS: to add a resize border, you can add WS_THICKFRAME to the style. But to make that stick, you have to call SetWindowPos afterwards. SetWindowPos declaration goes like this:

function boolean SetWindowPos(unsignedLong hWnd, unsignedLong hWndInsertAfter, Integer iX, Integer iY, Integer cx, Integer cy, unsignedLong uFlags) LIBRARY "user32.dll"



Changing the window style:



CONSTANT int GWL_STYLE = -16

CONSTANT LONG WS_THICKFRAME = 262144

CONSTANT long WS_VISIBLE = 268435456



constant long SWP_NOMOVE = 2

constant long SWP_NOSIZE = 1

constant long SWP_NOZORDER = 4

constant long SWP_FRAMECHANGED = 32



ulong lul_hwnd

ulong lul_style



lul_hwnd = handle(PARENT)

lul_style = WS_VISIBLE + WS_THICKFRAME

SetWindowLongW(lul_hwnd, GWL_STYLE, lul_style)

SetWindowPos( lul_hwnd, lul_hwnd, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_NOZORDER + SWP_FRAMECHANGED )
  1. Helpful 2
  1. Miguel Leeuwe
  2. Thursday, 24 August 2023 12:03 PM UTC
That's great stuff Benjamin, just one remark: the hWnd should be of type LongPtr if I'm not mistaken.

regards.
  1. Helpful
  1. Brage Mogstad
  2. Thursday, 24 August 2023 13:46 PM UTC
Benjamin,

I give you the credit & enclosed some code in a comment I set as the accepted answer



Regards

Brage
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 23 August 2023 15:17 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Brage -

I don't believe this is possible in a PB application, but it would be great for someone to prove me wrong.

The presence/absence of a title bar (Windows calls this a "caption") is controlled by Window Style bit flags, but this has to be set when the window is created/instantiated:

    https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles

Here's the critical issue, taken from the web page at the above URL:

Since PB controls the creation of every window in an application, I don't know of any way for you to override or otherwise change this behavior. This would have to be an enhancement added to PB by Appeon Engineering.

Best regards, John

Comment
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.