David Fung

recently i have a project which
requires a grid more powerful than the one comes with vfp. so i
begin to research on 3rd party activex com grid controls.
eventually i purchased a copy of farpoint spread 7

how i know of farpoint spread 7? a
while back while i was taking up the task of maintaining an existing
vb6 project, i found out the original programmer used an old version
of farpoint spread. my client doesn't have the source disk of the
farpoint spread any more, so i emailed farpoint technical support and
asked for it. they… Continue reading

to continue the saga from my previous post (excel event binding), the custom application i wrote for my client is now running happily with excel 2003 after implementing those new event handlers to satisfy excel 2003.  so far so good.  but that is not the end of the story.

new computers at my client site come with office 2007.  (i don't know where you can buy office 2003 anymore.)  excel 2007 again has some new events that need to be handled:


after adding these event handlers, excel 2007 ole automation has no problem. 

however, my client application manipulates… Continue reading

i do a fair amount of excel automation work for my client.  this time i would like to use excel as an external editor to compliment the vfp built in grid, i.e. instead of using the grid to edit data, the user can say click a button to start up excel and use excel to edit the data, when they close excel after editing, somehow the edited data will be wrriten back to the grid.  this way the user can use the multi-cell copy and paste feature of excel among other useful features of excel.

in order to do that,… Continue reading

the language c is behind a lot of fundamental technologies such as linux, apache, device drivers, internet protocols, etc.  the first version of bittorrent is written in python and python is written in c.  ruby on rails is written in ruby and ruby is written in c.  yet most of us is not concerned when will be the next major version upgrade of the language c.  why?

what makes c so powerful is that we can write libraries (in c) to extend c.  similarly in the case of perl, it takes a long time to go from perl 5 to… Continue reading

the other day i have some records from a dbf that need to be exported to an excel file.  i also need to add some list-based data validation in excel via automation.  i am using vfp9 and excel 2002.  below is basically what i do.

export to c:\sheet.xls type xl5
loexcel = createobject('excel.application')
loexcel.columns("h").validation.add(xlvalidatelist, xlvalidalertstop, ...)

i had verified the above code works in an interactive session in the command window.  but when i open the generated spreadsheet, the data validation is gone!

eventually i found out that vfp exports to excel v5 format, which does not… Continue reading

we can pass info to and retrieve info from a form like this:

   do form with arg1,arg2 to result

which is similar to calling a function:

   result = form(arg1,arg2)

when i am developing a form, i often need to change the number of input and output arguments, which means i need to constantly adjust the form calling interface. 

by using a parameter object as an input/output mechanism simplifies it like below:

local loparam
loparam = createobject('empty')
do form with loparam
? loparam.output

also the use of parameter object makes it flexible in when and where to assign… Continue reading

often times i need to break out from a loop if user hit the escape key.  in order to do that, will have to:

  1. save the existing state of the set escape
  2. set up on escape
  3. restore set escape afterward

to those not familiar with vfp commands and how vfp does things, it may be difficult to figure this logic out.  i have encapulated all this into a class to make it easier to understand what is happening.

 loesctoabort = createobject('syesctoabort')
 for i = 1 to infinity
    if loesctoabort.isaborted()
 release loesctoabort

the class is:

define class… Continue reading

i use inno setup to build the installer for my app.  i like to show the version number (from the version resource in the compiled exe) and the built date in the installer as show below:

since inno setup is script based, that can easily be done as below:

but i don't want to manually update the inno script every time i have a new build, so i automate it.  i already have a make.prg which i run to build my project, all i have to do is to enhance it to update the version and timestamp automatically. 

that boils… Continue reading

i am always fascinated by the backward compatibility of vfp, and that really helps me to do my job with much less headache.  i am a solo developer who not only have to build the app, but also have to support it.  being backward compatible make it possible for me to gradually "upgrade" my app at a pace that my client and i can afford.  set behavoir allows you to control the feature globally, where as individual commands such as report form allows fine-grained control. 

i "re-use" this idea in my app.  whenever i introduce some controversial changes to my client's app, i… Continue reading

i have two different vfp apps running at a client site.  one is a frontend desktop app that the
end-users use, and the other one is a backend maintenance app.  the maintenance app runs at night to do a set
of system maintenance jobs.  it has no
frontend and if there is anything needing attention, it will email the
technical support personnel for further investigation.

i developed these two apps separately, i.e. they belong to
two different projects.  in the
beginning, the maintenance app only did a few things, such as search and delete
temp files,… Continue reading