Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically creating objects
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01016598
Message ID:
01016610
Vues:
15
This message has been marked as the solution to the initial question of the thread.
Hi Denis,

You can create general label class:
*form:init()
for lnI = 1 to thisform.Something
   for lnJ = 1 to thisform.SomethingElse
      lcNom_lbl = "lbl_rv_" + alltrim( str( lnI)) + "_" + alltrim( str( lnJ))
      lcAddObject = "thisform.AddObject( '" + lcNom_lbl + "', '_xlabel')"
      &lcAddObject
   endfor
endfor

*form:label_Click()
LPARAM oLabel
?oLabel.name


* new class
define class _xlabel as label
   cHookClick="Thisform.label_Click(This)

   procedure Click()
      =IIF(EMPTY(cHookClick),.T.,EVAL(This.cHookClick))
   endproc
enddefine
MartinJ

>>>I create labels dynamically on my form (in LOAD). Everything works well doing that but now I want to add the code related to the events (Click) within each of the created labels.
>>>
>>>What should I do now?
>>What is the code you are using to create the labels? you should be able to add methods the same way you do properties.
>
>Here's an extract of the code
>
>
>for lnI = 1 to thisform.Something
>   for lnJ = 1 to thisform.SomethingElse
>      lcNom_lbl = "lbl_rv_" + alltrim( str( lnI)) + "_" + alltrim( str( lnJ))
>
>      lcAddObject = "thisform.AddObject( '" + lcNom_lbl + "', 'label')"
>      &lcAddObject
>   endfor
>endfor
>
>
>So for each label I'd like to add the "Procedure Click" that goes with it
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform