Archive

Posts Tagged ‘Clipper’

Mar
09

One of the hallmarks of FoxPro and Visual FoxPro is the level of backwards compatibility the Fox Team was committed to during the decades it was created and enhanced. The compatibility was not just from FoxPro to FoxPro versions, but often was extended to other XBase flavors such as dBASE and Clipper. One of the side-effects of this decision by Fox Software and Microsoft is that developers can easily port code forward, even when there might be easier or better ways to accomplish the same thing.

Over the last week I have helped another developer migrate some Clipper DOS code to Visual FoxPro. The decision to do a direct port of the code was made way before I was asked to help. Because of the deep commitment of the Fox Team this port was working except for three areas where the developer requested my help. The one aspect that caused me the most grief was colors – requirements are to match the colors exactly as the old system.

I figured the color issue would be a snap because the color settings were done through procedures, not on individual @SAY,@GET lines. Each procedure had SET COLOR TO commands. What I did not realize was the color pairings in Clipper were done in numbers instead of letters (apparently Clipper supports both). Visual FoxPro seems to run the code, but the colors were not matching. Took me a while to figure this out,but VFP is more accurate with color pairings as letters. Once I understood this trap I was able to get the colors going in the right direction.

One issue with the colors though was the background color was not set correctly on many of the screens. The @SAY and @GET code displayed correctly. What I learned is that VFP is setting the screen backcolor to the backcolor of the first @SAY done after a CLEAR. Unfortunately that took me a long time to figure out. Once I understood how it works I developed some code that handles it. Oh, and don’t think you can just set _SCREEN.BackColor, it does not work well with @SAY or @GET code.

I guess the Fox Team did not sufficiently test scenarios with @SAY and @GET compatibility (tongue firmly planted in cheek).

Why am I posting this? Is it because I believe many people are running Clipper or FoxBase/FoxPro code in Visual FoxPro these days? No. Just as a reminder to those developers who are faced with the choice of migrating old code to Visual FoxPro and some of the headaches you might face if you select to go the route of running the “compatible” code in Visual FoxPro. The backwards compatibility with old style user interface elements might not be as compatible as you would like. I believe the developer I am working with made the right call for his customer’s situation, and the customer’s requirements and budget, but the cost is going to be many hair pulling moments. Unfortunately in my case I was working with a fixed price budget, and I blew the hours by three times the allotted amount of time. So much for my weekend being fun.

Another lesson re-learned at the school of hard knocks.

, , ,