Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which object has been "clicked" 1

Status
Not open for further replies.

Rogy

Programmer
Nov 20, 2002
43
0
0
SI
I assigned a code to a click event of an object which I create programmaticaly. This object is a picture. There can be up to 6 of this objects.
Code:
.
.
.
thisform.AddObject(i_pic,"Image")
    WITH EVALUATE([thisform.]+i_pic)
        .visible = .T.
        .width= 84
        .height= 84
        .stretch= 1
        .top= thisform.k_image.top
        .left= thisform.k_image.left+90
        .Picture = AllTrim(mPath) 
        .name = i_pic
        ENDWITH
BINDEVENT(EVALUATE([thisform.]+i_pic),[Click],thisform,[PictureClick])
.
.
.
How can I determine (in the PictureClick evnet), which object has been clicked? VFP seems to remeber the name, only of last object.
Any ideas?
 
THISFORM.ActiveControl

--or--

in control.gotfocus save the object reference or object name into user defined property of the form

--or--

in control.click save the object reference or object name into user defined property of the form (only if you use such parameters of BINDEVENTS, where method of the control run earlier as bind-method)
 

I have tried with THISFORM.ActiveControl and AEVENTS() but still can't get the name of the object (which has been clicked)
 
Code:
AEVENTS(laEvents, 0)
IF PEMSTATUS(laEvents[1,1],[Name],5)
   WAIT WINDOW laEvents[1,1].Name
ENDIF


Borislav Borissov
 
It works!

I've put Borislav's code in the Pictureclick event:
Code:
AEVENTS(laEvents, 0)
IF PEMSTATUS(laEvents[1,1],[Name],5)
   obj_name=laEvents[1,1].Name
   thisform.x_textbox1.Value=EVALUATE("thisform."+obj_name+".tag")
   thisform.x_textbox1.Valid   
ENDIF
A star for you!

Thank you all for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top