Page 1 of 1

dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 2:15 am
by ShumingWang
hi,
define dialog odlg
ntop:=myrestorentop()
nleft:=myrestorenleft()
nbottom:=myrestorenleft()
nright:=myrestorenright()

activate dialog odlg ;
on init (odlg:move(ntop,nleft,nright-nleft,nbottom-ntop));
valid (mysave( odlg:ntop,odlg:nleft,odlg:nbottom,odlg:nright),.t.)

The dialg position moves some rows up, why ?

Regrads!
Shuming Wang

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 7:42 am
by Antonio Linares
Shuming,

Try doing this:

odlg:Move( nTop, nLeft, nRight - nLeft + 1, nBottom - nTop + 1 )

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 10:11 am
by ShumingWang
Still can not move to the proper postion .

odlg:ntop:=240
odlg:nleft:=2
odlg:nbottom:=678
odlg:nright:=548

@1,2 BUTTON "aaa" OF odlg ACTION msginfo(cvaltochar(odlg:ntop)+","+cvaltochar(odlg:nleft)+","+cvaltochar(odlg:nbottom)+","+cvaltochar(odlg:nright))

// result : 191,-1,665,555 ,not 240,2,678,548

shuming Wang

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 11:23 am
by Antonio Linares
Shuming,

dialogs use "units" not pixels, so if you want to set the exact position move them from the ON INIT clause of the dialog

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 11:43 am
by ShumingWang
on init odlg:move() can't move to the proper postion.
odlg:Move( nTop, nLeft, nRight - nLeft + 1, nBottom - nTop + 1 )
Each time dialog moves more top .

Shuming Wang

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 11:52 am
by Antonio Linares
Have you tried ?

odlg:Move( nTop - 1, nLeft, nRight - nLeft + 1, nBottom - nTop + 1 )

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 12:52 pm
by ShumingWang
still move and move.
Shuming Wang

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sat Nov 01, 2014 1:20 pm
by Antonio Linares
Shuming,

Just to the top or to the left too ?

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Sun Nov 02, 2014 8:52 am
by CharlesKwon
In my case, I use GetRect() method for save a pre-postions.

Re: dialog:move( ntop,nleft,nwidth,nheight)

Posted: Mon Nov 03, 2014 2:06 am
by ShumingWang
Thank Antonio and CharlesKwon!
GetWndRect(odlg:hwnd) can be used to save the postion, while saving odlg:ntop,odlg:nleft,.. no use.

ACTIVATE DIALOG oDlg
on INIT (odlg:move(ntop1,nleft1,nright1-nleft1+1,nbottom1-ntop1+1),.t.)
VALID (arect:=GetWndRect(odlg:hwnd),;
oserver:query("insert into browseset (id,cvalue) ;
values ('sub0804','"+cvaltochar(arect[1])+","+cvaltochar(arect[2])+","+cvaltochar(arect[3])+","+cvaltochar(arect[4])+",') ;
on duplicate key update cvalue='"+cvaltochar(arect[1])+","+cvaltochar(arect[2])+","+cvaltochar(arect[3])+","+cvaltochar(arect[4])+",'"),.t.)

Shuming wang