Page 1 of 1

Dialog Centering

Posted: Wed Oct 10, 2007 10:03 pm
by TimStone
I am curious about centering dialogs in the primary window. I open the program with a Window oWnd. Then, I create dialogs OF oWnd. The window takes up the whole monitor ( wide angle ) and the dialogs are activated CENTERED. This is fine until I reduce the size of the window. The dialogs still center on the screen and not the window area.

I would think that the OF oWnd would translate to centering the dialog on the window area of the opening program. Why not ? Is there a way around this ?

Thanks.

Posted: Wed Oct 10, 2007 10:16 pm
by Otto
Tim,
maybe you can use resize?
Regards,
Otto

ACTIVATE WINDOW oWnd
ON RESIZE ( ;
oLbxl:nTop := oWndt:nHeight()- 280 ,;
oSay:nLeft := oWnd:nWidth() - 240,;
cCbx:nLeft := oWnd:nWidth() - 130) VALID (oWnd:=NIL, .T.)

Posted: Wed Oct 10, 2007 10:38 pm
by nageswaragunupudi
This works

ACTIVATE DIALOG oDlg ON INIT oDlg:center(oWndMain)

Posted: Thu Oct 11, 2007 12:25 am
by James Bott
Note that wndMain() always returns the main window object so you never need to pass it around as a parameter. So you can do:

ACTIVATE DIALOG oDlg ON INIT oDlg:center( wndMain() )

instead.

Thanks

Posted: Thu Oct 11, 2007 2:33 am
by TimStone
It works fine ... oh for some documentation !