**********************
* METODOS DE USUSARIO
**********************
* --------------
* GETBIND
* --------------
FOR EACH ocontrol IN thisform.Controls
IF UPPER(ocontrol.baseclass)="IMAGE"
UNBINDEVENTS(OCONTROL)
BINDEVENT(ocontrol,"MouseMove",thisform,"movimage")
BINDEVENT(oControl,"RightClick",thisform,"getcopia")
ENDIF
ENDFOR
* ----------------
* GETCOPIA
* ----------------
nEvents=AEVENTS(gaEvent,0)
IF nEvents=0
RETURN
ENDIF
obj=gaEvent[1]
thisform.MousePointer=5
Thisform.imasel=obj.picture
Thisform.copia=.t.
* ---------------
* MOVIMAGE
*-----------------
LPARAMETERS nButton, nShift, nXCoord, nYCoord
nEvents=AEVENTS(gaEvent,0)
IF nEvents=0
RETURN
ENDIF
obj=gaEvent[1]
IF nbutton=1
WITH obj
.left=nxCoord
.top=nyCoord
ENDWITH
ENDIF
*--------------------------------------------
* METODOS DEL FORMULARIO (NATIVOS)
***********************************
* MOUSEDOWN
* -----------
LPARAMETERS nButton, nShift, nXCoord, nYCoord
IF nButton=1
IF thisform.copia
thisform.copia=.f.
IF VARTYPE(thisform.nPicture)#"N"
thisform.nPicture=1
else
thisform.nPicture=thisform.nPicture+1
ENDIF
cnew="AddImg"+LTRIM(STR(thisform.nPicture))
thisform.AddObject(cnew,"Image")
obj=thisform.&cnew
WITH obj
.picture=thisform.imasel
.left=nxCoord
.top=nyCoord
.visible=.t.
ENDWITH
thisform.MousePointer=0
thisform.getbind()
ENDIF
endif
* INIT DEL FORMULARIO
* --------------------
IF !FILE("REMPICT.dbf")
CREATE TABLE REMPICT FREE ;
("NOMBRE" C(50),;
"IMACON" C(20),;
"IMAPICT" C(80),;
"IMATOP" I,;
"IMALEFT" I)
ENDIF
IF !USED("REMPICT")
USE REMPICT IN 0 EXCLUSIVE
ENDIF
SELECT REMPICT
DELETE TAG ALL
INDEX ON NOMBRE+IMACON TAG REMPICT
cForm=UPPER(thisform.Name)
nPicture=0
SCAN FOR LEFT(nombre,LEN(cform)+1)==cForm+"/"
cObjeto=ALLTRIM(imacon)
cImagen=ALLTRIM(imapict)
nTop=imatop
nLeft=imaleft
IF !PEMSTATUS(thisform,cObjeto,5)
thisform.NewObject(cObjeto,"Image")
obj=thisform.&cobjeto
WITH obj
.picture=cImagen
.Top=ntop
.left=nleft
.Visible=.t.
ENDWITH
nPicture=nPicture+1
ENDIF
ENDSCAN
ADDPROPERTY(thisform,"Imasel","")
ADDPROPERTY(thisform,"Copia","")
ADDPROPERTY(thisform,"nPicture",nPicture)
Thisform.getBind()
* ---------------------------------------------------------
* UNLOAD DEL FORMULARIO
* ----------------------
IF USED("REMPICT")
SELECT REMPICT
USE
ENDIF
* ---------------------------
* EVENTO CLICK DE UN BOTON (Grabar / Aceptar)
**********************************************
SELECT rempict
ngrab=0
FOR EACH ocontrol IN thisform.Controls
IF UPPER(ocontrol.baseclass)="IMAGE"
cName=UPPER(oControl.name)
cForm=UPPER(thisform.name)
nLeft=oControl.left
nTop=oControl.top
cPicture=ocontrol.picture
cBusca=cForm+"/"+cName+"/"
nGRab=ngrab+1
IF !INDEXSEEK(cBusca,.f.,"REMPICT","REMPICT")
INSERT INTO rempict (nombre,imacon,imapict,imatop,imaleft) ;
values(cBusca,cName,cPicture,ntop,nleft)
ELSE
SELECT REMPICT
INDEXSEEK(cBusca,.t.,"REMPICT","REMPICT")
REPLACE IMATOP WITH NTOP,IMALEFT WITH NLEFT
ENDIF
ENDIF
ENDFOR
thisform.Release