Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MyLabel
Message
From
27/04/2005 03:12:11
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
MyLabel
Miscellaneous
Thread ID:
01008730
Message ID:
01008730
Views:
57
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
Map
View

Click here to load this message in the networking platform