Hi,
Problem: I want to dynamically add a number of n Labels on a form and each label has to do something when I press the rightclick on each of them.
So I wrote a program (myclass.prg) in which I defined a class called MyLabel:
DEFINE CLASS MyLabel AS Label
PROCEDURE RightClick
MESSAGEBOX('rightclick')
ENDPROC
ENDDEFINE
(I've written the class definition inside a *.prg file because I saw that I can't write a class definition inside a buttonclick event procedure for example.)
In the Load procedure of the form I call the myclass.prg file:
DO myclass
When I press a button on the form I want to add the labels.Button click procedure looks like:
n=10
for i=1 to n
name = 'lab'+ALLTRIM(str(i))
thisform.AddObject(name,'MyLabel')
endfor
The problem is that I get an error "Class definition MyLabel is not found" when I run the application.
Can someone, please, tell me what is wrong or give me another ideea
Thanks
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only