Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you hide suporting components in an aggregate class

Status
Not open for further replies.

sstamm

Programmer
Jan 13, 2004
16
US
I love to write tools for use in VFP but something that bothers me is that you don't have more control of what is shown on the Form Control toolbar and how it is shown.

For example, when I create a class based on a container it shows up on the toolbar with the container icon... not professional at all!

Another problem is that if I create a class comprised of several other "support" classes ALL the classes appear in the toolbar even though it makes no sense to use any of them directly. There are a few ways to mitigate this but none are clean. If I want to use a single VCX and there are two controls in it and 10 support classes then the user sees 12 buttons on the toolbar even though they can only use two of them.

Anyone have any idea about how to fix either of these problems?

Thanks,

Steve
 
Steve,

when I create a class based on a container it shows up on the toolbar with the container icon

Open the class in the class browser. Right-click on it, and choose Container Icon. Navigate to your choice of icon or bitmap file. Select it. Job's done.

Another problem is that if I create a class comprised of several other "support" classes ALL the classes appear in the toolbar even though it makes no sense to use any of them directly.

The toolbar maps to a VCX file. When you select a VCX, the toolbar will show exactly the classes in that VCX, no more, no less.

If you have VFP 8.0, use the toolbox instead of the toolbar (open if from the Tools menu). You can add any classes you like to the toolbox, and drag them to the form design surface. Much more flexible than the toolbar.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike,

Thanks for the info about the Icon! I didn't know that and that helps a lot.

The problem that I see with the second issue is not with me using the VCX, I wrote them so I know which ones can be used directly and which ones are support components. The problem is when you distribute them noone reads the documentation so you have people writing back complaining because some class in the library doesn't do what they expected and the reason is because they got the wrong one off the ToolBar. A simple flag in the VCX structure telling VFP NOT to display this class in the ToolBar would solve this.

A woraround for this problem is to put all support functions in a seperate VCX but although this works, it isn't foolproof either...

Thanks again

Steve
 
Steve,

I take your point about distributing the VCX, and I'm not sure what the best answer is. However, you say that no-one reads the documentation. But if a developer doesn't even know which classes he can use and which ones should be left alone ... well, he can hardly complain if things go wrong. I know that doesn't help much ...

M ike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Have you tried creating a CustomControl instead of a Container? The additional controls become members of the host custom control. You can't drill down to the member controls, but you can provide PEMs on the CustomControl to do things that you need.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
The problem is when you distribute them noone reads the documentation so you have people writing back complaining because some class in the library doesn't do what they expected and the reason is because they got the wrong one off the ToolBar.

You can simply split your classes between two VCX's: One that contains the Design-time classes, and one that contains the support classes.

Already we have to use 2 files for a VCX (the .VCX and the .VCT), so there's no big deal in having 4 total files for a group of classes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top