Drag drop object di visual foxpro

Lagi ga ada kerjaan🙂, mending main vfp aja😀 siapa tau ada duitnya, ok langsung aja, cara drag drop objec di visual foxpro dan menyimpan lokasi terakhir di drag,

pertama, bikin form terlabih dulu desainnya kaya gini

Capture

terdiri dari container,shape, label, checkbox dan commandbutton,Ok

kedua, bikin tabel nama obj.dbf

Capture

ketiga, tambahkan property ndrag,xoffset,yoffset di form tadi

Capture

keempat, sintax setiap object

+ commandbutton.click


SELECT obj
DELETE ALL
PACK

lcNmObj=ALLTRIM(thisform.container1.Name)
lcLeftObj=thisform.container1.Left
lcTopObj=thisform.container1.Top

lcNmObj2=ALLTRIM(thisform.container2.Name)
lcLeftObj2=thisform.container2.Left
lcTopObj2=thisform.container2.Top

SELECT obj
INSERT INTO Obj(NmObj,LeftObj,TopObj);
values(lcNmObj,lcLeftObj,lcTopObj)
INSERT INTO Obj(NmObj,LeftObj,TopObj);
values(lcNmObj2,lcLeftObj2,lcTopObj2)

+ checkbox.click


IF this.Value=1
thisform.ndrag=0
ELSE
thisform.ndrag=1
ENDIF

form.dragdrop


oSource.Left = nXCoord - THISFORM.XOffset
oSource.Top = nYCoord - THISFORM.YOffset

form.init


SELECT Obj
SCAN
lcNmObj=ALLTRIM(NmObj)
lcTopObj=TopObj
lcLeftObj=LeftObj

thisform.&lcNmObj..top=lcTopObj
thisform.&lcNmObj..Left=lcLeftObj
ENDSCAN

container1.dragdrop


THIS.Parent.DragDrop(oSource, nXCoord, nYCoord)

container1.mouseleave

this.MousePointer= 0

container1.mousemove


IF thisform.ndrag=0
this.MousePointer= 15
ENDIF

IF nButton = 1 && Left button
THISFORM.XOffset = nXCoord - THIS.Left
THISFORM.YOffset = nYCoord - THIS.Top
IF thisform.ndrag=0
THIS.Drag
ENDIF
ENDIF

untuk container2 itu sama saja eventnya dengan container1 tinggal copas aja, ok coba deh dirun

  • sebelum di drag drop

Capture

  • object di drag drop

Capture

tekan save, dan coba run lagi

Capture

gimana ke save kan😀, yaa siapa tau berguna buat drag drop meja

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: