Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding objects
Message
From
08/04/2003 03:23:14
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
07/04/2003 17:28:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00774920
Message ID:
00775006
Views:
17
>I have been trying to add command buttons to a form on the fly. I have the command button names in a table and want the form to create the buttons.
>Problem: How do I tell the click event what I want it to do. I am trying to do this inside the form and it will not allow me to set information to the click. Any ideas?
>Thanks

Michael,
Define a command button that'd call an external program. ie:
*Add button on the fly
thisform.NewObject('onthefly','myCommandButton','mybutton.prg')
with thisform.onthefly
  .tag = sys(2015)
  set textmerge to (.tag+'.prg') noshow
  set textmerge on
    \lparameters toForm
    \wait window toForm.Name
  set textmerge to
  set textmerge off
  compile (.tag+'.prg')
endwith

* MyButton.prg
define class myCommandButton as CommandButton
procedure Click
 do (this.tag) with thisform
endproc
procedure destroy
 erase (this.tag+'.*')
endproc
enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform