Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo box
Message
De
07/08/2001 16:45:50
 
 
À
07/08/2001 16:28:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Divers
Thread ID:
00540953
Message ID:
00540965
Vues:
20
>Hi,
>
>I have a form where I dynamically create some combo boxes using the createobject() function. Anyways, I know how to set the properties of the dynamically created combo box but is there a way I can write some code for the InteractiveChange event?
>
>Thanks,
>Chris

First: are you using createobject()? You should be using form.NewObject() or form.AddObject() for this, or you won't get a combobox that you can see.

As to custom IAC code at runtime. No can do.
Code can only be created at design time.
However, with VFP6 sp3 and up you can create a class for it and COMPILE at run time. You can create the IAC code this way.
e.g.,
#Define CR Chr(13)
lcCode = "Define Class myCombo1 As combobox"+CR
lcCode = lcCode + " Procedure InteractiveChange"+CR
lcCode = lcCode + "   Wait Window this.value" +CR && here's where the custom stuff goes
lcCode = lcCode + " EndProc" +CR
lcCode = lcCode + "EndDefine"+CR
lcFile = "comboclass1.prg"
StrToFile(lcCode, lcFile)
Compile (lcFile)
thisform.NewObject("cboOne", "mycombo1", "comboclass1.prg")
With thisform.cboOne
     .top = 10    && or wherever
     .left = 10   && or wherever
     .RowSourceType = 1
     .RowSource = "one,two,three"
     .visible = .T.
EndWith
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform