Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create class of just controls
Message
From
22/10/2004 18:02:39
 
 
To
22/10/2004 15:28:13
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00953797
Message ID:
00953900
Views:
17
one thing you can play around with if you want to make this generic but flexible is to have methods that create the controls with addobject but have properties of the container that say whether or not the object gets added. Then you instantiate the contained object according to the container's masterprops.

Drop the container on and set props for which contained elements you are using. You can even have props for locations or which order they'll be in


>Yeh, I found that out already! Thanks Alex. I had forgotten all of that until I created a new one using this method.
>
>
>>>Pardon my Friday ignorance, but I want to create a class and then start creating controls and adding the controls to the class one by one. For instance let's say you have some common values:
>>>
>>>Name
>>>Address1
>>>Address2
>>>City
>>>State
>>>Zip
>>>Phone
>>>
>>>I want to create 7 textboxes for these values and store each of them as a class so that I can drop all 7 on a form later. Then I change the attributes of them and have it take effect everywhere those special textboxes are used.

>>
>>I see you have it. That is a Composite Class that you can drop anywhere and reuse. Just be aware of some problems with Composite Classes. They controls in them are tightly coupled. If you happen not to need one of them (say you do not need phone or fax in one instance), VFP will not let you delete it from the instance of class. You will have to make it invisible atruntime so the user will never know it's there but you are still carrying the baggage. Also all the controls beter be subclassed from the same VCX, else you'd be always loading more than one extra classes into your project.
>>
>>HTH


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Reply
Map
View

Click here to load this message in the networking platform