Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Command buttons with code programatically
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00999180
Message ID:
00999182
Views:
37
Create a subclass of a "commandbutton"...
Create a custom property on that class for retaining the "MyGroup" value you are interested in... Then, in the CLICK event, have your default code referring to the custom property...
define classs myButtonClass as CommandButton
   cMyGroup = ""   && your custom property

   function click
      select * from MyStockFile where Stock_Group = This.cMyGroup
   endfunc


enddefine
Then, when you dynamically add the buttons to the form, be sure to set this property corresponding to your group
   select distinct Stock_Group from MyStockFile into cursor C_Temp

   select C_Temp
   scan
      lcBtn = "Btn" + allt( str( recno( "C_Temp" )))
      Thisform.AddObject( lcBtn, "MyButtonClass" )
      WITH Thisform.&lcBtn
         .cMyGroup = C_Temp.Stock_Group
      ENDWITH
   endscan
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform