Thanks for everybody that reply.
Since both dialog's have the same size and are centered, I solved with this:
- Code: Select all Expand view
poDlg:Move( Round( ((GetSysMetrics(1)-poDlg:nHeight)/2),0)-poDlg:nHeight,;
Round( ((GetSysMetrics(0)-poDlg:nWidth) /2),0) )
Enrico Maria Giordano wrote:Samir,
sambomb wrote:I want to change the position of one dialog 130 pixels up, same left position, height, width.
I tried oDlg:Move( oDlg:nTop - 130, oDlg:nLeft, oDlg:nWidth, oDlg:nHeight ) but the dialog don't move properly.
Can I see a reduced and self-contained sample of the problem, please?
EMG
Enrico, this is what I want to do:
I need to call 2 MsgMeter in sequence, so I want to move the first one to stay above the second:
- Code: Select all Expand view
+-----------------------------------+
| First Meter bar |
+-----------------------------------+
+-----------------------------------+
| Second Meter bar | <- Centered in the monitor
+-----------------------------------+
- Code: Select all Expand view
****************************************************************************
static procedure Test2Meter()
****************************************************************************
Local bAction := {| oMeter, oText, oDlg, lEnd | Execute1Step(oDlg) }
MsgMeter(bAction,"First Step","Test dialog movement")
Return Nil
/*------------------------------------------------------------------------*/
****************************************************************************
static procedure Execute1Step(poDlg)
****************************************************************************
Local bAction := {| oMeter, oText, oDlg, lEnd | Execute2Step(oDlg) }
SysWait(1)
oDlg:Move(oDlg:nTop -oDlg:nHeight , oDlg:nLeft)
SysWait(1)
MsgMeter(bAction,"Second Step","Test dialog movement second")
Return Nil
/*------------------------------------------------------------------------*/
****************************************************************************
static procedure Execute2Step(poDlg)
SysWait(10)
Return Nil
/*------------------------------------------------------------------------*/
Jeff Barnes wrote:I use this to move a dialog in my app:
DEFINE DIALOG......
ACTIVATE DIALOG oDlg NOWAIT ON INIT oDlg:Move( WndMain():nTop+110, WndMain():nLeft+760 )
Jeff, I cant move to a position relative to the main window because my clients have different resolutions and I use a centered window.
James Bott wrote:Samir,
Dialogs don't use the same measurement units as windows (see a discussion of this on my website in the article "Introduction to Fivewin.")
The easy solution would be to just move it where you want it to be manually, then read the new dialog coordinates. Otherwise you need to translate the dialog coordinates to windows, then subtract the desired values, then translate them back to dialog units.
Regards,
James
James, I think I ain't using the windows measurement since I use only dialogs(TWindow) properties oDlg:Move( oDlg:nTop - oDlg:nHeight, oDlg:nLeft )
I can't just move and take coordinates because I have clients with a lot of different resolutions and the coordinates will change to each client.
How to translate coordinates?
ukoenig wrote:Jeff,
I created a nice test.
Maybe it will help.
1. a dialog on the right-hand-side, designed as a buttonbar
on window-resize it keeps the position
2. Another dialog to add
testing window resize and MOVE-function
Download
http://www.pflegeplus.com/fw_downloads/move1.zip
I'll test soon.