Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing Buttons from a form
Message
From
03/05/2005 12:37:46
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01010513
Message ID:
01010521
Views:
17
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform