Dialog Centering

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Dialog Centering

Post 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.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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.)
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

This works

ACTIVATE DIALOG oDlg ON INIT oDlg:center(oWndMain)
Regards

G. N. Rao.
Hyderabad, India
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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.
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Thanks

Post by TimStone »

It works fine ... oh for some documentation !
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply