Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Two problems when dealing with container based classes
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00734115
Message ID:
00734888
Views:
18
>>In regards to your second question. Do you load your data in the INIT or LOAD of the form? I load all of my data in the LOAD of the form, that way when the objects are created in the INIT of the form, the data already exists. ControlSources don't like it if the data doesn't exist.
>
>Technically, neither. :) I load an empty data object in the load. But that really doesn't have anything to do with my problem...
>
>>I rarely use a special "ControlSource" property on containers, but when I do, the container object handles everything from there.
>
>I don't like having to drill down into different parts of my container objects. I prefer a pseudo "black box".
>
>Michelle

Michelle;

Composite classes are something I use but with great care! One way I like to use them when data is involved is this:

1. Create a property for the container to place the source data and field name. You can call in datasource or whatever you wish. So on the container you would place Customer.Company as an example.
cntCompany (property sheet)
datasource Customer.Company 
2. On the Init of the text box I place this code:
local cDatasource
cDatasource = this.parent.datasource
this.controlsource = cDatasource
3. On the Property sheet of the text box I place cDataSource as the ControlSource

There are many ways to do this and again this is only one. I like it as I just have to place the control source on a property of the container and not drill down to the object.

I built a library when VFP 3.0 came out using this concept to hook up to backends like Sybase, Oracle and SQL Server. I was able to knock the socks off any Power Builder developers by simply dropping a composite control or controls on a form, give each container the name of the data source, add the connection string and within fifteen minutes I would have a working form that would retrieve desired data sets.

As you know working with composite classes can be fun in many ways. With the proper forethought they will work well.

By the way all the developers I know in Silicon Valley that created his/her own framework went through the same process it seems. It took each of us three attempts to “get it right”. You learn as you go even with a lot of training and forethought.

I still use my framework as well as commercial frameworks. I decided long ago that I would rather invest in a commercial framework and receive updates as well as have access to user bulletin boards. Drawbacks to creating your own framework are the time required to create, maintain and update as well as "you are the boss"! You have no support team to back you up!

I would rather spend my time with my family and let someone else do the hard work of providing a professional quality framework.

Tom
Previous
Reply
Map
View

Click here to load this message in the networking platform