FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dialog Centering
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Dialog Centering
Posted: Wed Oct 10, 2007 10:03 PM

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Dialog Centering
Posted: Wed Oct 10, 2007 10:16 PM

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.)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Dialog Centering
Posted: Wed Oct 10, 2007 10:38 PM

This works

ACTIVATE DIALOG oDlg ON INIT oDlg:center(oWndMain)

Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Dialog Centering
Posted: Thu Oct 11, 2007 12:25 AM

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.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Thanks
Posted: Thu Oct 11, 2007 02:33 AM

It works fine ... oh for some documentation !

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit

Continue the discussion