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

Post Reply
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

Shuming,

Try doing this:

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

Antonio Linares
www.fivetechsoft.com
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

Have you tried ?

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

Antonio Linares
www.fivetechsoft.com
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post by ShumingWang »

still move and move.
Shuming Wang
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

Shuming,

Just to the top or to the left too ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
CharlesKwon
Posts: 6
Joined: Sun Nov 02, 2014 7:03 am

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

Post by CharlesKwon »

In my case, I use GetRect() method for save a pre-postions.
ShumingWang
Posts: 454
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

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

Post 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
Post Reply