Tuesday, March 17, 2009

Mel Smith : From CA-Clipper to xHarbour+HMG

CCH: On reading a email from Sudip regarding Mel Smith's migration from CA-Clipper to xHarbourt+HMG, I wrote to Mel Smith on 16th March 2009 and obtained his consent to republish it here.

Mel Smith to Sudip

Sudip,

Many people are starting to use the 'IDE' method (and, apparently successfully).

However, I am 'old-fashioned' and so I hand-code everything, and I use the 'HBMAKE.EXE' utility of xHarbour to build my apps.

If you provide me with an email address that allows attachments (btw, Gmail does *not* allow attachments), I will forward my BLD.BAT file, my xxx.BC file that is a parameter to HBMAKE, and my main app plus one other module for you to see how I proceed.

My conversion procedure is usually:

1. Make a copy of the original Clipper 5.2e program and all its various modules
2. Convert this copy to proper xHarbour (fixing all previous bad styles to proper styling, etc, etc)
3. With all modules converted to xHarbour, run this console-style program to ensure it works as good or better than the Clipper app
4. Start windowizing:
a. Start with the Function Main() and build a main window.
b. Add the main menu to this window
c. In one of the menu options, call/activate a simple sub-function (e.g., build all indexes)
d. Go to this sub function and add a child window and carry on with the conversion.
e. Go to c. again :)))

I have included the Main Window definition from the Main Function from one of my apps below:


... there are 1480 lines of setup before the following initialization of the app's Main Window ...

BTW, I had an old app named ACT (for Accounting -- I always use 3 letters for my various apps)
When I started converting to 'windows' I just added a 'W' to the beginning of 'ACT' . Thus, WACT is the app name
Please don't assume the code below is 'Good' or 'Sophisticated'. It is *not* ! It is just *my* conversion of old stuff. But it does work., and it is quite simple. There are about 48 separated modules I had to convert. The fragment below is part of the Main module

You will note that some of the conversion has not been required or completed yet (i.e., the donothing() function refers to this

...
...
SET MULTIPLE OFF

SET NAVIGATION EXTENDED
cWIN := "WACT"

DEFINE WINDOW WACT ;
AT nMTOP,nMLEFT ;
WIDTH nMWIDTH HEIGHT nMHEIGHT ;
TITLE "Accounting Control for A/P, A/R and Payroll: " + GVERSION + ;
" ( on Drive " + GNETDRV+" )" + " Process Date : " + GTHEN ;
ICON "WORLD" ;
FONT "Arial" SIZE 12 ;
MAIN ;
ON INIT {|| (IIF(lRBLDIDX,(WACT.LABNDX.SHOW,WACT.NDXFIL.SHOW, ;
WACT.INDEXPROG.SHOW,RBLDIDX(lSETUPDBF:=.T.)),), ;
WACT.LABNDX.HIDE,WACT.NDXFIL.HIDE,WACT.INDEXPROG.HIDE, ;
(GABORT := .NOT. SETUPDATES(GDATE), ;
IIF(GABORT,DOMETHOD("WACT","RELEASE"),.T.)), ;
SETSTATUS(cWINSTATUS:=" Ready for Menu Selection"))}

DEFINE MAIN MENU
POPUP "Accounts &Payable"
ITEM " 1. Add/Edit A/P Transactions" ACTION {||MNTPAY(),DBCLOSEALL()}
ITEM " 2. Add/Edit C/R Transactions" ACTION DONOTHING() DISABLED
ITEM " 3. Load Suppliers" ACTION DONOTHING() DISABLED
ITEM " 4. Update Supplier A/P File" ACTION DONOTHING() DISABLED
ITEM " 5. Update Purchase Order File" ACTION {||MNTPCH(),DBCLOSEALL()}
ITEM " 6. Fix Vend Acct. Nos. in A/P" ACTION DONOTHING() DISABLED
ITEM " 7. P.O Report Menu" ACTION DONOTHING() DISABLED
ITEM " 8. A/P Reports / Cheques Menu" ACTION {||PAYREPS(),DBCLOSEALL()}
ITEM " 9. C/R Reports / Cheques Menu" ACTION DONOTHING() DISABLED
ITEM " A. Multi-Job Costing Tables" ACTION {|| LOADCOST("WACT"),DBCLOSEALL(), ;
SETPROPERTY("WACT","oSTOPSCAN","VISIBLE",.F.), ;
SETPROPERTY("WACT","oSTOPSCAN","ENABLED",.F.)}
ITEM " B. Job Costing for ONE Job" ACTION {||MNTJCS(),DBCLOSEALL()}
ITEM " X. Exit" ACTION DOMETHOD("WACT","Release")
END POPUP

POPUP "Accounts &Receivable"
ITEM " 1. Add/Edit A/R Transactions" ACTION DONOTHING() DISABLED
ITEM " 2. Fix Cust No. in A/R File " ACTION DONOTHING() DISABLED
ITEM " 3. Edit Customer Information" ACTION DONOTHING() DISABLED
ITEM " 4. Edit Customer Financials " ACTION DONOTHING() DISABLED
ITEM " 5. " ACTION DONOTHING() DISABLED
ITEM " 6. Receipts Input Processing" ACTION DONOTHING() DISABLED
ITEM " 7. " ACTION DONOTHING() DISABLED
ITEM " 8. Print Reports / Invoices " ACTION DONOTHING() DISABLED
ITEM " 9. " ACTION DONOTHING() DISABLED
ITEM " A. Change Txn Number Format " ACTION DONOTHING() DISABLED
ITEM " B. Import Spreadsheet Data " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Utilities"
ITEM " 1. View/Edit G/L Master " ACTION DONOTHING() DISABLED
ITEM " 2. View Admin Passwords " ACTION DONOTHING() DISABLED
ITEM " 3. Load C/R Register File" ACTION DONOTHING() DISABLED
ITEM " 4. Load G/L Accounts File" ACTION DONOTHING() DISABLED
ITEM " 5. Load Time-Sheet Files " ACTION DONOTHING() DISABLED
ITEM " 6. Load Employee File " ACTION DONOTHING() DISABLED
ITEM " 7. Re-Build Vendor Codes " ACTION DONOTHING() DISABLED
ITEM " 8. Set-Up P.O. Remarks " ACTION DONOTHING() DISABLED
ITEM " 9. Set-Up Div/EWO DBFs " ACTION DONOTHING() DISABLED
ITEM " A. Set-Up Work-Area DBFs " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Employees"
ITEM " 1. Browse Employee File " ACTION DONOTHING() DISABLED
ITEM " 2. Browse Job Desc File " ACTION DONOTHING() DISABLED
ITEM " 3. Browse Rates/Deductions " ACTION DONOTHING() DISABLED
ITEM " 4. Time-Sheet Entry System " ACTION {||MNTTBS(),DBCLOSEALL()}
ITEM " 5. Print Time and Expenses " ACTION {||TBSREPS(),DBCLOSEALL()}
ITEM " 6. Print Payroll Cheques " ACTION DONOTHING() DISABLED
ITEM " 7. Period-End Payroll " ACTION DONOTHING() DISABLED
ITEM " 8. Load Employees (AccPac) " ACTION DONOTHING() DISABLED
ITEM " 9. View TBS Time-Sheets " ACTION DONOTHING() DISABLED
ITEM " A. Browse Unions File " ACTION DONOTHING() DISABLED
END POPUP

POPUP "&Manager"
ITEM " 1. Rebuild Index Files" ACTION RBLDIDX(lSETUPDBF:=.T.)
ITEM " 2. Edit Company Information" ACTION {|| MNTSYS(),DBCLOSEALL()}
ITEM " 3. Run old DOS ACT System" ACTION DOOLDACT("WACT")
ITEM " 4. View / Edit Job Status" ACTION {|| MNTJOB("WACT"),DBCLOSEALL()}
ITEM " 5. View / Edit Job Rates" ACTION {|| MNTJRT(),DBCLOSEALL()}
ITEM " 6. Print Job(s) Status" ACTION DONOTHING() DISABLED
ITEM " 7. Test Send of Email" ACTION SENDMAIL()
ITEM " X. Exit" ACTION DOMETHOD("WACT","Release")
END POPUP

END MENU

@ (nMBOT-nMTOP)/2 - 40, 150 LABEL LABNDX AUTOSIZE ;
VALUE "Indexing File : " ;
INVISIBLE

cFIL2NDX := SPACE(20)

@ (nMBOT-nMTOP)/2 - 40, 300 TEXTBOX NDXFIL VALUE cFIL2NDX ;
WIDTH 300 ;
INVISIBLE

@ (nMBOT-nMTOP)/2,150 PROGRESSBAR INDEXPROG ;
RANGE 0,10000 ;
WIDTH 600 ;
HEIGHT 30 ;
SMOOTH ;
INVISIBLE ;
TOOLTIP "Indexing Progress"


@ nMBOT-86,000 LABEL STATPMPT OF WACT AUTOSIZE ;
VALUE "Status Line->" ;
FONT "Arial" SIZE 10

@ nMBOT-86,100 LABEL STATLINE OF WACT ;
VALUE cWINSTATUS ;
WIDTH 500 HEIGHT 30 ;
FONT "Arial" SIZE 10 ;
BOLD

@ nMCTRROW-(nBUTTH),nMCTRCOL-(nBUTTH) BUTTONEX oSTOPSCAN OF WACT;
CAPTION "Stop Scan"+CRLF+"of Job Cost"+CRLF+"Databases" ;
WIDTH nBUTTW+30 ;
HEIGHT nBUTTH+40 ;
FONTCOLOR RED ;
BACKCOLOR YELLOW ;
NOTABSTOP ;
BOLD ;
INVISIBLE ;
ACTION {||lESCPRESSED := .T.}

WACT.oSTOPSCAN.ENABLED := .F.
WACT.oSTOPSCAN.VISIBLE := .F.

ON KEY ESCAPE OF WACT ACTION {||nESCKEY:=K_ESC,THISWINDOW.RELEASE}

END WINDOW

Mel Smith

No comments:

Post a Comment

Welcome to Clipper... Clipper... Clipper


In 1997, then using Delphi 3, I had already created 32-bits Windows applications for HRIS, ERP and CRM. In 2007, using Ruby on Rails, an AJAX powered CRM site running on Apache & MySQL was created and I am now using Visual Studio .Net 2008 to create web-based projects and Delphi 7 for Win32 applications using SQL2005 & DBFCDX.

So, why then am I reviving the Original Clipper... Clipper... Clipper via a Blog as CA-Clipper is a programming language for the DOS world ? Believe it or not, there are still some clients using my mission-critical CA-Clipper applications for DOS installed in the late 80's and up to the mid 90's. This is testimony to CA-Clipper's robustness as a language :-)

With the widespread introduction of Windows 7 64-bits as the standard O/S for new Windows based PCs & Notebooks, CA-Clipper EXE simply will not work and it has become imperative for Clipper programmers to migrate immediately to Harbour to build 32/64 bits EXEs

Since 28th January 2009, this blog has been read by 134,389 (10/3/11 - 39,277) unique visitors (of which 45,151 (10/3/11 - 13,929) are returning visitors) from 103 countries and 1,574 cities & towns in Europe (37; 764 cities), North America (3; 373 cities) , Central America & Caribeans (6; 13 cities), South America(10; 226 cities), Africa & Middle-East (12; 44 cities) , Asia-Pacific (21; 175 cities). So, obviously Clipper is Alive & Well : -)


TIA & Enjoy ! (10th October 2012, 11:05; 13th November 2015)


Original Welcome Page for Clipper... Clipper... Clipper

This is the original Welcome Page for Clipper... Clipper... Clipper, which I am republishing for historical and sentimental reasons. The only changes that I have made was to fix all the broken links. BTW, the counter from counter.digits.com is still working :-)

Welcome to Chee Chong Hwa's Malaysian WWW web site which is dedicated to Clipperheads throughout the world.

This site started out as a teeny-weeny section of Who the heck is Chee Chong Hwa ? and has graduated into a full blown web site of more than 140 pages (actually hundreds of A4 size pages) ! This is due to its growing popularity and tremendous encouragements from visiting Clipperheads from 100 countries worldwide, from North America, Central America, Caribbean, South America, Europe, Middle-East, Africa and Asia-Pacific. Thanx Clipperheads, you all made this happen !


What is Clipper ?

You may ask, what is this Clipper stuff ? Could Clipper be something to do with sailing as it is the name of a very fast sailing American ship in the 19th century ?

Well, Clipper or to be precise, CA-Clipper is the premier PC-Software development tool for DOS. It was first developed by Nantucket Corporation initially as a compiler for dBase3+ programs. Since then, CA-Clipper has evolved away from its x-base roots with the introduction of lexical scoping & pre-defined objects like TBrowse. As at today, the most stable version ofClipper is 5.2e while the latest version, 5.3a was introduced on 21 May 1996.

As at 11th November, 1996, an unofficial 5.3a fixes file was made available by Jo French. See the About CA-Clipper 5.3a section for more details. BTW, Jo French uploaded the revised 5.3a fixes file on 20th November, 1996.

Latest News

The latest news is that CA has finally released the long-awaited 5.3b patch on 21 May, 1997.

For 5.3b users, you must a take a look at Jo French's comments on unfixed bugs in 5.3b.

BTW, have you used Click ? If you're a serious Clipperprogrammer and need an excellent code formatter, Click is a natural choice. How to get it ? Simple, access Phil Barnett's site via my Cool Clipper Sites.

32-bits Clipper for Windows ?

Have you tried Xbase ++ ? Well, I have and compared to Delphi (my current Windows programming tool of choice), I'm still sticking to Delphi.

Anyway, you should visit the Alaska Home Page. Give it a chance and then draw your own conclusions !.

The Harbour Project

Is this the future of Xbase ? Take a look at at the Harbour Project

You are Visitor # ...

According to counter.digits.com, you are visitor since 3 June 1996.

If you like or dislike what you see on this website, please drop me a line by clicking the email button at the bottom of this page or better still, by filling out the form in my guest book. If you are not sure what to write,click here to take a look at what other Clipperheads have to say.