Click to See Complete Forum and Search --> : Property sheets moving buttons, Why this don't works ?


Braulio
May 6th, 1999, 07:29 AM
Hi,

I have one property sheet wit only one button ( Ok button), and I want to move it to the right ( put it in the help button position), I have make a little test with this:

CRect rectBtn;

pOkButton->GetWindowRect(rectBtn);
rectBtn.left = rectBtn.left+5;
rectBtn.right = rectBtn.right+5;
pOkButton->MoveWindow(rectBtn);

But then when the property sheet is shown, the button is not shown !, What have I made wrong ? Is another way to do it easier ?

Thanks, Bye !
Braulio

BrianOG
May 6th, 1999, 08:44 AM
GetWindowRect returns screen coordinates.
MoveWindow expects coordinates relative to the parent window.

You are actually moving the button off the property sheet.

After calling GetWindowRect, call ScreenToClient.. like this:CRect rectBtn;

pOkButton->GetWindowRect(rectBtn);


ScreenToClient(&rectBtn);


rectBtn.left = rectBtn.left+5;
rectBtn.right = rectBtn.right+5;
pOkButton->MoveWindow(rectBtn);


Rgds,
Brian