Custom controls on the VFP toolbar

[Visual FoxPro toolbar showing custom controls] One of the great strengths of the object-oriented features that were introduced in Visual Foxpro is the way that you can so easily subclass the base controls and build your own class library of custom controls. Usually you will have this class library in the Classes tab of the Project Manager and you will drag the class from there to the Form Designer in order to add that control to the form.

Sometimes though this is inconvenient or just not possible. Perhaps you want to replace all the buttons on the standard toolbar with your own controls in order to enforce a standard look and feel across the application without having to alter all the controls one by one. Perhaps you want to add one of your controls to a grid in place of the standard textbox. It's not possible to drag-and-drop from a VFP class library into the columns of a grid, you have to select a control from the toolbar.

Adding your own class library to the standard FoxPro Form Controls toolbar solves problems like these and it's a straightforward operation.

[Add custom controls to the VFP Form Controls toolbar] Use the View Classes button on the Form Controls toolbar:

  • Select Add from the menu that drops down.
  • A file selection dialog will appear showing the VFP visual class libraries. These are held on disk in dbf format as .vcx and .vct files.
  • Navigate to your class library and click the Open button to display the classes from this library on the toolbar.

The screenshot at the top of the page shows part of the toolbar for one of our libraries. It replicates all the standard controls (with some modifications) but the tooltip shows that it also includes a new cmdClose button.






Related Items

Custom Toolbars

VBA code to add custom toolbars to an Access database.

Read More

Custom Toolbars - Page 2

Adding custom toolbars to an Access database.

Read More

Access custom toolbars

Adding custom toolbars to a Microsoft Access database application.

Read More

Access CommandBarButtons

Access VBA constants for CommandBarButtons in a toolbar.

Read More

Images and Object Frames

Image controls and object frames on Microsoft Access forms.

Read More