Monday, November 26, 2007

Edit Property/Method Dialog Replacement Available

On Friday, I posted an update for the VFPX New Property/Method Dialog Replacement project that adds a new feature: a replacement for the Edit Property/Method dialog, created by Marcia Akins.

In case you're not familiar with this project, its purpose is to replace the native VFP New and Edit Property/Method dialogs with dialogs that have a lot more functionality. The New dialog has the following features:
  • It automatically updates the _MemberData property (adding that property if necessary) so the case entered for the new member is used (even for access and assign methods if they're created as well) and the member is displayed on the Favorites tab if that option is turned on in the dialog.
  • It's non-modal. That means you can keep it open, add some properties or methods, switch to other things, come back, and add some more members.
  • How many times have you accidentally selected the wrong dialog, entered the name and description, only to realize your mistake and have to close the dialog and start all over? With the replacement dialog, you can switch between Method and Property without closing the dialog.
  • It's dockable: try tab-docking it with Properties window.
  • It's resizable and persists its size and position to your resource (FOXUSER) file.
  • It has an Add & Close button to perform both tasks with one click.
  • The default value for a property is automatically set to a value based on the data type of the property if you use Hungarian names. For example, lTest would be logical, so the default value is .F. For nTest, the default is 0.
  • For logical properties (those with a default value of .T. or .F.), turning on the Use Toggle Editor option installs a property editor that allows you to double-click the property in the Properties window to toggle its value. This property editor is included inside NewPropertyDialog.APP.
  • It hides rather than disables non-applicable controls. Since this one dialog is used for both New Property and New Method for both the Class and Form Designers, some options may not be applicable for a given instance.
  • It disallows invalid names when you enter them rather than when you click on Add or Add & Close.
  • The Add buttons are only enabled if a name is entered.
The Edit dialog has the following features:
  • It automatically selects the chosen member when you right-click a member in the Properties window and choose Edit Property/Method from the shortcut menu.
  • While it's easy to add a member to the Favorites tab of the Properties window (right-click and choose Add to Favorites), there isn't an easy way to remove it from Favorites. The replacement dialog has a Favorites button, making it easy to add or remove a member from Favorites.
  • If you delete a member that has associated member data, the member data is automatically removed for that member.
  • It automatically updates the member data when you rename a member so it respects the case of the member's name.
  • Like the New Property/Method dialog, it's non-modal, dockable, resizable and persistent, and allows changing a property to a method and vice versa.
  • Selecting the description of a member and pressing Ctrl+C to copy it causes the Apply button to become enabled in the native dialog, requiring you to either choose Apply or Cancel to close the dialog (pressing Esc brings up a "save changes" dialog). The replacement dialog does not have this behavior.
  • The New button launches the replacement New Property/Method dialog.
  • The Zoom window (right-click on the Properties window for a property and choose Zoom) is resizable.
Documentation is provided in a CHM file, but like every downloaded CHM has an issue with security. To fix that, right-click the CHM, choose Properties, and click Unblock.

To install the dialog, download the code and run both of the APP files. This will install the necessary MENUHIT and MENUCONTEXT records into your IntelliSense table to enable the new dialogs. Full source code is provided so feel free to check out how these dialogs work. Please post any suggestions for improvements to the VFPX site.


Anonymous said...

It works great !
Thanks very much !

Andrew MacNeill said...

Looks great - although I'm not seeing the resizable zoom. Looking into it further.

Doug Hennig said...

Andrew, you have to right-click and choose Zoom rather than clicking the Zoom button, since it's fired off the shortcut menu.