Lescasse Consulting
 Home    Company    News    Prices    Download    Buy    Forums   
Read Me
Buy
Forums
Resume
AntiSpam 1.2
wBackup 1.11
NetAccess 2.0
Visual APL 1.0 
APL+Win 8.0 
APL+Win Products 
APL+Win Objects™ 
APL+Win Training 
     • Packages
     • Feedback
     • World Map
     • Updates
     • Pack 1
     • Pack 2
     • Pack 3
     • Pack 4
     • Pack 5
     • Pack 6
     • Pack 7
     • Pack 8
     • Pack 9
     • Pack 10
     • Pack 11
     • Pack 12
     • Pack 13
     • Pack 14
APL+Web Services
APL+Web Component 
APL+ History
Dyalog.Net Tutorial
Conferences 
Powerpoint
White Papers
Web Hosting
References
Links
 
APL+Win Objects™ 6.0

TADO5
TADO5 Tutorial
TAPLDraw5
TAPLEdit5
TAPLSession5
TAbale5
TAboutBox5
TAccess5
TAgent5
TBlatMail5
TButton5
TCDO5
TCRC5
TCancelButton5
TCheck5
TCheckGroup5
TChildForm5
TChooseColor5
TChooseFont5
TClipBoard5
TClock5
TCodeStats5
TColors5
TCombo5
TComboDrive5
TComboFilter5
TComboList5
TComboTree5
TCommandBar5
TCommandButton5
TControlClass5
TCueCard5
TDHTML5
TDHTMLEditor5
TDateTime5
TDateTimeFr5
TDates5
TDemoHandlers5
TDisplay5
TDOS5
TDualSelect5
TEdit5
TEditAmount5
TEditDir5
TEditEnter5
TEditFile5
TEditGrid5
TEditList5
TEditListview5
TEditMenu5
TEditNum5
TEditSelect5
TEditSpin5
TEmail5
TError5
TExampleForm5
TExcel5
TExcel5 Tutorial
TFindReplace5
TFOne5
TFTP5
TFTP5 Tutorial
TFileCompare5
TFileMenu5
TFileMenuDef5
TFlatButton5
TForm5
TFormClass5
TFormEditor5
TFrame5
TGetDir5
TGif5
TGifForm5
TGifWb5
TGoMenu5
TGraphX5
TGrid5
TGridDisplay5
TGridPrint5
TGUID5
THLine5
THTML5
THTML5 Tutorial
THTTP5
THelp5
THelpMenu5
TImagelist5
TInfo5
TIniFile5
TInstall5
TInternet5
TJpg5
TJpgWb5
TLabel5
TList5
TListview5
TLock5
TLogs5
TMAPI5
TMath5
TMDIForm5
TMSOutlook5
TMaskEdit5
TMedia5
TMenu5
TMessage5
TModalCall5
TMsgBox5
TNavigator5
TNetwork5
TNonVisualClass5
TODBC5
TOKButton5
TObject5
TOpenFile5
TOption5
TOptionGroup5
TOutlook5
TOutlookMail5
TOWCSpread5
TPDF5
TPFKeys5
TPage5
TPassword5
TPicture5
TPing5
TPopupMenu5
TPowerpoint5
TPowerpoint5 Tutorial
TPrinter5
TProgress5
TProgressDlg5
TQuestion5
TRegistry5
TRegistryKey5
TResource5
TRichEdit5
TSPX5
TSQLDMO5
TScheduler5
TScroll5
TSelector5
TSpinner5
TSplitter5
TStatus5
TStopWatch5
TTest5
TTestError5
TTextFile5
TTimer5
TTip5
TTipForm5
TTLI5
TToolBar5
TToolbox5
TToolsMenu5
TTrackbar5
TTranslate5
TTree5
TVLine5
TViewMenu5
TWebBrowser5
TWebServer5
TWebSite5
TWebSiteNet5
TWinMenu5
TWord5
TYesNo5
    Visits:  2413 (68 on line) Last Update: Nov 23, 2003  
    APL+Win Training Pack 6    Printer Friendly  
Resizing Forms & Dialog Boxes
Object Oriented Programming
Intoduction to OCX: an OCXPrinter Object

Download APL+Win Training Pack 6 (2387 K)


Object Oriented Programming with APL+Win

It is possible to do real Object Oriented Programming with APL+Win!

And believe it or not, this can be extremely simple and clear. So simple that, if you learn it and taste it there is a high chance you'll become addicted!

This 115 pages lesson teaches all the basic concepts of Object Oriented Programming, shows you how to implement them in APL+Win through numerous very simple examples, and gives you the one self-contained Qwi utility which allows you to use pure OOP in APL+Win.

You will be learning:

  • what objects are
  • how to create your own new classes of objects
  • how to build a hierarchy of classes
  • how to fully use inheritance
  • how to overload methods and properties
  • what is a superclass
  • how to override methods and properties by calling superclass methods and properties
  • what polymorphism is and how to use it
  • how to use encapsulation

Not only developing your own new classes of objects is very simple once you have read this lesson, but you then use them with the Qwi utility which shares the same syntax as the APL+Win ŒWI user interface system function. See an example below.

With this lesson, you will immediately be able to start defining your own new classes of objects and benefit from the many advantages of real Object Oriented Programming in APL+Win:

  • write truly reusable code
  • avoid code duplication and rewrites with inheritance
  • simplify programming with polymorphism
  • greatly increase code sharing with other developers
  • improve the consistency of your interface
  • increase your software reliability
  • increase your productivity

In this APL+Win Training we will be developing a good number of new very porwerful new classes of objects for APL+Win, starting with the first of them called: OCXPrinter


A new object for APL+Win: OCXPrinter

The first part of this Chapter describes how to use the brand new APL+Win OCX interface, using the Formula One OCX v4.1.5 spreadsheet. After reading these few pages you should be able to use any new OCX with APL+Win.
Then, in order to put the new Object Oriented technlogy into action, we build together a new class of object called OCXPrinter.

OCXPrinter is a rewrite of the GuiPrint utility presented in Chapter 11 (see Pack 3) this time implemented as an object and as a stand-alone APL function.

This object not only allows you to create and print almost any report you can imagine from APL+Win, with Excel quality, but also encapsulates new methods for directly importing and exporting data between APL and Excel 5/95, for example automatically installing planes of a 3-dim APL nested array in successive sheets of the Excel workbook.

OCXPrinter comes with 2 properties (ontop and visible) and more than 60 built-in methods (Add AddAcross AddColPageBreak AddPageBreak AddRowPageBreak Align Auto AutoAll BackColor BlankZeroes Bold Border BottomMargin Clear ClearAll Close ColWidth Copy DefaultFont Export FitToPage Font FontColor FontName FontSize Footer FooterFont FooterMargin Format Get GetSelRef GridHeadings GridLines HCenter HLine Header HeaderFont HeaderMargin Import Italic LeftMargin Margins Move New NextRowPageBreak Open Orient Preview Print PrintArea PrintGridLines PrintHCenter PrintScale PrintTitles PrintVCenter RemoveColPageBreak RemovePageBreak RemoveRowPageBreak Resize RightMargin Scale Sel SelAll SelRef TopMargin Underline VCenter VLine).

Here is an example using the OCXPrinter object. To print the following report:

you need to write the following straight forward APL function:

Note that you must have the APL2000.TTF file installed on your computer to see APL characters in the function listing below. You can download the APL2000.TTF True Type file now if you need to.

    ’ OCXPrinterTest;L;S;data;pos;Œwself
[1]   ©’ OCXPrinterTest -- Sample report using the OCXPrinter object
[2]
[3]   L„ListSeparator   © retrieve Windows Intl list separator setting
[4]
[5]   data„((›''),months,¨' '),(days,¨›'  ')®¯2000+?12 7½10000
[6]
[7]   © Create instance of OCXPrinter object
[8]   Œwself„'ff' Qwi 'New' 'OCXPrinter'('ontop' 1)('where' 2 10 31 107)
[9]
[10]  © Fill the grid with data
[11]  pos„ Qwi 'Add' (4 1) data
[12]
[13]  © Apply formating and add column headers
[14]       Qwi'Format' '[>0] [BLACK] # ###.00 ;[<0] [RED] (# ###.00);'
[15]       Qwi'Font' 'Impact' 14
[16]  pos„ Qwi'AddAcross' 3 (2 4) 'First 3 days'
[17]  pos„ Qwi'AddAcross' 3 (5 6) 'Last 2 days'
[18]  pos„ Qwi'AddAcross' 3 (7 8) 'Weekend'
[19]       Qwi('Sel' 'B3:H3')('BackColor' 192 192 192)('Font' 'Impact' 18)
[20]       Qwi('Sel'('B4:H4',L,'A3:A16'))('BackColor' 192 192 192)
[21]       Qwi('Align' 'right' 'center')'AutoAll'
[22]       Qwi('ColWidth'(¼9)(9½3800))('Sel' 1 1 1 1)
[23]
[24]  © Printer settings
[25]       Qwi('TopMargin' 1.6)('BottomMargin' 2) ©1.4
[26]       Qwi('HeaderMargin' .5)('FooterMargin' .5)
[27]       Qwi'HeaderFont' 'Arial' 12 'Arial Bold' 24 'Arial' 12
[28]       Qwi'FooterFont' 'Arial' 12 'Arial' 12 'Arial' 12
[29]           S„›'Uniware' 'APL Department' 'Year Report'
[30]           S„S,›'' 'APL Sales' '(1996)'
[31]           S„S,›'&D' '&T'
[32]       Qwi'Header' S
[33]           S„›'Copyright © 1997 Eric Lescasse'
[34]           S„S,›''
[35]           S„S,›'Page &P/&N'
[36]       Qwi'Footer' S
[37]       Qwi'Orient' 'landscape'
[38]       Qwi'PrintHCenter' 1
[39]
[40]  © Finish
[41]       Qwi'Preview'            © print preview
[42]  ©or: Qwi'visible' 1          © display Formula One form
[43]  ©or: Qwi'Print' 0            © print immediately (with no interface)
[44]  ©or: Qwi'Print' 1            © print dialog box
’

If we had commented line 41 and decommented line 42 in the above function, here is the window which would have popped up:

allowing you to further edit data in the grid, before printing and change many printing parameters through various print dialog boxes.

To see how easy it is to use the OCXPrinter object to exchange data between APL+Win and Excel 5, Excel 7 or Excel 95, here is a sample APL session:

      apl3d„'This' 'is' 'a' '3D' 'nested' 'APL' 'array'
apl3d„apl3d,'containing' 'numbers' 'and' 'text',¼10
apl3d„4 6 7½apl3d

'ff' Qwi 'New' 'OCXPrinter' ('Export' 'c:\temp\temp.xls' apl3d)

Each plane of the 3-dimensional APL array automatically goes into a different workbook sheet in Excel; numeric APL data become numerci cells under Excel.

Now to reimport the data to APL again:

      imported„'ff' Qwi 'Import' 'c:\temp\temp.xls'
½imported
4
	
      1œimported
       This      is   a   3D nested APL array
containing numbers and text      1   2     3
		4       5   6    7      8   9    10
 This      is   a   3D nested APL array
containing numbers and text      1   2     3
		4       5   6    7      8   9    10

      ½¨imported
6 7  6 7  6 7  6 7

      ½œimported
4 6 7

Note that you must close the Excel workbook before you can import it. Note also that the result of the Import method is alsways a nested vector where each element is a different sheet of the imported Excel workbook. This allows to import ANY Excel spreadsheet within APL in seconds, since Excel workbook sheets may have different number of lines and columns.


From the above Import/Export example which demonstrates invoking methods of a new class of APL+Win objects (OCXPrinter) you can see how easy it is to use an object. And the good news are that, with this lesson, you will learn how to easily customize an object like OCXPrinter by adding your own methods and properties. You will also be able to create child classes of the OCXPrinter class and fully use inheritance and polymorphism to you greatest benefit.


Resize handlers

This Pack WinWord document also talks about Resize handlers and how to automatically resize all children of a form when the form is resized.

2 utilities are provided: ResizeHandler and ResizeFontHandler which resizes all the fonts used in the form accordingly to the nesw form size.

Learn the techniques involved and reuse these 2 utilities as wished.

Here is an example:


The following APL+Win form:



gets automatically resized by ResizeFontHandler to the following form:




or to the following form:




The Tip of the Month

The tip of the month is a new session tool with a shortcut key allowing you to pack APL+Win workspaces squeezing as many bytes out of them as possible before saving them to disk.

Pack 6 Content

disk6.doc A 115 pages Winword document containing Chapters 12, 13 and 14 of the APL+Win Training.
resize.w3 Resize handlers (ResizeHandler and ResizeFontHandler) as well as functions to test them.
qwi.w3 The Qwi utility and a dozen of new APL+Win classes to explore OOP programming with APL+Win (inheritance, polymorphism, etc.). Requires APL+Win 1.9.14+.
qwimin.w3 The Qwi and HANDLERFOR utilities: the minimal set of utilities to copy into your workspace to use OOP and new classes of objects. Requires APL+Win 1.9.14+.
ocx.w3 A few functions to explore using OCXs from APL+Win. Requires APL+Win 1.9.14+.
qwiprint.w3 The OCXPrinter object and several additional utilities:
DecimalSeparator and ListSeparator read the Control Panel Intl settings
ImportXls and ExportXls use the OCXPrinter object to import/export to Excel 5,7,95.
Requires APL+Win 1.9.14+.
vcf132.ocx
mfcans32.dll
msvcrt20.dll
oc30.dll
odbc32.dll
Formula One OCX v4.1.5 (the redistributable files).
 This entire Web site has been dynamically generated by APL+Win Objects™ 6.0
 For all questions contact:  info@lescasse.com
 Copyright © 2003-2005 Lescasse Consulting. All rights reserved.