Page 1 of 1

<WindowName>.Center

Posted: Fri Mar 27, 2015 6:38 pm
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.

Re: <WindowName>.Center

Posted: Sat Mar 28, 2015 4:10 am
by srvet_claudio
I will check this function.

The difference between: GetSystemMetrics(SM_CYSCREEN) - SystemParametersInfo (SPI_GETWORKAREA) = taskbar height

<WindowName>.Center

Posted: Sat Mar 28, 2015 2:03 pm
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.