Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MyLabel
Message
De
27/04/2005 03:12:11
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
MyLabel
Divers
Thread ID:
01008730
Message ID:
01008730
Vues:
56
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform