Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to write a builder that will use custom classes
Message
From
17/08/2001 17:55:58
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00545610
Message ID:
00545722
Views:
14
This message has been marked as the solution to the initial question of the thread.
>I am trying to write a simple builder that will add a label and text box to a form. The label and text box are in custom classes in .VCX files. I have written a number of tool programs to help me in the layout and cleanup of forms but they all work with objects that were already on the form. I tried using addobject() but it will only add objects based on the FoxPro base classes and it also does not return a reference to the newly created object (although I could do a new aselobj() and find the new name if I had to).
>
>I'm sure there is a fuction to do all this but I can't seem to find it. Any help would be greatly appreciated.

You should be able to addobject() as soon as you've Set Classlib To whatever class library you need. Or you could NewObject() with specifying the class library name.

As to the reference, you can create one on the fly:
=aselobj(aa, 1)  && the form itself
with aa[1]
   .addobject('oThing','Things','Things.vcx')
   loThing=eval('.oThing')
endwith
Now loThing should be a reference to the new object in the form you're editing, and you can pretty much do with it whatever you like.

I haven't tested this, though, but I figure a three-liner can't be too hard. I'm not writing registrable builders anymore, I simply call them from the command window while editing something. It's just easier and faster that way - most of these 'builders' are just few lines long, and would easily clutter the tiny listbox you get when you select the Builder from the shortcut menu. Besides, just making reasonable names for them is too much of a hassle, and registering them would be too much :)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform