<WindowName>.Center

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

<WindowName>.Center

Post by Pablo César »

Hi Claudio,

I have found difference to use C_CENTER function specially when I try with GETDESKTOPREAL at maximum size.

Difference exists at y = GetSystemMetrics(SM_CYSCREEN) thru taking rect by GetWindowRect and y = rect.bottom - rect.top thru taking rect by SystemParametersInfo( SPI_GETWORKAREA, 1, &rect, 0 )

Would you agree with this replacement at:

y = GetSystemMetrics(SM_CYSCREEN);

by this:

SystemParametersInfo( SPI_GETWORKAREA, 1, &rect, 0 );
y = rect.bottom - rect.top;

I made this changing and working in properly.

I guess that our actual C_CENTER function is considering the window's title height and do not make the right centralizing.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: <WindowName>.Center

Post by srvet_claudio »

I will check this function.

The difference between: GetSystemMetrics(SM_CYSCREEN) - SystemParametersInfo (SPI_GETWORKAREA) = taskbar height
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

<WindowName>.Center

Post by Pablo César »

srvet_claudio wrote:I will check this function
Thank you Claudio, will be appreciated.
srvet_claudio wrote:The difference between: GetSystemMetrics(SM_CYSCREEN) - SystemParametersInfo (SPI_GETWORKAREA) = taskbar height
Also thank for your info, I forgot to check this because I was without internet during all that morning.

Simple test, you will see the difference.

Code: Select all

#include <hmg.ch>

Function Main()
DEFINE WINDOW Form_1 MAIN ;
    TITLE "Form with GETDESKTOPREAL size  demo"
    
END WINDOW
Form_1.Center
Form_1.Activate
Return Nil
I have already changed and works ok for me.

P.S. Running on Win7 32bits and in classic mode.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply