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.

Thursday, November 22, 2007

Fixing the "Reinstall Your App" Problem

Have you ever installed a new application only to find that running an old application now brings up a dialog asking to install it or a completely different application? That happens because when updated ActiveX controls are installed, their InprocServer settings in the Windows Registry, which points to the physical location of the OCX file, are overwritten with Windows Installer encrypted keys. When you run an older application that uses those ActiveX controls, Windows Installer thinks there’s something wrong with the ActiveX control and so prompts you to reinstall the application. This is a common conflict between VFP applications using ActiveX controls like the TreeView and Microsoft Office, for example.

This problem doesn't occur if you use Inno Setup instead of Windows Installer-based tools such as InstallShield. In the mean time, the workaround is to find the Registry entry for the ActiveX control and fix its InprocServer32 entry. This is easier said than done, because you don't necessarily know which control to fix; you need to find entries for all the controls your app uses. Here's how you do this:
  • Launch RegEdit.
  • Find "treeview" or whatever control you're looking for. The entry you want is in HKEY_CLASSES_ROOT\CLSID and it'll be a GUID. For example, for the TreeView control version 6, the entry is HKEY_CLASSES_ROOT\CLSID\{C74190B6-8589-11D1-B16A-00C0F0283628}.
  • Look in InprocServer32 for the InprocServer32 key. It's supposed to contain the name and path for the OCX, but notice it contains gibberish; that's the Windows Installer encrypted key that's causing the problem.
  • Edit the value and replace it with the name and path for the OCX; for the TreeView control, it should be C:\Windows\System32\MSComCtl32.OCX (the "(default)" value contains this, so you can copy it from there and paste it into InprocServer32).
  • Repeat for each of the controls your app uses.

Monday, November 19, 2007

New Southwest Fox Blog

A new blog dedicated to Southwest Fox is now available.

Update for Sedna Upsizing Wizard

Someone recently emailed me about a couple of changes they wanted in the new Upsizing Wizard in Sedna. One was the ability to select Varchar(MAX) as the data type to use when upsizing a memo field. The other was the ability to use a different date in the place of blank VFP dates; the default in the Upsizing Wizard is 01/01/1900 but they wanted to use 12/31/1899 instead.

The first change simply involved adding a new record to TypeMap.DBF, the table containing the type mappings. Set LocalType to "M" (for Memo), FullLocal to "memo", RemoteType to "varchar(max)", and Server to "SQL Server". Leave the logical fields as .F., especially VarLength, which determines whether the user is prompted for a field length.

The second was a little more work. First, BulkXMLLoad.PRG needs a change to support this because it used a hard-coded value. Change the statement setting ltBlank to:

ltBlank = iif(vartype(ttBlank) $ 'TD', ttBlank, SQL_SERVER_EMPTY_DATE_Y2K)
and add the following statement after the LOCAL statement:

#include Include\AllDefs.H
Second, JimExport (interesting method name!) in WizUsz.PRG also used a hard-coded value, so change the assignment to lcEmptyDateValue in the first CASE statement to:

lcEmptyDateValue = "IIF(EMPTY(" + ALLT(lcCursorName)+'.'+ALLT(aTblFields[ii,1])+ "), " + ;
transform(This.BlankDateValue) + ","
Finally, to change the actual date, change these two constants in AllDefs.H to the desired values:
Rebuild UpsizingWizard.APP and you're ready to go.

Tuesday, November 06, 2007

Cathy Blogs!

In the "it's about time" category, Cathy Pountney has started blogging. Looks like the arm twisting we did at Southwest Fox did the trick. I'm really looking forward to her posts. Her sessions at Southwest Fox were very well attended and rated (we're compiling the evals right now), so being able to get snippets of her wisdom on a regular basis is most welcome.

Friday, November 02, 2007

My Newest Time Waster

Rick Schummer blogged yesterday about a new time waster for him: 3-D Pong. My new time waster is, "a webcomic of romance, sarcasm, math, and language". And programming: check out Exploits of a Mom. I actually laughed out loud at that one. Then I started going through some of the several hundred other comics in the collection and poof, an hour had gone by. Fortunately, it has an RSS feed so I can get my daily dose.

Heading for Germany and Holland

On Tuesday, I'm heading for Frankfurt for my third German DevCon (and the 14th edition of this great conference). About 1/3 of the sessions are in English, and there are English sessions in almost every timeslot, so if you're unilingual as I am (and not proud of it, either), there are plenty of great sessions by speakers such as Andy Kramek, Marcia Akins, Rick Schummer, Steve Black, Craig Berntson, and Alan Griver to attend. I'm even planning on attending a couple of German sessions, in particular Christof Wollenhaupt's session on Guineu. He showed a few minutes of it during the Southwest Fox keynote, enough to whet my appetite for more.

One of the interesting things about German is that it seems to be relatively easy to pick up at least a few words. There are lots of similarities between words in German, English, French (which I took in high school 75 years ago), and Dutch (which my wife speaks fluently so I've picked up a very small amount), enough so that sometimes I can at least get the gist of a conversation if not the details. Plus, in technical sessions, there seem to be actual English words in almost every sentence, and of course, code is code.

After DevCon, Rick Schummer and I head for Holland to speak at a one-day VFP conference hosted by Software Developer Network. The next day, we're going to do some sightseeing in Amsterdam, which I visited five years ago and have been wanting to go back to. Rick's going to be in shock when he sees the Red Light District, which we pretty much can't avoid since it's right by the central train station.

Thursday, November 01, 2007

Duct Tape Marketing

I rarely read business books, but as my business partner Mickey's urging (much closer to nagging, actually), I read Duct Tape Marketing by John Jantsch on my flights to and from Phoenix for the Southwest Fox conference. Wow! This is one of those seminal, "this will change your life" kind of books (well, not your life; if this book changed your life, you really needed to get a new life!). The book is an easy read: there's no marketing theory or page-filling fluff; it's just jammed full of ideas and "to-do's" about how to market your business. One of the key points is that you are in marketing even if you don't think you are. Everyone is in marketing to some extent or another.

I was so excited about the ideas I read in this book that I took several pages of notes. Mickey has been ordering copies of this book for everyone in our company, and we're even considering giving it to clients. It's now on my "requirted reading" list.