Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing Buttons from a form
Message
De
03/05/2005 12:37:46
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01010513
Message ID:
01010521
Vues:
18
Hello,

"I have a form where I create buttons using CreatObject"

mhh sounds strange .. sure you aren't using THISFORM.AddObject()?

if the buttons are added to the form, run this form anywhere in your form
&& since the variable implicitly declared in the FOR clause is PUBLIC
&& by default (don't ask me why .. design bug in my opinion) i'll always
&& declare counter variables to be local
&& if you'll always use the same name for counter variables like i do
&& you may get hit with bugs .. since a FOR loop somewhere down the stack
&& might change the wrong counter variable (i've learned this the hard way..)

LOCAL lnFor, lcButton

FOR lnFor = 1 TO NoOfButtonsFromSomeWhere
 lcButton = 'BUT_' + ALLTRIM(STR(lnFor))
 IF PEMSTATUS(THISFORM,lcButton,5) && returns true if THISFORM.BUT_X exists
  THISFORM.RemoveObject(lcButton)
 ENDIF
ENDFOR
Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform