Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 877 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
maximize window problem #290355
09/18/09 16:15
09/18/09 16:15
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
GS 7.801 Pro
Windows Vista

I want a resizeable window with a maximize button so I am using:
Code:
video_window(NULL, NULL, 4+16+32+64+128, 0);



I've defined:
Code:
on_maximize = MaximizeEvent;
on_resize = ResizeEvent;
function ResizeEvent(){
   RECT r;
   GetClientRect(hWnd,&r); 
   video_set(r.right,r.bottom,0,0); 
}

function MaximizeEvent(){
   RECT r;
   GetClientRect(hWnd,&r); 
   video_set(r.right,r.bottom,0,0); 
}



The window is resizeable, maximizeable, and automatically adjusts resolution correctly. The problem is, with multiple monitors, it does not maximize correctly on the primary monitor. A little bit of the border hangs over to the secondary monitor. The overhanging border does not occur without the thick resizeable border:
Code:
video_window(NULL, NULL, 16+32+64+128, 0);



I've noticed that the overhanging border only occurs when maximized on the primary monitor when the start bar is in a horizontal configuration on the primary monitor. Even if the start bar is on the secondary monitor, there is no border overhanging problem maximizing on the secondary monitor

I tried removing the resizeable border in the MaximizeEvent function, but that unmaximizes the window.

Also there is a problem of maximizing the window on a window that has negative coordinates as I've posted earlier that jcl said he would look in to.


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: maximize window problem [Re: yorisimo] #290896
09/22/09 08:15
09/22/09 08:15
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I think this is by design. Maximize maximizes the client area to the current monitor resolution. Because the window is larger than the client area, the extra border is visible on a second monitor. This won't happen when you make the window borderless on maximizing, or when you have a single monitor system. Otherwise, resize the window in the on_maximize event so that the window size itself, and not the client area, gets the monitor resolution.

Re: maximize window problem [Re: jcl] #290983
09/22/09 18:32
09/22/09 18:32
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
OK, I simply added code to the OnMaximizeEvent and OnResizeEvent to remove and restore the sizing border when maximizing and restoring so it works nicely now:

Code:
function OnResizeEvent(){
   RECT r;
   //Replace the sizing border
   video_window(NULL, NULL, 4+16+32+64+128, 0); 
   GetClientRect(hWnd,&r); 
   video_set(r.right,r.bottom,0,0); 
}

function OnMaximizeEvent(){
   RECT r;
   //Remove the sizing border without using video_window and set to open maximized
   SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_MAXIMIZE);
   //Activate the last change from above
   SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); 
   GetClientRect(hWnd,&r); 
   video_set(r.right,r.bottom,0,0); 
}




Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1