MoveWindow()

MoveWindow()

Postby Jeff Barnes » 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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: MoveWindow()

Postby ukoenig » 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: MoveWindow()

Postby Jeff Barnes » 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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: MoveWindow()

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MoveWindow()

Postby Jeff Barnes » 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)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: MoveWindow()

Postby ukoenig » 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

Image

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

Image

Best Regards
Uwe :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 14 guests