FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MoveWindow()
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
MoveWindow()
Posted: Tue Feb 19, 2013 10:14 PM

Hi,

When using MoveWindow() is there a way to tell it what "window" you want it to base its coordinates on?

My computer screen resolution is set to 1280 x 800. My main window in my program is set to 1024 x 600 (then centered in the screen).
When I use the MoveWindow(oDlg:hWnd,50,50), it places the window based on the whole screen not the main window in my program.

I hope I explained that clearly :)

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: MoveWindow()
Posted: Tue Feb 19, 2013 11:22 PM
Jeff,

Your window is moved to top and left = 50
Sample : a dialog adjusted to a defined window :

#include "FiveWin.ch"

FUNCTION MAIN()

DEFINE WINDOW oWnd FROM 0, 0 TO 600, 1024 TITLE "Window" PIXEL

DEFINE DIALOG oDlg1 size 375, 320 OF oWnd TITLE "Dialog from Code" PIXEL


ACTIVATE DIALOG oDlg1 CENTERED NOWAIT ;
ON INIT oDlg1:Move( 150, 150, , , .T. )

ACTIVATE WINDOW oWnd ;
ON INIT oWnd:Move( 50, 50, , , .T. )

RETURN NIL


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: MoveWindow()
Posted: Wed Feb 20, 2013 12:46 AM

Hi Uwe,

The problem is, I first create a Window (oWnd). Later on in the program I create a Dialog (oDlgTest). There is a button is the Dialog that creates a new Dialog (oDlg).

It is oDlg that I want to place in a certain spot of oWnd. But if I use either oDlg:Move() or MoveWindow() it places oDlg based on the actual computer screen size not based on oWnd. Since all the users will have different screen resolutions I need to move oDlg to an exact place in oWnd.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: MoveWindow()
Posted: Wed Feb 20, 2013 10:38 AM

Define DIALOG with OF WndMain() clause.

If you want to center the dialog with respect to main window, then
ACTIVATE DIALOG oDlg CENTERED IN PARENT .......

If you want to move to a specific row. col with reference to the main window, please try moving to WndMain():nTop + <row>, WndMain():nLeft + <col>

Regards



G. N. Rao.

Hyderabad, India
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: MoveWindow()
Posted: Wed Feb 20, 2013 10:11 PM

Thanks G.N. Rao.
That did exactly what I needed :D

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: MoveWindow()
Posted: Thu Feb 21, 2013 12:05 AM
Jeff,

this little Tool shows moving WINDOWS and DIALOG.
Added a Dialog adjusted to the Main-window and used as Buttonbar.
Change Top / Left inside the toolbar and test in realtime.

Download ( source included ) :
http://www.pflegeplus.com/fw_downloads/dlgmove1.zip

Windows Top / Left from screen and Dialog Top / Left from Main-window



Result on Window-resize < Dialog adjusted to Window-size ( right position )



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion