Clarion - ABC Library Reference
Clarion - ABC Library Reference
This publication is protected by copyright and all rights are reserved by SoftVelocity
Incorporated. It may not, in whole or part, be copied, photocopied, reproduced, translated,
or reduced to any electronic medium or machine-readable form without prior consent, in
writing, from SoftVelocity Incorporated.
SoftVelocity Incorporated
2769 East Atlantic Blvd.
Pompano Beach, Florida 33062
(954) 785-4555
www.softvelocity.com
Trademark Acknowledgements:
Contents:
Foreword 45
Welcome .....................................................................................................................45
Documentation Conventions.......................................................................................46
Keyboard Conventions .........................................................................................46
Other Conventions................................................................................................46
ABC Library Overview 47
About This Book..........................................................................................................47
Application Builder Class (ABC) Library .....................................................................47
Class Libraries Generally .....................................................................................47
Application Builder Classes—The ABCs of Rapid Application Development ......47
ABC Library and the ABC Templates...................................................................51
ABC Coding Conventions..................................................................................................53
Method Names .....................................................................................................53
Where to Initilize & Kill Objects ............................................................................55
Return Values.......................................................................................................55
PRIVATE (undocumented) Items .........................................................................56
PROTECTED, VIRTUAL, DERIVED, and PROC Attributes ................................57
Documentation Conventions .............................................................................................58
Reference Item and Syntax Diagram ...................................................................58
Property (short description of intended use) ........................................................58
Method (short description of what the method does) ...........................................58
Conceptual Example ............................................................................................60
ASCIIFileClass 61
ASCIIFileClass Overview............................................................................................61
AsciiFileClass Properties ............................................................................................64
ASCIIFile (the ASCII file) .....................................................................................64
ErrorMgr (ErrorClass object) ...............................................................................64
OpenMode (file access/sharing mode).................................................................64
AsciiFileClass Methods...............................................................................................65
ASCIIFileClass Functional Organization--Expected Use ....................................65
FormatLine (a virtual to format text) ....................................................................66
GetDOSFilename (let end user select file) ..........................................................67
GetFilename (return the filename) ......................................................................68
GetLastLineNo (return last line number) .............................................................69
GetLine (return line of text) ..................................................................................70
GetPercentile (convert file position to percentage:ASCIIFileClass) ....................71
Init (initialize the ASCIIFileClass object) .............................................................72
Kill (shut down the ASCIIFileClass object) ..........................................................73
Reset (reset the ASCIIFileClass object) ..............................................................74
SetLine (a virtual to position the file) ...................................................................75
SetPercentile (set file to relative position) ...........................................................76
4 ABC Library Reference
ConstantClass 249
ConstantClass Overview .........................................................................................249
ConstantClass Properties .........................................................................................253
TerminatorField (identify the terminating field) .................................................253
TerminatorInclude (include matching terminator record) .................................253
TerminatorValue (end of data marker) .............................................................254
ConstantClass Methods............................................................................................255
ConstantClass Functional Organization--Expected Use ..................................255
AddItem (set constant datatype and target variable) .......................................256
Init (initialize the ConstantClass object) ...........................................................257
Kill (shut down the ConstantClass object) ........................................................259
Next (load all constant items to file or queue) ................................................260
Next (copy next constant item to targets) .........................................................262
Reset (reset the object to the beginning of the constant data) ........................263
Set (set the constant data to process) ..............................................................264
Crystal8 Class 265
Crystal8 Class Properties .........................................................................................266
Crystal8 Methods ......................................................................................................267
AllowPrompt (prompt for runtime parameter data) ...................................................267
CanDrillDown(allow Crystal drill down support ).......................................................268
HasCancelButton (display cancel button on report preview)....................................269
HasCloseButton (display close button on report preview) ........................................270
HasExportButton (display export button on report preview) .....................................271
HasLaunchButton (display launch button on report preview) ...................................272
HasNavigationControls (display navigation controls on report preview) ..................273
HasPrintButton (display print button on report preview) ...........................................274
HasPrintSetupButton (display print setup button on report preview)........................275
HasProgressControls (display progress controls on report preview) .......................276
HasRefreshButton (display refresh button on report preview)..................................277
HasSearchButton (display search button on report preview) ...................................278
HasZoomControl (display zoom control on report preview) .....................................279
Init (initialize Crystal8 object) ....................................................................................280
Kill (shut down Crystal8 object)................................................................................281
Preview (preview a Crystal Report) ..........................................................................282
_Print (print a Crystal Report) ...................................................................................283
Query (retrieve or set the SQL data query) ..............................................................284
SelectionFormula (retrieve or set the Crystal formula ) ............................................285
ShowDocumentTips (show tips on docuement in the preview window) ...................286
ShowReportControls (show print controls) ...............................................................287
ShowToolbarTips (show tips on preview window toolbar)........................................288
cwRTF Class 289
cwRTF Overview .....................................................................................................289
cwRTF Class Concepts ..........................................................................................289
cwRTF Relationship to Other Application Builder Classes .....................................290
10 ABC Library Reference
DbAuditManager 313
DbAuditManager Overview .....................................................................................313
Relationship to Other Application Builder Classes .................................................313
DbAuditManager ABC Template Implementation ...................................................313
DbAuditManager Source Files ................................................................................313
DbAuditManager Properties......................................................................................314
Action (log file action column) .........................................................................314
ColumnInfo (log file column queue) .................................................................314
LogFiles (log file queue) ..................................................................................314
FM (DbLogFileManager object) .......................................................................315
Errors (ErrorClass object) ................................................................................315
DbAuditManager Methods ........................................................................................316
AddItem (maintain the columninfo structure) ..................................................316
AddLogFile (maintain log file structure) ...........................................................317
AppendLog (initiate audit log file update) ........................................................317
BeforeChange (update audit log file before file change) .................................318
CreateHeader (create log file header records) ................................................318
Init (initialize the DbAuditManager object) .......................................................319
Kill (shut down DbAuditManger object) ...........................................................319
OnChange (update audit log file after a record change) .................................320
OnDelete (update audit log file when a record is deleted) ..............................320
OnFieldChange (virtual method for each field change) ...................................321
OnInsert (update audit log file when a record is added) .................................322
OpenLogFile (open the audit log file) ..............................................................322
SetFM (determine log file status) ....................................................................323
DbChangeManager 325
DbChangeManager Overview ..................................................................................325
Relationship to Other Application Builder Classes .................................................325
DbChangeManager ABC Template Implementation ..............................................325
DbChangeManager Source Files ...........................................................................325
DbChangeManager Properties .................................................................................326
NameQueue (pointer into trigger queue) ........................................................326
TriggerQueue (pointer to BFP for field changes) ............................................326
DbChangeManager Methods....................................................................................327
AddItem (maintain the namequeue structure) .................................................327
AddThread (maintains the triggerqueue) ........................................................327
CheckChanges(check record for changes) .....................................................328
CheckPair(check field pairs for changes) ........................................................328
Equal(checks for equal before and after values) .............................................329
Init (initialize the DbChangeManager object) ..................................................329
Kill (shut down DbChangeManger object) .......................................................330
SetThread (read triggerqueue) ........................................................................330
Update (update the audit log file buffer) ..........................................................331
12 ABC Library Reference
DbLogFileManager 333
DbLogFileManager Overview .................................................................................333
Relationship to Other Application Builder Classes .................................................333
DbLogFileManager ABC Template Implementation ...............................................333
DbLogFileManager Source Files ............................................................................333
DbLogFileManager Properties ..................................................................................334
DbLogFileManager Properties .........................................................................334
Opened (file opened flag) ................................................................................334
DbLogFileManager Methods.....................................................................................335
DbLogFileManager Methods ............................................................................335
Init (initialize the DbLogFileManager object) ...................................................335
EditClass 337
EditClass Overview .................................................................................................337
EditClass Concepts .................................................................................................337
Relationship to Other Application Builder Classes .................................................337
ABC Template Implementation ...............................................................................338
EditClass Source Files ............................................................................................338
EditClass Conceptual Example ..............................................................................339
EditClass Properties .................................................................................................343
FEQ (the edit-in-place control number) ............................................................343
ReadOnly ( edit-in-place control is read-only) ....................................................343
EditClass Methods ....................................................................................................344
Functional Organization--Expected Use ..........................................................344
CreateControl (a virtual to create the edit control) ...........................................345
Init (initialize the EditClass object) ....................................................................346
Kill (shut down the EditClass object) ................................................................347
SetAlerts (alert keystrokes for the edit control) ................................................347
SetReadOnly (set edit control to read-only) ....................................................348
TakeAccepted (validate EIP field) ......................................................................348
TakeEvent (process edit-in-place events) .......................................................349
EditSpinClass 351
EditSpinClass--Overview ........................................................................................351
EditSpinClass Concepts .........................................................................................351
EditSpinClass -- Relationship to Other Application Builder Classes ......................351
EditSpinClass--ABC Template Implementation ......................................................351
EditSpinClass--Conceptual Example ......................................................................352
EditSpinClass Properties ..........................................................................................355
EditSpinClass Properties ..................................................................................355
EditSpinClass Methods.............................................................................................356
EditSpinClass Methods ....................................................................................356
EditSpinClass--Functional Organization--Expected Use .................................356
CreateControl (create the edit-in-place SPIN control) ......................................357
Contents and Forward 13
EditCheckClass 359
EditCheckClass Overview .......................................................................................359
EditCheckClass Concepts ......................................................................................359
EditCheckClass Relationship to Other Application Builder Classes .......................359
EditCheckClass ABC Template Implementation ....................................................359
EditCheckClass Source Files ..................................................................................359
EditCheckClass Conceptual Example ....................................................................361
EditCheckClass Properties .......................................................................................364
EditCheckClass Methods..........................................................................................365
EditCheckClass Functional Organization—Expected Use ...............................365
CreateControl (create the edit-in-place CHECK control) .................................366
EditColorClass 367
EditColorClassOverview .........................................................................................367
EditColorClass Concepts ........................................................................................367
EditColorClass Relationship to Other Application Builder Classes ........................367
EditColorClass ABC Template Implementation ......................................................367
EditColorClass Source Files .....................................................................................368
EditColorClass Conceptual Example ......................................................................369
EditColorClass Properties.........................................................................................373
EditColorClass Properties ................................................................................373
Title (color dialog title text) ...............................................................................373
EditColorClass Methods ...........................................................................................374
EditColorClass Functional Organization--Expected Use .................................374
CreateControl (create the edit-in-place control) ...............................................375
TakeEvent (process edit-in-place events:EditColorClass) ..............................376
EditDropComboClass 377
EditDropComboClass Overview .............................................................................377
EditDropComboClass Concepts .............................................................................377
Relationship to Other Application Builder Classes .................................................377
EditDropComboClass ABC Template Implementation ...........................................377
EditDropComboClass Source Files ........................................................................378
EditDropComboClass Conceptual Example ...........................................................379
EditDropComboClass Properties ............................................................................382
EditDropComboClass Methods .............................................................................383
EditDropComboClass Functional Organization ......................................................383
CreateControl (create the edit-in-place COMBO control) ......................................384
EditDropListClass 385
EditDropListClass Overview ...................................................................................385
EditDropListClass Concepts ...................................................................................385
EditDropListClass Relationship to Other Application Builder Classes ...................385
EditDropListClass ABC Template Implementation .................................................385
EditDropListClass Source Files ..............................................................................385
EditDropListClass Conceptual Example .................................................................387
14 ABC Library Reference
ErrorClass 489
ErrorClass Overview .........................................................................................489
ErrorClass Source Files .....................................................................................489
Multiple Customizable Levels of Error Treatment ..............................................490
Predefined Windows and Database Errors ........................................................491
Dynamic Extensibility of Errors...........................................................................491
ErrorClass ABC Template Implementation ........................................................491
ErrorClass Relationship to Other Application Builder Classes...........................491
ErrorClass Macro Expansion..............................................................................492
ErrorClass Multi-Language Capability................................................................493
ErrorClass Conceptual Example ........................................................................494
ErrorClass Properties................................................................................................495
ErrorClass Properties .......................................................................................495
DefaultCategory (error category) .....................................................................495
ErrorLog (errorlog interface) ............................................................................495
Errors (recognized error definitions) .................................................................496
FieldName (field that produced the error) ........................................................497
FileName (file that produced the error) ............................................................497
History (error history structure) ........................................................................497
HistoryResetOnView(clear error history log file) .............................................498
HistoryThreshold (determine size of error history) ..........................................498
HistoryViewLevel (trigger error history) ...........................................................498
KeyName (key that produced the error) ...........................................................498
LogErrors (turn on error history logging) .........................................................499
MessageText (custom error message text) ......................................................499
Silent (silent error flag) ....................................................................................499
ErrorClass Methods ..................................................................................................500
ErrorClass Functional Organization--Expected Use ........................................500
AddErrors (add or override recognized errors) ................................................502
AddHistory (update History structure) .............................................................503
GetCategory (retrieve error category) .............................................................503
GetError (Retrieve the current error message) ..................................................503
GetErrorcode (Retrieve the current Errorcode) ..................................................504
GetProcedureName (return procedure name ) ...............................................504
HistoryMsg (initialize the message window) ...................................................505
Init (initialize the ErrorClass object) ..................................................................506
Kill (perform any necessary termination code) .................................................507
Message (display an error message) ...............................................................508
Msg (initiate error message destination) .........................................................509
MessageBox (display error message to window) ............................................510
RemoveErrors (remove or restore recognized errors) .....................................511
ResetHistory(clear History structure) ..............................................................512
SetCategory (set error category) .....................................................................512
SetErrors (save the error state) ........................................................................513
SetFatality (set severity level for a particular error) ..........................................514
SetField (set the substitution value of the %Field macro) ................................515
18 ABC Library Reference
FileManager 589
FileManager Overview ............................................................................................589
FileManager Properties.............................................................................................594
AliasedFile (the primary file) .............................................................................594
Buffer (the record buffer) ..................................................................................595
Buffers (saved record buffers) ..........................................................................595
Create (create file switch) .................................................................................596
Errors (the ErrorManager) ................................................................................596
File (the managed file) ......................................................................................596
FileName (variable filename) ...........................................................................597
FileNameValue (constant filename) .................................................................598
LazyOpen (delay file open until access) ...........................................................599
LockRecover (/RECOVER wait time parameter) .............................................599
OpenMode (file access/sharing mode) ............................................................600
SkipHeldRecords (HELD record switch) ..........................................................600
FileManager Methods ...............................................................................................601
Naming Conventions and Dual Approach to Database Operations .................601
FileManager Functional Organization--Expected Use .....................................602
AddField(track fields in a structure) ..................................................................604
AddKey (set the file's keys) ..............................................................................605
BindFields (bind fields when file is opened) .....................................................606
CancelAutoInc (undo PrimeAutoInc) ................................................................607
ClearKey (clear specified key components) .....................................................610
Close (close the file) .........................................................................................612
Deleted (return record status) .........................................................................613
DeleteRecord (delete a record) .......................................................................614
Destruct (automatic destructor) .......................................................................615
EqualBuffer (detect record buffer changes) .......................................................616
Fetch (get a specific record by key value) ........................................................617
GetComponents (return the number of key components) ................................618
GetEOF (return end of file status) ....................................................................619
GetError (return the current error ID) ...............................................................620
GetField (return a reference to a key component) ...........................................621
GetFieldName (return a key component field name) .......................................623
GetFields(get number of fields) .......................................................................625
GetFieldPicture(get field picture) .....................................................................625
GetFieldType(get field type) ............................................................................625
GetName (return the filename) .........................................................................626
Init (initialize the FileManager object) ...............................................................627
Insert (add a new record) .................................................................................629
KeyToOrder (return ORDER expression for a key) ..........................................630
Kill (shutdown the FileManager object) ............................................................632
Next (get next record in sequence) ..................................................................633
Open (open the file) ..........................................................................................634
Position (return the current record position) .....................................................635
PostDelete(trigger delete action post-processing) .............................................636
Contents and Forward 21
FuzzyClass 687
FuzzyClass Overview .............................................................................................687
Relationship to Other Application Builder Classes .................................................687
FuzzyClass ABC Template Implementation ...........................................................687
FuzzyClass Source Files ........................................................................................687
FuzzyClass Properties ..............................................................................................688
FuzzyClass Methods.................................................................................................688
Construct (initialize FuzzyClass object) ..........................................................688
Init (initialize FuzzyClass object) .....................................................................688
Kill (shutdown FuzzyClass object) ...................................................................688
Match (find query matches) .............................................................................689
SetOption (set fuzzymatch options) ................................................................690
FormVCRClass 691
FormVCRClass Overview .........................................................................................691
FormVCRClass Concepts.........................................................................................691
FormVCRClass Relationship to Other Application Builder Classes .........................691
FormVCRClass ABC Template Implementation.......................................................691
FormVCRClass Source Files ....................................................................................692
FormVCRClass Properties........................................................................................692
QuickScan (buffered reads flag).........................................................................692
Toolbar (FormVCR Toolbar object) ....................................................................693
ToolbarItem (FormVCR ToolbarTarget object) ..................................................693
ViewPosition (store the current record position) ................................................694
FormVCRClass Methods: .........................................................................................695
AddToolbarTarget (set the FormVCR toolbar) ...................................................695
Init (initialize the FormVCR object).....................................................................696
InitSort (initialize locator values).........................................................................696
Kill (shut down the FormVCR object) .................................................................697
CheckBorders (check for existence of records) .................................................697
GetAction (return FormVCR action) ...................................................................698
GetActionAllowed (validate a requested FormVCR action) ...............................699
Next (get the next FormVCR item) .....................................................................700
Previous (get the previous FormVCR item) .......................................................701
ResetSort (apply sort order to FormVCR) ..........................................................701
SetAlerts (alert keystrokes for FormVCR controls) ............................................702
SetRequestControl (assign field equates to FormVCR actions) ........................702
SetVCRControls (assign field equates to FormVCR scrolling) ..........................703
SetSort (apply a sort order to the FormVCR group)...........................................704
TakeAcceptedLocator (apply an accepted FormVCR locator value) .................705
TakeEvent (process the current ACCEPT loop event).......................................705
TakeLocate (a FormVCR virtual to process each sort) ......................................706
TakeScroll (process a FormVCR scroll event) ...................................................706
UpdateWindow (update display variables to match FormVCR action) ..............707
Contents and Forward 23
GraphClass 709
GraphClass Overview ...............................................................................................709
Relationship to Other Application Builder Classes ...................................................709
GraphClass ABC Template Implementation.............................................................709
GraphClass Source Files ..........................................................................................709
GraphClass Properties..............................................................................................710
eShowSBonFirstThread (display on base status bar)........................................710
eSumYMax (calculated maximum node value) ..................................................710
gShowDiagramName (show diagram name on target) ......................................711
gShowDiagramNameV (show diagram value on target) ....................................712
gShowMouse (show mouse coordinates on target) ...........................................713
gShowMouseX (show mouse X coordinate on target) .......................................714
gShowMouseY (show mouse Y coordinate on target) .......................................715
gShowNodeName (show node name on target) ................................................716
gShowNodeNameV (show node name value on target) ....................................717
gShowNodeValue (show node axis values on target)........................................718
gShowNodeValueX (show node x-axis value on target) ....................................719
gShowNodeValueY (show node y-axis value on target) ....................................720
GraphClass Methods ................................................................................................721
AllText (return full graph text information) ..........................................................721
BeginRefresh (prepare drawing of graph class object) ......................................721
CalcBestPositionNodeText (calculate graph text best fit position).....................722
CalcCurrentGraph (calculates values for current graph type)............................722
CalcCurrentNode (calculates values of current node) .......................................723
CalcGraph (calculates all graph object values)..................................................723
CalcPopup (create popup menu for graph object) .............................................724
CalcPopupAdd2 (create popup menu item text for graph object) ......................725
DiagramNameText (create diagram name text).................................................726
DiagramText (create diagram name text with prompts) .....................................726
DiagramNameText (create diagram name text).................................................727
DiagramText (create diagram name text with prompts) .....................................727
Draw (calculate and draw GraphClass object) ...................................................728
DrawGraph (draws calculated values) ...............................................................728
DrawReport (draw graph object on report).........................................................729
DrawWallpaper (draw background wallpaper for graph object) .........................729
DrillDown (transfer control to new graph object) ................................................730
FindNearbyNodes (locate nodes based on mouse position) .............................731
GetMouse (get mouse coordinates in all formats) .............................................732
GetValueFromField (get contents of specified field) ..........................................733
GetValueFromStatusBar (return status bar zone contents) ...............................733
ImageToWMF (Save object and return WMF file name)....................................734
Init (Initialize the graph object) ...........................................................................734
Interactivity (process mouse location data to tool tip or control .........................735
IsOverNode ( is mouse over node location) .......................................................735
Kill (shut down the GraphClass object) ..............................................................736
MouseText (creates text and mouse coordinate information) ............................736
24 ABC Library Reference
IncrementalLocatorClass 777
IncrementalLocatorClass Overview ........................................................................777
IncrementalLocatorClass Properties.........................................................................781
IncrementalLocatorClass Properties ................................................................781
IncrementalLocatorClass Methods ...........................................................................782
IncrementalLocatorClass Methods ...................................................................782
SetAlerts (alert keystrokes for the LIST control:IncrementalLocatorClass) .....782
TakeKey (process an alerted keystroke:IncrementalLocatorClass) .................783
INIClass 785
INIClass Overview ..................................................................................................785
INIClass Properties ...................................................................................................788
INIClass Properties ...........................................................................................788
FileName ..........................................................................................................788
INIClass Methods......................................................................................................789
Fetch (get INI file entries) .................................................................................789
FetchField (return comma delimited INI file value) ...........................................791
FetchQueue (get INI file queue entries) ...........................................................792
Init (initialize the INIClass object) .....................................................................793
TryFetch (get a value from the INI file) .............................................................795
TryFetchField (return comma delimited INI file value) .....................................796
Update (write INI file entries) ............................................................................797
IReportGenerator Interface 799
IReportGenerator Interface .......................................................................................799
IReportGenerator Concepts......................................................................................799
IReportGenerator Methods .......................................................................................799
AskProperties (pop up window to set properties)...............................................799
CloseDocument (end document printing)...........................................................800
ClosePage (end a page print) ............................................................................800
GetProperty (get a property value).....................................................................801
Init (initialize error class before printing) ............................................................801
OpenDocument (begin document printing) ........................................................802
OpenPage (begin a page print) ..........................................................................802
Opened (file opened flag) ................................................................................802
ProcessArc (print an arc)....................................................................................803
ProcessBand (begin/end report band processing).............................................804
ProcessCheck (print a checkbox).......................................................................804
ProcessChord (print a section of an ellipse) ......................................................805
ProcessEllipse (print an ellipse) .........................................................................806
ProcessImage (print an image) ..........................................................................806
ProcessLine (print a line)....................................................................................807
ProcessOption (print an option control)..............................................................807
ProcessRadio (print a radio button)....................................................................808
ProcessRectangle (print a box control) ..............................................................808
ProcessText (print a string or text control) .........................................................809
Contents and Forward 27
PopupClass Methods................................................................................................834
PopupClass Functional Organization--Expected Use ......................................834
AddItem (add menu item) .................................................................................835
AddItemEvent (set menu item action) ..............................................................837
AddItemMimic (tie menu item to a button) .......................................................838
AddMenu (add a menu) ....................................................................................839
AddSubMenu (add submenu) ..........................................................................840
Ask (display the popup menu) ..........................................................................841
DeleteItem (remove menu item) .......................................................................842
DeleteMenu (remove a popup submenu) ........................................................843
GetItemChecked (return toggle item status) ....................................................844
GetItemEnabled (return item status) ................................................................845
GetItems(returns number of popup entries) .....................................................846
GetLastNumberSelection (get last menu item number selected) ...................846
GetLastSelection (return selected item) ...........................................................847
Init (initialize the PopupClass object) ...............................................................848
Kill (shut down the PopupClass object) ............................................................848
Restore (restore a saved menu) ......................................................................849
Save (save a menu for restoration) ..................................................................850
SetIcon (set icon name for popup menu item) ...................................................851
SetItemCheck (set toggle item status) .............................................................852
SetItemEnable (set item status) .......................................................................853
SetLevel (set menu item level) .........................................................................854
SetText (set menu item text) ............................................................................855
SetToolbox (set menu item toolbox status) ........................................................856
SetTranslator (set run-time translator:PopupClass) .........................................857
Toolbox (start the popup toolbox menu) ............................................................858
ViewMenu (popup menu debugger) .................................................................859
PrintPreviewClass 861
PrintPreviewClass Overview ...................................................................................861
PrintPreviewClass Properties ...................................................................................866
AllowUserZoom (allow any zoom factor) ..........................................................866
ConfirmPages (force 'pages to print' confirmation) ..........................................866
CurrentPage (the selected report page) ...........................................................867
Maximize (number of pages displayed horizontally) ........................................867
PagesAcross (number of pages displayed horizontally) ..................................867
PagesDown (number of vertical thumbnails) ...................................................868
PagesToPrint (the pages to print) ....................................................................868
UserPercentile (custom zoom factor) ...............................................................868
WindowPosSet (use a non-default initial preview window position) ................869
WindowSizeSet (use a non-default initial preview window size) ......................869
ZoomIndex (index to applied zoom factor) .......................................................870
PrintPreviewClass Methods ......................................................................................871
PrintPreviewClass Functional Organization--Expected Use ............................871
AskPage (prompt for new report page) ............................................................872
AskPrintPages (prompt for pages to print) .......................................................873
Contents and Forward 29
QueryVisualClass 985
QueryVisualClass: Overview ..................................................................................985
QueryVisualClass Properties ....................................................................................986
QC (reference to the QueryClass) ...................................................................986
Resizer (reference to the WindowResizeClass:QueryVisualClass) ................986
QueryVisualClass Methods.......................................................................................987
Init (initialize the QueryVisual object ) .............................................................987
Kill (shut down the QueryVisual object) ..........................................................988
Reset ( reset the dialog for display:QueryVisualClass ) ..................................989
TakeAccepted (handle query dialog EVENT:Accepted events) ......................990
TakeFieldEvent (a virtual to process field events:QueryVisualClass) .............991
TakeWindowEvent (a virtual to process non-field events:QueryVisualClass) 992
RelationManager 993
RelationManager Overview .....................................................................................993
RelationManager Properties .....................................................................................998
RelationManager Properties .............................................................................998
Me (the primary file's FileManager object) .......................................................998
UseLogout (transaction framing flag) ...............................................................998
RelationManager Methods........................................................................................999
RelationManager Functional Organization--Expected Use ..............................999
AddRelation (set a file relationship) ................................................................1000
AddRelationLink (set linking fields for a relationship) .....................................1002
CancelAutoInc (undo autoincrement) .............................................................1004
Close (close a file and any related files) ........................................................1005
Delete (delete record subject to referential constraints) .................................1006
GetNbFiles(returns number of children) ........................................................1007
GetNbRelations(returns number of relations) ...............................................1007
GetRelation(returns reference to relation manager) .....................................1008
GetRelationType(returns relation type) .........................................................1008
Init (initialize the RelationManager object) .....................................................1009
Kill (shut down the RelationManager object) ..................................................1010
ListLinkingFields (map pairs of linked fields) ..................................................1011
Open (open a file and any related files) .........................................................1012
Save (copy the current record and any related records) ................................1012
SetAlias (set a file alias) .................................................................................1013
SetQuickScan (enable QuickScan on a file and any related files) .................1014
Update (update record subject to referential constraints) ..............................1015
ReportManager Class 1017
ReportManager Overview .....................................................................................1017
ReportManager Concepts .....................................................................................1017
ReportManager Properties......................................................................................1022
Attribute (ReportAttributeManager object) .......................................................1022
BreakMan (BreakManagerClass object) ..........................................................1022
DeferOpenReport (defer open) ......................................................................1023
Contents and Forward 33
Foreword
Welcome
Welcome to the Application Builder Class Library Reference! This book is designed to be
your every day reference to the Classes that lie beneath the templates.
Once you’ve become familiar with the Clarion development environment, through Getting
Started, Learning Clarion and the Online User’s Guide, you will refer to those books less
and less frequently. However, in your day-to-day work, we think you will continue to need
information on the finer points of the various Application Builder Class methods.
That’s why we created this Application Builder Class Library Reference —for every
Clarion developer who wants a quick, ready reference to those Clarion components you
use over and over again.
This book provides in-depth discussions of the ABC Library. It shows you how the ABC
Templates use the powerful ABC Library objects—and how you can use, reuse, and
modify the classes with the ABC Templates or within your hand-coded project.
These are the tools you’ll continue to refer to regardless of your expertise with Clarion.
The depths of information on these tools and the consequent versatility you can achieve
with them is virtually unlimited.
46 ABC Library Reference
Documentation Conventions
Typeface Conventions
Italics Indicates what to type at the keyboard and variable information, such as
Enter This or filename.TXT. Also identifies the title information of dialog
windows, like Procedure Properties.
Courier New Used for diagrams, source code listings, to annotate examples, and for
examples of the usage of source statements.
Keyboard Conventions
F1 Indicates a single keystroke. In this case, press and release the F1 key.
ALT+X Indicates a combination of keystrokes. In this case, hold down the ALT
key and press the X key, then release both keys.
Other Conventions
Special Tips, Notes, and Warnings—information that is not immediately evident from the
topic explanation.
ABC Library Overview 47
In addition, a class library can reduce the amount of programming required to implement
changes to an existing class based program. By deriving classes that incrementally add
to or subtract from the classes in the library, programmers can accomplish substantial
changes without having to rewrite the base classes or the programs that rely on the base
classes.
The Application Builder Classes (ABC Library) provide all the benefits of class libraries in
general. Clarion’s ABC Templates automatically generate code that uses and reuses the
robust, flexible, and solid (pre-tested) objects defined by the ABC Library. Further, the
templates are designed to help you easily derive your own classes based on the ABC
Library.
Of course, you need not use the templates to use the Application Builder Classes.
However, the template generated code certainly provides appropriate examples for using
the ABC Library in hand coded programs. Either way, the bottom line for you is more
powerful programs with less coding.
48 ABC Library Reference
The Application Builder Classes have a fairly specific focus or scope. That is, its objects
are designed to process databases within a Windows environment. Even more
specifically, these objects are designed to support all the standard functionality provided
by prior versions of Clarion, plus a lot more.
As such, there are database related objects that open, read, write, view, search, sort, and
print data files. There are objects that enforce relational integrity between related data
files.
In addition there are general purpose Windows related objects that display error
messages, manage popup menus, perform edit-in-place, manage file-loaded drop-down
lists, perform language translation on windows, resize windows and controls, process
toolbars across execution threads, read and write INI files, and manage selection and
processing of DOS/Windows files.
The point is, the class library supports general purpose database Windows programs; it
does not support, say, real-time process control for oil refineries.
Core Classes
The Application Builder Classes may be logically divided into “core” classes and
“peripheral” classes. The core classes are central to the ABC Library—everything else is
built from them or hangs off them. If you intend to study the Application Builder Classes,
you should begin with the core classes. Further, a thorough understanding of these
classes should give you an excellent foundation for understanding the ABC Template
generated programs and procedures that use these classes.
Even if you want to stay as far away from the ABC Library as possible, you should keep a
couple of things in mind with regard to the core classes:
• Core classes are used repeatedly, so if you must modify them, try to keep them
efficient.
• Core classes are almost certainly in any template based program, so additional
references to them generally won’t affect the size of your executable.
There is a hierarchy within the core classes. The ErrorClass and the FieldPairsClass form
the foundation upon which the FileManager, RelationManager, and ViewManager rest.
Finally, the BrowseClass, which is derived from the ViewManager, tops off the core
classes. The WindowManager is programmed to understand these core classes and
manages window procedures that use them.
ABC Library Overview 49
WindowManager
BrowseClass
ViewManager
RelationManager
FileManager \
/ \
ErrorClass FieldPairsClass
To understand these core classes, we recommend you tackle the core classes first
(ErrorClass and FieldPairsClass), then work your way up to the WindowManager.
The Application Builder Classes are installed by default to the Clarion \LIBSRC folder.
The specific classes reside in the following respective files. The core classes are shown
in bold.
The class declarations reside in the .INC files, and their method definitions reside in the
specified .CLW files.
ABASCII.INC
AsciiFileClass MODULE('ABASCII.CLW')
AsciiPrintClass MODULE('ABASCII.CLW')
AsciiSearchClass MODULE('ABASCII.CLW')
AsciiViewerClass MODULE('ABASCII.CLW')
ABBROWSE.INC
StepClass MODULE('ABBROWSE.CLW')
StepLongClass MODULE('ABBROWSE.CLW')
StepRealClass MODULE('ABBROWSE.CLW')
StepStringClass MODULE('ABBROWSE.CLW')
StepCustomClass MODULE('ABBROWSE.CLW')
LocatorClass MODULE('ABBROWSE.CLW')
StepLocatorClass MODULE('ABBROWSE.CLW')
EntryLocatorClass MODULE('ABBROWSE.CLW')
IncrementalLocatorClass MODULE('ABBROWSE.CLW')
ContractingLocatorClass MODULE('ABBROWSE.CLW')
EditClass MODULE('ABBROWSE.CLW')
BrowseClass MODULE('ABBROWSE.CLW')
ABDROPS.INC
FileDropClass MODULE('ABDROPS.CLW')
FileDropComboClass MODULE('ABDROPS.CLW')
50 ABC Library Reference
ABEIP.INC
EditClass MODULE('ABEIP.CLW')
EditCheckClass MODULE('ABEIP.CLW')
EditColorClass MODULE('ABEIP.CLW')
EditDropListClass MODULE('ABEIP.CLW')
EditEntryClass MODULE('ABEIP.CLW')
EditFileClass MODULE('ABEIP.CLW')
EditFontClass MODULE('ABEIP.CLW')
EditMultiSelectClass MODULE('ABEIP.CLW')
ABERROR.INC
ErrorClass MODULE('ABERROR.CLW')
ABFILE.INC
FileManager MODULE('ABFILE.CLW')
RelationUsage MODULE('ABFILE.CLW')
RelationManager MODULE('ABFILE.CLW')
ViewManager MODULE('ABFILE.CLW')
ABPOPUP.INC
PopupClass MODULE('ABPOPUP.CLW')
ABQUERY.INC
QueryClass MODULE('ABQUERY.CLW')
QueryVisualClass MODULE('ABQUERY.CLW')
QueryFormVisual MODULE('ABQUERY.CLW')
ABREPORT.INC
ProcessClass MODULE('ABREPORT.CLW')
PrintPreviewClass MODULE('ABREPORT.CLW')
ReportManager MODULE('ABREPORT.CLW')
ABRESIZE.INC
WindowResizeClass MODULE('ABRESIZE.CLW')
ABTOOLBA.INC
ToolbarTargetClass MODULE('ABTOOLBA.CLW')
ToolbarListboxClass MODULE('ABTOOLBA.CLW')
ToolbarReltreeClass MODULE('ABTOOLBA.CLW')
ToolbarUpdateClass MODULE('ABTOOLBA.CLW')
ToolbarClass MODULE('ABTOOLBA.CLW')
ABUTIL.INC
ConstantClass MODULE('ABUTIL.CLW')
FieldPairsClass MODULE('ABUTIL.CLW')
BufferedPairsClass MODULE('ABUTIL.CLW')
INIClass MODULE('ABUTIL.CLW')
DOSFileLookupClass MODULE('ABUTIL.CLW')
TranslatorClass MODULE('ABUTIL.CLW’)
ABWINDOW.INC
WindowManager MODULE('ABWINDOW.CLW’)
ABC Library Overview 51
Many of the class declarations directly reference other classes. To resolve these
references, each class header (.INC file) INCLUDEs only the headers containing the
directly referenced classes. This convention maximizes encapsulation, minimizes compile
times, and ensures that all necessary components are present for the make process. We
recommend you follow this convention too.
The Application Builder Classes source code is structured so that you can INCLUDE
either the header or the definition (.CLW file) in your program’s data section. If you
include the header, it references the required definitions and vice versa.
A good rule of thumb is to INCLUDE as little as possible. The compiler will let you know if
you have omitted something.
The ABC Templates instantiate objects from the ABC Library. The default template
generated object names are usually related to the corresponding class names, but they
are not exactly the same. Your ABC applications’ generated code may contain data
declarations and executable statements similar to these:
GlobalErrors ErrorClass
Hide:Access:Customer CLASS(FileManager)
INIMgr INIClass
ThisWindow CLASS(ReportManager)
ThisWindow CLASS(WindowManager)
ThisReport CLASS(ProcessClass)
ThisProcess CLASS(ProcessClass)
BRW1 CLASS(BrowseClass)
EditInPlace::CUS:NAME EditClass
Resizer WindowResizeClass
Toolbar ToolbarClass
CODE
GlobalResponse = ThisWindow.Run()
BRW1.AddSortOrder(BRW1::Sort0:StepClass,ST:StKey)
BRW1.AddToolbarTarget(Toolbar)
GlobalErrors.Throw()
Resizer.AutoTransparent=True
Previewer.AllowUserZoom=True
52 ABC Library Reference
These data declarations instantiate objects from the ABC Library, and the executable
statements reference the instantiated objects. The various ABC classes and their
template instantiations are listed below so you can identify ABC objects in your
applications’ generated code and find the corresponding ABC Library documentation.
Access:file FileManager
BRWn BrowseClass
BRWn::Sortn:Locator LocatorClass
BRWn::Sortn:StepClass StepClass
EditInPlace::field EditClass
FDBn FileDropClass
FDCBn FileDropComboClass
FileLookupN SelectFileClass
GlobalErrors ErrorClass
INIMgr INIClass
QBEn QueryClass
QBVn QueryVisualClass
Popup PopupClass
Previewer PrintPreviewClass
ProgressMgr StepClass
Relate:file RelationManager
RELn::Toolbar ToolbarReltreeClass
Resizer WindowResizeClass
ThisProcess ProcessClass
ThisReport ProcessClass
ThisWindow WindowManager, ReportManager
Toolbar ToolbarClass
ToolbarForm ToolbarUpdateClass
Translator TranslatorClass
ViewerN ASCIIViewerClass
ABC Library Overview 53
Method Names
The following names have a specific meaning in the ABC Library. The names and their
meanings are described below.
AddItem
The object adds an item to its datastore. The item may be a field, a key, a sort order, a
range limit, another object, etc. The item may be anything the object needs to do its job.
Ask[Information]
The method interacts with the end user to get the Information.
Fetch
The method retrieves data from a file.
GetItem
The method returns the value of the named item.
Init
The method does whatever is required to initialize the object.
Kill
The method does whatever is required to shut down the object, including freeing any
memory allocated during its lifetime.
Reset[what or how]
The method resets the object and its controls. This includes reloading data, resetting sort
orders, redrawing window controls, etc.
SetItem
The method sets the value of the named item, or makes the named item active so that
other object methods operate on the active item.
TakeItem
The method “takes” the item from another method or object and continues processing it.
The item may be a window event (Accepted, Rejected, OpenWindow, CloseWindow,
Resize, etc.), a record, an error condition, etc.
54 ABC Library Reference
Throw[Item]
The method “throws” the item to another object or method for handling. The item is
usually an error condition.
ABC Library Overview 55
TryAction
The method makes one attempt to carry out the action, then returns a value indicating
success or failure. A return value of zero (0 or Level:Benign) indicates success; any other
value indicates failure.
• Objects should always be Killed (to free any memory allocated during its lifetime)
Balancing these two (sometimes conflicting) factors dictates that objects Initialized with
EVENT:OpenWindow are usually Killed with EVENT:CloseWindow. Objects Initialized
with ThisWindow.Init are usually Killed with ThisWindow.Kill.
Return Values
Many ABC methods return a value indicating success or failure. A return value of zero (0
or Level:Benign) indicates success. Any other return value indicates a problem whose
severity may vary. Other return values and their ABC severity EQUATEs (Level:User,
Level:Cancel, Level:Notify, Level:Fatal, Level:Program) are documented in the Error
Class chapter and in the individual methods’ documentation. This convention produces
code like the following:
IF ABCObject.Method()
!handle failure / error
ELSE
!continue normally
END
IF ~ABCObject.Method()
!continue normally
END
Some ABC methods process ACCEPT loop events. The names of these methods begin
with “Take” and usually indicate the type of events they handle. These event processing
methods execute within an ACCEPT loop (as implemented by the WindowManager.Ask
method) and return a value indicating how the ACCEPT loop should proceed.
If you (or the ABC Templates) derive a class with any of these methods, you should use
this return value convention to control ACCEPT loop processing.
Following is the WindowManager.Ask method code that implements this convention. See
WindowManager Concepts for more information.
ACCEPT
CASE SELF.TakeEvent()
OF Level:Fatal
BREAK
OF Level:Notify
CYCLE
END
END
Ending a Procedure
In your embedded code you may encounter a condition that requires the procedure to
end immediately (that is, it cannot wait for an EVENT:CloseWindow, or an
EVENT:CloseWindow is not appropriate).
In some cases, a simple RETURN will not end your procedure (because a RETURN
embedded within a derived method ends the method, not the calling procedure), and
even if it would, it might not be appropriate (because the procedure may have allocated
memory or started other tasks that should be ended in a controlled manner).
There are several ways you can initiate the normal shut down of your procedure,
depending on where in the procedure your code is embedded. Following are the
conventional ways to shut down your procedure normally.
RETURN(Level:Fatal) !normal shutdown from ABC derived method
ReturnValue = Level:Fatal !normal shutdown at end of ABC derived method
ThisWindow.Kill !normal shutdown from Procedure Routine
ThisWindow.Kill;RETURN !normal shutdown from Procedure Routine
! called from within ACCEPT loop
PROTECTED Attribute
The PROTECTED attribute specifies that the property or method on which it is placed is
visible only to the methods of the same CLASS or of derived CLASSes. This simply
suggests that the property or method is important to the correct functioning of the
CLASS, and that any changes to these items should be done with care. See
PROTECTED in the Language Reference.
VIRTUAL Attribute
The VIRTUAL attribute allows methods in a parent CLASS to call methods in a derived
CLASS. This has two primary benefits. First, it allows parent CLASSes to delegate the
implementation of certain actions to derived classes; and second, it makes it easy for
derived classes to override these same parent class actions. See VIRTUAL in the
Language Reference.
Virtual methods let you insert custom code into an existing class, without copying or
duplicating the existing code. Furthermore, the existing class calls the virtual methods
(containing the custom code) as part of its normal operation, so you don’t have to
explicitly call them. When TopSpeed updates the existing class, the updates are
automatically integrated into your application simply by recompiling. The existing class
continues to call the virtual methods containing the custom code as part of its normal
operation. This approach gives you many opportunities to customize your ABC
applications while minimizing maintenance issues.
DERIVED Attribute
The DERIVED attribute is similar to the VIRTUAL attribute, except that it must have a
matching prototype in the parent class.
PROC Attribute
The PROC attribute may be placed on a method prototyped with a return value, so you
can call the method and ignore the return value without compiler warnings. See PROC in
the Language Reference.
58 ABC Library Reference
Documentation Conventions
Reference Item and Syntax Diagram
The documentation formats for Properties and Methods are illustrated in the following
syntax diagrams.
Implementation: A description of how the method currently accomplishes its objective. The
implementation may change with each release / version of Clarion.
Example:
FieldOne = FieldTwo + FieldThree !This is a source code example
FieldThree = Method(FieldOne,FieldTwo) !Comments follow the “!” character
Conceptual Example
A description of the type of example to be illustrated. Examples show the concept of how
a specific class is implemented in source code. The demands of brevity and concision
often force the removal of structures which are not essential in illustrating the class.
PROGRAM
MAP
END
! Data structures
CODE
! Code Statements
ASCIIFileClass 61
ASCIIFileClass
ASCIIFileClass Overview
The ASCIIFileClass identifies, opens (read-only), indexes, and page-loads a file's contents into a
QUEUE. The indexing function speeds any additional access of records and supports page-
loading, which in turn allows browsing of very large files.
There are several related classes whose collective purpose is to provide reusable, read-only,
viewing, scrolling, searching, and printing capability for files, including variable length files.
Although these classes are primarily designed for ASCII text and they anticipate using the Clarion
ASCII Driver to access the files, they also work with binary files and with other database drivers.
These classes can be used to build other components and functionality as well.
The classes that provide this read-only functionality and their respective roles are:
The ASCIIViewerClass is derived from the ASCIIFileClass. See ASCIIViewerClass for more
information.
The ASCIIFileClass serves as the foundation to the Viewer procedure template; however, the
ABC Templates do not instantiate the ASCIIFileClass independently of the ASCIIViewerClass.
The ASCIIViewerClass is derived from the ASCIIFileClass, and the Viewer Procedure Template
instantiates the derived ASCIIViewerClass.
The ASCIIFileClass source code is installed by default to the Clarion \LIBSRC folder. The
ASCIIFileClass source code are contained in:
The following example shows a sequence of statements to declare, instantiate, initialize, use, and
terminate an ASCIIFileClass object and related objects.
This example lets the end user select a file, then display it's pathname, total line count, and the
text at a given percentage point within the file.
PROGRAM
MAP
END
INCLUDE('ABASCII.INC') !declare ASCIIFileClass
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
ACCEPT
ASCIIFileClass 63
CASE FIELD()
OF ?NewFileButton !on New File button
IF EVENT() = EVENT:Accepted
CLEAR(FileName)
FileActive=AFile.Reset(FileName) !reset AFile to a new file
IF FileActive
window{PROP:Text}=AFile.GetFileName() !show filename in titlebar
ELSE
window{PROP:Text}='no file selected'
END
END
OF ?Percentile !on Percentile SPIN
CASE EVENT()
OF EVENT:Accepted OROF EVENT:NewSelection
IF FileActive !calculate lineno and get the line
?Line{PROP:Text}=AFile.GetLine(Percentile/100*AFile.GetLastLineNo())
ELSE
?Line{PROP:Text}='no file selected'
END
END
OF ?FileSizeButton !on File Size button
IF EVENT() = EVENT:Accepted
IF FileActive !display total line count
?FileSizeButton{PROP:Text}=AFile.GetLastLineNo()&' Lines'
ELSE
?FileSizeButton{PROP:Text}='0 Lines'
END
END
END
END
IF FileActive THEN AFile.Kill. !shut down AFile object
GlobalErrors.Kill
64 ABC Library Reference
AsciiFileClass Properties
ASCIIFile &FILE
The File property is a reference to the managed file. The File property simply identifies the
managed file for the various ASCIIFileClass methods.
Implementation: The Init method sets the OpenMode property to a hexadecimal value of 42h
(ReadWrite/DenyNone). The ABC Templates override this default with the
appropriate value from the application generator.
The Open method uses the OpenMode property when it OPENs the file for
processing. See the Language Reference for more information on OPEN.
AsciiFileClass Methods
ASCIIFileClass Functional Organization--Expected Use
As an aid to understanding the ASCIIFileClass, it is useful to organize its methods into two large
categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the ASCIIFileClass methods.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
GetLastLineNo return last line number
GetLine return line of text
GetPercentile convert file position to percentage
SetPercentile convert percentage to file position
Occasional Use:
GetFilename return the filename
Reset reset the ASCIIFileClass object
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The FormatLine method is a placeholder for derived classes. It provides an easy
way for you to reformat the text prior to display. The GetLine method calls the
FormatLine method.
Example:
INCLUDE('ABASCII.INC') !declare ASCIIViewerClass
MyViewer CLASS(AsciiViewerClass),TYPE !derive MyViewer class
FormatLine PROCEDURE(*STRING),VIRTUAL !prototype virtual FormatLine
END
Viewer MyViewer,THREAD !declare Viewer object
AsciiFile FILE,DRIVER('ASCII'),NAME('MyText'),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
!program code
Implementation: The GetDOSFileName method uses a SelectFileClass object to get the filename
from the end user.
Example:
MyAsciiFileClass.Reset FUNCTION(*STRING FName)
RVal BYTE(True)
SavePath CSTRING(FILE:MaxFilePath+1),AUTO
CODE
CLOSE(SELF.AsciiFile)
SavePath=PATH()
LOOP
IF ~FName AND ~SELF.GetDOSFilename(FName)
RVal=False
BREAK
END
OPEN(SELF.AsciiFile,ReadOnly+DenyNone)
IF ERRORCODE()
MESSAGE('Can't open ' & FName)
RVal=False
ELSE
BREAK
END
END
IF RVal
SELF.FileSize=BYTES(SELF.AsciiFile)
END
SETPATH(SavePath)
RETURN RVal
GetFilename
The GetFilename method returns the name of the ASCII file.
Implementation: The GetFileName method uses the NAME function. See the Language
Reference for more information.
Example:
INCLUDE('ABASCII.INC') !declare ASCIIViewerClass
Viewer AsciiViewerClass,THREAD !declare Viewer object
Filename STRING(255),THREAD !declare filename variable
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
!program code
MESSAGE('Filename:'&Viewer.GetFilename()) !get the ASCII filename
ASCIIFileClass 69
GetLastLineNo, PROC
The GetLastLineNo method returns the number of the last line in the file, and indexes the entire
file.
Example:
MyViewer.TakeScroll PROCEDURE(UNSIGNED EventNo)
LineNo LONG
CODE
IF FIELD()=SELF.ListBox
IF EVENT() = EVENT:ScrollBottom !on scroll bottom
LineNo = SELF.GetLastLineNo() !index to end of file
SELF.DisplayPage(LineNo-SELF.ListBoxItems+1) !display last page
SELECT(SELF.ListBox,SELF.ListBoxItems) !highlight last row
END
END
70 ABC Library Reference
Implementation: The GetLine method gets a line at position line number from the ASCII file,
extending the index queue if needed. If the index queue already contains the
requested line number then the file is read using the existing offset, otherwise the
index is extended. If the requested line number does not exist in the file, the text
line is cleared and ERRORCODE() set.
Example:
MyViewer.DisplayPage PROCEDURE(LONG LineNo)
LineOffset USHORT,AUTO
CODE
IF LineNo > 0 !line specified?
SELF.ListBoxItems=SELF.ListBox{PROP:Items} !note size of list box
FREE(SELF.DisplayQueue) !free the display queue
SELF.GetLine(LineNo+SELF.ListBoxItems-1) !index to end of page
LOOP LineOffset=0 TO SELF.ListBoxItems-1 !for each listbox line
SELF.DisplayQueue.Line=SELF.GetLine(LineNo+LineOffset) !read ASCII file record
IF ERRORCODE() !on end of file
BREAK ! stop reading
END
ADD(SELF.DisplayQueue) !add to display queue
END
SELF.TopLine=LineNo !note 1st line displayed
DISPLAY(SELF.ListBox) !redraw the list box
END
Example:
SetThumb ROUTINE
!current line is what % thru the file?
PctPos=MyASCIIFile.GetPercentile(MyASCIIFile.TopLine+CHOICE(?ASCIIBox)-1)
?ASCIIBox{PROP:VScrollPos}=PctPos !set thumb to corresponding % position
72 ABC Library Reference
Implementation: The Init method returns one (1) if it accessed the file and is ready to proceed; it
returns zero (0) and calls the Kill method if unable to access the file and cannot
proceed. If the Init method returns zero (0), the ASCIIFileClass object is not
initialized and you should not call its methods.
Example:
Filename STRING(255),THREAD !declare filename variable
FileActive BYTE !declare success/fail switch
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1)
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE !init ASCIIFileClass object with:
FileActive=ASCIIFile.Init(AsciiFile, | ! file label
A1:Line, | ! file field to display
Filename, | ! NAME attribute variable
GlobalErrors) ! ErrorClass object
IF ~FileActive THEN RETURN. !If init failed, don't proceed
ACCEPT !If init succeeded, proceed
IF EVENT() = EVENT:CloseWindow
IF FileActive THEN ASCIIFile.Kill. !If init succeeded, shut down
END !program code
END
Kill
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
Filename STRING(255),THREAD !declare filename variable
FileActive BYTE !declare success/fail switch
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1)
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE !init ASCIIFileClass object with:
FileActive=ASCIIFile.Init(AsciiFile,| ! file label
A1:Line, | ! file field to display
Filename, | ! NAME attribute variable
GlobalErrors) ! ErrorClass object
IF ~FileActive THEN RETURN. !If init failed, don't proceed
ACCEPT !If init succeeded, proceed
IF EVENT() = EVENT:CloseWindow
IF FileActive THEN ASCIIFile.Kill. !If init succeeded, shut down
END
!program code
END
74 ABC Library Reference
Reset( filename )
Implementation: The Reset method calls the GetDOSFileName method to get the filename from
the end user. Reset opens the file and resets any statistics and flags associated
with the selected file.
Example:
AsciiViewerClass.Reset FUNCTION(*STRING Filename)
CODE
FREE(SELF.DisplayQueue)
DISPLAY(SELF.ListBox)
IF ~PARENT.Reset(Filename) THEN RETURN False.
SELF.TopLine=1
SELF.DisplayPage
SELECT(SELF.ListBox,1)
RETURN True
Implementation: The SetLine method is a placeholder for derived classes. The SetPercentile, the
ASCIIViewerClass.AskGotoLine, and the ASCIISearchClass.Ask methods call
the SetLine method.
Example:
MyViewerClass.SetLine PROCEDURE(LONG LineNo) !synchronize LIST with line
number
CODE
SELF.DisplayPage(LineNo) !scroll list to LineNo
!highlight the LineNo line
SELECT(SELF.ListBox,CHOOSE(SELF.TopLine=LineNo,1,LineNo-SELF.TopLine+1))
SetPercentile( percentile )
Implementation: The SetPercentile method positions the file based on a given percentage (usually
determined by the vertical thumb position). SetPercentile extends the index as
required and calls the virtual SetLine method to postion the file.
Example:
MyViewerClass.TakeDrag PROCEDURE(UNSIGNED EventNo)
CODE
IF FIELD()=SELF.ListBox
IF EventNo = EVENT:ScrollDrag
SELF.SetPercentile(SELF.ListBox{PROP:VScrollPos}) !reposition based on thumb
END
END
Implementation: The ValidateLine method is a placeholder method for derived classes. The
ASCIIFileClass calls the ValidateLine method when it initially reads a record.
Example:
MyFileClass.ValidateLine FUNCTION(STRING LineToTest)
CODE
IF LineToTest[1] = '!' !check for ! in column 1
RETURN False !exclude lines with !
ELSE
RETURN True !include all other lines
END
78 ABC Library Reference
ASCIIPrintClass 79
ASCIIPrintClass
ASCIIPrintClass Overview
The ASCIIPrintClass provides the user interface--a simple Print Options dialog--to print one or
more lines from a text file. The ASCIIPrintClass interface lets the end user specify a range of lines
to print, then optionally previews the lines before printing them. The ASCIIPrintClass interface
also provides access to the standard Windows Print Setup dialog.
The ASCIIPrintClass relies on the ASCIIFileClass to read and index the file that it prints. It also
relies on the PrintPreviewClass to provide the on-line preview. It also uses the TranslatorClass to
translate its Print Options dialog text if needed.
The ASCIIViewerClass uses the ASCIIPrintClass to provide the end user with a Print Options
dialog to print one or more lines from the viewed file.
There are several related classes whose collective purpose is to provide reusable, read-only,
viewing, scrolling, searching, and printing capability for files, including variable length files.
Although these classes are primarily designed for ASCII text and they anticipate using the Clarion
ASCII Driver to access the files, they also work with binary files and with other database drivers.
These classes can be used to build other components and functionality as well.
Both the Viewer procedure template and the ASCIIPrintButton control template generate code to
instantiate an ASCIIPrintClass object. The Viewer template accomplishes this by adding a
parameter to the ASCIIViewerClass.Init method. The ASCIIPrintButton template accomplishes
this by declaring an ASCIIPrintClass object and calling the ASCIIViewerClass.AddItem method to
register the ASCIIPrintClass object with the ASCIIViewerClass object.
80 ABC Library Reference
The ASCIIPrintClass source code is installed by default to the Clarion \LIBSRC folder. The
specific ASCIIPrintClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate an ASCIIPrintClass object and related objects.
This example lets the end user select a file, then search and print from it.
MEMBER('viewer.clw')
INCLUDE('ABASCII.INC')
INCLUDE('ABWINDOW.INC')
MAP
MODULE('VIEWE002.CLW')
BrowseFiles PROCEDURE
END
END
BrowseFiles PROCEDURE
FilesOpened BYTE
ViewerActive BYTE(False)
Filename STRING(FILE:MaxFilePath),AUTO,STATIC,THREAD
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
ViewWindow WINDOW('View an ASCII File'),AT(3,7,296,136),SYSTEM,GRAY
LIST,AT(5,5,285,110),USE(?AsciiBox),IMM,FROM('')
BUTTON('&Print...'),AT(7,119),USE(?Print)
BUTTON('&Search...'),AT(44,119),USE(?Search)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
TakeAccepted PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?AsciiBox
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
OPEN(ViewWindow)
SELF.Opened=True
CLEAR(Filename)
ViewerActive=Viewer.Init(AsciiFile,A1:Line,Filename,?AsciiBox,GlobalErrors)
IF ~ViewerActive THEN RETURN Level:Fatal.
Viewer.AddItem(Searcher) !register Searcher with Viewer
Viewer.AddItem(Printer) !register Printer with Viewer
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.TakeAccepted PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.TakeAccepted()
CASE ACCEPTED()
OF ?Print
ThisWindow.Update
IF ViewerActive THEN Viewer.Printer.Ask. !display Print Options dialog
OF ?Search
ThisWindow.Update
IF ViewerActive
IF CHOICE(?AsciiBox)>0 !search from current line
Viewer.Searcher.Ask(Viewer.TopLine+CHOICE(?AsciiBox)-1)
ELSE
Viewer.Searcher.Ask(1) !search from line 1
END
END
END
RETURN ReturnValue
82 ABC Library Reference
AsciiPrintClass Properties
FileMgr (AsciiFileClass object:AsciiPrintClass)
FileMgr &AsciiFileClass, PROTECTED
The FileMgr property is a reference to the AsciiFileClass object that manages the file to print.
The AsciiPrintClass object uses the FileMgr to read the file, manage print range line numbers and
to handle error conditions and messages.
Implementation: The Init method sets the PrintPreview property to false. The PrintLines method
implements the action specified by the PrintPreview property.
Implementation: The AsciiPrintClass does not initialize the Translator property. The
AsciiPrintClass only invokes the Translator if the Translator property is not null.
You can use the AsciiViewerClass.SetTranslator method or a reference
assignment statement to set the Translator property.
AsciiPrintClass Methods
Ask (solicit print specifications)
Ask, VIRTUAL
The Ask method displays a Print Options dialog that prompts the end user for print specifications,
then prints the selected lines subject to those specifications (printer destination, paper orientation,
etc.).
Implementation: The Ask method prompts the end user for print specifications (including the
Windows standard Print Setup dialog), print preview, plus a range of lines to
print. If the user CLICKS the Print button, the Ask method prints the requested
lines to the printer specified by the end user.
Example:
ACCEPT
CASE FIELD()
OF ?PrintButton !on "Print" button
IF EVENT() = EVENT:Accepted !call the Printer.Ask method
IF ViewerActive THEN Viewer.Printer.Ask. !to gather specs and print lines
END
END
END
84 ABC Library Reference
Example:
MyViewerClass.Init FUNCTION(FILE AsciiFile,*STRING FileLine,*STRING Filename,|
UNSIGNED ListBox,ErrorClass ErrHandler,BYTE Enables)
CODE
!program code
IF BAND(Enables,EnableSearch) !if Search flag is on
SELF.Searcher &= NEW AsciiSearchClass !instantiate Searcher object
SELF.Searcher.Init(SELF) !initialize Searcher object
END
IF BAND(Enables,EnablePrint) !if Print flag is on
SELF.Printer &= NEW AsciiPrintClass !instantiate Printer object
SELF.Printer.Init(SELF) !initialize Printer object
END
ASCIIPrintClass 85
If the PrintPreview property is False, the PrintLines method prints the specified lines to the
selected printer.
Example:
IF EVENT() = EVENT:Accepted
IF ACCEPTED() = ?PrintButton
FirstLine=1
LastLine=HighestLine
SELF.PrintLines(FirstLine,LastLine)
POST(EVENT:CloseWindow)
END
END
ASCIISearchClass
ASCIISearchClass Overview
The ASCIISearchClass provides the user interface--a persistent non-MDI Find dialog--to locate
specific text within the browsed file. The ASCIISearchClass interface lets the end user specify the
direction and case sensitivity of the search, and it allows repeating searches ("find next").
The ASCIISearchClass relies on the ASCIIFileClass to read and index the file that it searches. It
also uses the TranslatorClass to translate its Find dialog text if needed.
The ASCIIViewerClass uses the ASCIISearchClass to provide the end user with a Find dialog to
locate text in the viewed file.
There are several related classes whose collective purpose is to provide reusable, read-only,
viewing, scrolling, searching, and printing capability for files, including variable length files.
Although these classes are primarily designed for ASCII text and they anticipate using the Clarion
ASCII Driver to access the files, they also work with binary files and with other database drivers.
These classes can be used to build other components and functionality as well.
The classes that provide this read-only functionality and their respective roles are:
Both the Viewer procedure template and the ASCIISearchButton control template generate code
to instantiate an ASCIISearchClass object. The Viewer template accomplishes this by adding a
parameter to the ASCIIViewerClass.Init method. The ASCIISearchButton template accomplishes
this by declaring an ASCIISearchClass object and calling the ASCIIViewerClass.AddItem method
to register the ASCIISearchClass object with the ASCIIViewerClass object.
The ASCIISearchClass source code is installed by default to the Clarion \LIBSRC folder. The
specific ASCIISearchClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate an ASCIISearchClass object and related objects.
This example lets the end user select a file, then search and print from it.
MEMBER('viewer.clw')
INCLUDE('ABASCII.INC')
INCLUDE('ABWINDOW.INC')
MAP
MODULE('VIEWE002.CLW')
BrowseFiles PROCEDURE
END
END
BrowseFiles PROCEDURE
FilesOpened BYTE
ViewerActive BYTE(False)
Filename STRING(FILE:MaxFilePath),AUTO,STATIC,THREAD
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
ASCIISearchClass 89
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?AsciiBox
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
OPEN(ViewWindow)
SELF.Opened=True
CLEAR(Filename)
ViewerActive=Viewer.Init(AsciiFile,A1:Line,Filename,?AsciiBox,GlobalErrors)
IF ~ViewerActive THEN RETURN Level:Fatal.
Viewer.AddItem(Searcher) !register Searcher with Viewer
Viewer.AddItem(Printer) !register Printer with Viewer
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.TakeAccepted PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.TakeAccepted()
CASE ACCEPTED()
OF ?Print
ThisWindow.Update
IF ViewerActive THEN Viewer.Printer.Ask. !display Print Options dialog
OF ?Search
ThisWindow.Update
IF ViewerActive
IF CHOICE(?AsciiBox)>0 !search from current line
Viewer.Searcher.Ask(Viewer.TopLine+CHOICE(?AsciiBox)-1)
ELSE
Viewer.Searcher.Ask(1) !search from line 1
END
END
END
RETURN ReturnValue
90 ABC Library Reference
AsciiSearchClass Properties
Find (search constraints)
Implementation: The search specification includes the text to search for, the direction in which to
search, and whether or not the search is case sensitive.
The Ask method sets the values of the Find property based on end user input to
the Find dialog. The Setup method sets the values of the Find property for use
without the Ask method. The Next method implements the seach specified by the
Find property.
Implementation: The ASCIISearchClass object uses the LineCounter property to implement "find
next" searches--searches that continue from the current line.
Implementation: The ASCIISearchClass does not initialize the Translator property. The
ASCIISearchClass only invokes the Translator if the Translator property is not
null. You can use the AsciiViewerClass.SetTranslator method to set the
Translator property.
AsciiSearchClass Methods
Ask (solicit search specifications)
Ask Prompts the end user for search specifications then positions to the specified
search value.
startline The offset or position of the line at which to begin the search, typically the current
line position. If omitted, startline defaults to one (1).
The Ask method prompts the end user for search specifications then positions the file to the next
line subject to the search specifications, or issues an appropriate message if the search value is
not found.
Implementation: The Ask method prompts the end user for search specifications including a value
to search for, the direction of the search, and whether the search is case
sensitive. If the user invokes the search (doesn't cancel), the Ask method
positions the file to the next line containing the search value, or issues an
appropriate message if the search value is not found.
Example:
ACCEPT
CASE FIELD()
OF ?PrintButton
IF EVENT() = EVENT:Accepted
IF ViewerActive THEN Viewer.Printer.Ask.
END
OF ?Search !on "search" button
IF EVENT() = EVENT:Accepted
IF ViewerActive !call Searcher.Ask method
StartSearch=CHOOSE(CHOICE(?AsciiBox)>0, | ! passing the currently
Viewer.TopLine+CHOICE(?AsciiBox)-1,1) ! selected line as the
Viewer.Searcher.Ask(StartSearch) ! search's starting point
END
END
END
END
ASCIISearchClass 93
Example:
MyViewerClass.Init FUNCTION(FILE AsciiFile,*STRING FileLine,*STRING Filename,|
UNSIGNED ListBox,ErrorClass ErrHandler,BYTE Enables)
CODE
!program code
IF BAND(Enables,EnableSearch) !if Search flag is on
SELF.Searcher &= NEW AsciiSearchClass !instantiate Searcher object
SELF.Searcher.Init(SELF) !initialize Searcher object
END
IF BAND(Enables,EnablePrint) !if Print flag is on
SELF.Printer &= NEW AsciiPrintClass !instantiate Printer object
SELF.Printer.Init(SELF) !initialize Printer object
END
94 ABC Library Reference
Next, VIRTUAL
The Next method returns the line number of the next line containing the search value specified by
the Ask method.
Implementation: The Ask method calls the Next method. The Next method searches for the
search value and in the direction set by the Ask method. Alternatively, you can
use the Setup method to set the search constraints.
Example:
MyAsciiSearchClass.Ask PROCEDURE
CODE
!procedure code
CASE EVENT()
OF EVENT:Accepted
CASE FIELD()
OF ?NextButton
SELF.LineCounter=SELF.Next()
IF SELF.LineCounter
SELF.FileMgr.SetLine(SELF.LineCounter)
END
!procedure code
Implementation: The ABC Library does not call the Setup method. The Setup method is provided
so you can do custom searches outside the normal AsciiViewerClass process
(without using the Ask method).
The Next method applies the search constraints set by the Setup method. The
constraints include the text to search for, the direction in which to search, and
whether or not the search is case sensitive.
Example:
MyAsciiSearchClass.Ask PROCEDURE
Constraints LIKE(FindGroup)
CODE
Constraints.MatchCase = False !never case sensitive
Constraints.Direction = 'Down' !always search downward
!prompt end user for search value
SELF.Setup(Constraints,StartLine) !set search constraints
SELF.LineCounter=SELF.Next() !execute search
IF SELF.LineCounter
SELF.FileMgr.SetLine(SELF.LineCounter) !set to next line containing search value
ELSE
MESSAGE(''''&CLIP(SELF.Constraints.What)&''' not found.')
END
ASCIIViewerClass
ASCIIViewerClass Overview
There are several related classes whose collective purpose is to provide reusable, read-only,
viewing, scrolling, searching, and printing capability for files, including variable length files.
Although these classes are primarily designed for ASCII text and they anticipate using the Clarion
ASCII Driver to access the files, they also work with binary files and with other database drivers.
These classes can be used to build other components and functionality as well.
The classes that provide this read-only functionality are the ASCII Viewer classes. The ASCII
Viewer classes and their respective roles are:
ASCIIViewerClass
The ASCIIViewerClass uses the ASCIIFileClass, the ASCIIPrintClass, and the ASCIISearchClass
to create a single full featured ASCII file viewer object. This object uses a LIST control to display,
scroll, search, and print the contents of the file. Typically, you instantiate only the
ASCIIViewerClass in your program which, in turn, instantiates the other classes as needed.
ASCIIFileClass
The ASCIIFileClass identifies, opens (read-only), indexes, and page-loads a file's contents into a
QUEUE. The indexing function speeds any reaccess of records and supports page-loading,
which in turn allows browsing of very large files.
ASCIIPrintClass
The ASCIIPrintClass lets the end user specify a range of lines to print, then prints them. It also
provides access to the standard Windows Print Setup dialog.
ASCIISearchClass
The ASCIISearchClass lets the end user specify a search value, case sensitivity, and a search
direction, then scrolls to the next instance of the search value within the file.
98 ABC Library Reference
The ASCIIViewerClass is derived from the ASCIIFileClass, plus it relies on the ASCIIPrintClass,
ASCIISearchClass, ErrorClass, and PopupClass to accomplish some user interface tasks.
Therefore, if your program instantiates the ASCIIViewerClass, it must also instantiate these other
classes. Much of this is automatic when you INCLUDE the ASCIIViewerClass header
(ABASCII.INC) in your program's data section. See the Conceptual Example.
The templates derive a class from the ASCIIViewerClass for each ASCIIViewerClass in the
application. The derived class is called procedure:Viewer# where procedure is the procedure
name and # is the instance number of the ASCIIViewControl template. The templates provide the
derived class so you can use the ASCIIViewControl template Classes tab to easily modify the
viewer's behavior on an instance-by-instance basis.
The object is named Viewer# where # is the instance number of the control template. The derived
ASCIIViewerClass is local to the procedure, is specific to a single ASCIIViewerClass and relies
on the global ErrorClass object.
The ASCIIViewerClass source code is installed by default to the Clarion \LIBSRC folder. The
specific ASCIIViewerClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate an ASCIIViewerClass object and related objects.
This example lets the end user select a file, then browse, scroll, search, and print from it.
PROGRAM
MAP
END
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
AsciiViewerClass Properties
Popup (PopupClass object)
Popup &PopupClass
The Popup property is a reference to the PopupClass object for this ASCIIViewerClass object.
The ASCIIViewerClass object uses the Popup property to define and manage its popup menus.
Implementation: The AddItem and Init methods initialize the Printer property.
The Printer property is added to the AsciiViewer by calling the AddItem method. The AsciiViewer
does not take ownership of these objects, it just uses them if supplied. It is up to the owner of the
objects to destroy them when they are no longer required.
Since these objects are generated by the templates in local procedure scope, they will be
destroyed when the enclosing generated procedure dies. If these objects are created by hand
coding, then they should be destroyed by whoever creates them.
The exception to this is when the EnablePrint parameter is set on the Init call. In this case the
AsciiViewer may create it's own "internal" printer and viewer. In this case, they are destroyed in
the Kill method of the AsciiViewer.
Implementation: The AddItem and Init methods initialize the Searcher property.
The Searcher property is added to the AsciiViewer by calling the AddItem method. The
AsciiViewer does not take ownership of these objects, it just uses them if supplied. It is up to the
owner of the objects to destroy them when they are no longer required.
Since these objects are generated by the templates in local procedure scope, they will be
destroyed when the enclosing generated procedure dies. If these objects are created by hand
coding, then they should be destroyed by whoever creates them.
The exception to this is when the EnableSearch parameter is set on the Init call. In this case the
AsciiViewer may create it's own "internal" viewer. In this case, they are destroyed in the Kill
method of the AsciiViewer.
See Also: AddItem, Init
AsciiViewerClass Methods
AsciiViewerClass Functional Organization--Expected Use
As an aid to understanding the ASCIIViewerClass, it is useful to organize the its methods into two
large categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the ASCIIViewerClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
AskGotoLine go to user specified line
DisplayPage display new page
PageDown scroll down one page
PageUp scroll up one page
TakeEvent process ACCEPT loop event
Occasional Use:
AddItem add printer or searcher object
GetFilenameI return the filename
GetLastLineNoI return last line number
GetLineI return line of text
GetPercentileI convert file position to percentage
Reset reset the ASCIIViewerClass object
SetPercentileI convert percentage to file position
SetLineV position to specific line
SetLineRelative move N lines
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
AddItem( | printer |)
| searcher |
Implementation: The AddItem method sets the value of the Printer or Searcher property, initializes
the printer or searcher, then enables the corresponding popup menu item.
Example:
MyPrinter CLASS(AsciiPrintClass) !declare custom printer object
NewMethod PROCEDURE
END
MySearcher CLASS(AsciiSearchClass) !declare custom searcher object
NewMethod PROCEDURE
END
CODE
Viewer.Init(AsciiFile,A1:line,Filename,?AsciiBox,GlobalErrors)
Viewer.AddItem(MyPrinter) !add print functionality
Viewer.AddItem(MySearcher) !add search functionality
AskGotoLine
The AskGotoLine method prompts the end user for a specific line number to display, then
positions the file to the line nearest the one specified.
Example:
MyViewerClass.TakeEvent PROCEDURE(UNSIGNED EventNo)
CODE
CASE EventNo
OF EVENT:AlertKey
IF KEYCODE()=MouseRight
CASE SELF.Popup.Ask()
OF 'Print'
SELF.Printer.Ask
OF 'Goto'
SELF.AskGotoLine
END
END
END
Example:
MyViewerClass.Reset PROCEDURE(*STRING Filename)
CODE
FREE(SELF.DisplayQueue)
DISPLAY(SELF.ListBox)
PARENT.Reset(Filename)
SELF.TopLine=1
SELF.DisplayPage
SELECT(SELF.ListBox,1)
Implementation: The Init method returns one (1) if it accessed the file and is ready to proceed; it
returns zero (0) and calls the Kill method if unable to access the file and cannot
proceed. If the Init method returns zero (0), the ASCIIViewerClass object is not
initialized and you should not call its methods.
You can set the features value with the following EQUATEs declared in
ASCII.INC. Pass either EQUATE to implement its feature (search or print), or add
the EQUATEs together to implement both features.
EnableSearch BYTE(001b)
EnablePrint BYTE(010b)
Example:
PROGRAM
MAP
END
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
Kill
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
PROGRAM
MAP
END
AsciiFile FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1),THREAD
RECORD RECORD,PRE()
Line STRING(255)
END
END
CODE
IF EVENT() = EVENT:CloseWindow
IF ViewerActive THEN Viewer.Kill. !If init succeeded, shut down
END
!program code
END
ASCIIViewerClass 111
PageDown, PROTECTED
The PageDown method scrolls the display down one "page." A page is the number of lines
displayed in the ASCIIViewerClass object's LIST control.
Example:
MyViewerClass.TakeEvent PROCEDURE(UNSIGNED EventNo)
CODE
IF FIELD()=SELF.ListBox
CASE EventNo
OF EVENT:Scrollup
SELF.SetLineRelative(-1)
OF EVENT:ScrollDown
SELF.SetLineRelative(1)
OF EVENT:PageUp
SELF.PageUp
OF EVENT:PageDown
SELF.PageDown
END
END
112 ABC Library Reference
PageUp, PROTECTED
The PageUp method scrolls the display up one "page." A page is the number of lines displayed in
the ASCIIViewerClass object's LIST control.
Example:
MyViewerClass.TakeEvent PROCEDURE(UNSIGNED EventNo)
CODE
IF FIELD()=SELF.ListBox
CASE EventNo
OF EVENT:Scrollup
SELF.SetLineRelative(-1)
OF EVENT:ScrollDown
SELF.SetLineRelative(1)
OF EVENT:PageUp
SELF.PageUp
OF EVENT:PageDown
SELF.PageDown
END
END
ASCIIViewerClass 113
Reset( filename )
Implementation: The Reset method frees the display QUEUE and calls the ASCIIFileClass.Reset
method to get a new filename from the end user. Reset refills the display QUEUE
and redisplays the list box if a new file was selected.
Example:
AsciiFileClass.Init FUNCTION |
(FILE AsciiFile,*STRING FileLine,*STRING FName,ErrorClass ErrorHandler)
CODE
SELF.AsciiFile&=AsciiFile
SELF.Line&=FileLine
SELF.ErrorMgr&=ErrorHandler
SELF.IndexQueue&=NEW(IndexQueue)
IF ~SELF.Reset(FName)
SELF.Kill
RETURN False
END
RETURN True
Example:
MyViewerClass.AskGotoLine PROCEDURE
LineNo LONG,STATIC
OKGo BOOL(False)
GotoDialog WINDOW('Goto'),AT(,,96,38),GRAY,DOUBLE
SPIN(@n_5),AT(36,4,56,13),USE(LineNo),RANGE(1,99999)
PROMPT('&Line No:'),AT(4,9,32,10),USE(?Prompt1)
BUTTON('&Go'),AT(8,22,40,14),USE(?GoButton)
BUTTON('&Cancel'),AT(52,22,40,14),USE(?CancelButton)
END
CODE
OPEN(GotoDialog)
ACCEPT
CASE EVENT()
OF EVENT:Accepted
CASE ACCEPTED()
OF ?GoButton
OKGo=True
POST(EVENT:CloseWindow)
OF ?CancelButton
POST(EVENT:CloseWindow)
END
END
END
CLOSE(GotoDialog)
IF OKGo THEN SELF.SetLine(LineNo).
Example:
MyViewerClass.TakeScrollOne PROCEDURE(UNSIGNED EventNo)
CODE
IF FIELD()=SELF.ListBox
CASE EventNo
OF EVENT:Scrollup
SELF.SetLineRelative(-1)
OF EVENT:ScrollDown
SELF.SetLineRelative(1)
END
END
116 ABC Library Reference
SetTranslator( translator )
Implementation: The SetTranslator method sets the TranslatorClass object for the PopupClass,
AsciiPrintClass, and AsciiSearchClass objects.
Example:
Viewer AsciiViewerClass !declare Viewer object
Translator TranslatorClass !declare Translator object
CODE
Translator.Init !initialize Translator object
ViewerActive=Viewer.Init( AsciiFile, | ! file label,
A1:line, | ! file field to display
Filename, | ! variable file NAME attribute
?AsciiBox, | ! LIST control number
GlobalErrors, | ! ErrorClass object
EnableSearch+EnablePrint) ! features to implement flag
IF ~ViewerActive THEN RETURN. !if init unsuccessful, don't
! call other Viewer methods
Viewer.SetTranslator(Translator) !enable text translation
!program code
ASCIIViewerClass 117
A return value of zero (0) indicates no CYCLE is needed; any other return value
requires a CYCLE.
Example:
ACCEPT
CASE FIELD()
OF ?AsciiBox
IF ViewerActive
IF Viewer.TakeEvent(EVENT())
CYCLE
END
END
END
END
118 ABC Library Reference
BreakManagerClass 119
BreakManagerClass
BreakManagerClass - Overview
The BreakManagerClass handles embedded break events for a target report. Each break
can perform totaling based on a data element’s contents changing. Breaks can be
nested, allowing the contents of one break result to determine another break result.
Conditional headers and footers can be printed by any break. Each break is totally
customizable through available embed points defined in virtual methods.
BreakManagerClass - Concepts
Each embedded break generated by BreakManager is controlled by a template interface
in the Report Propeties dialog and through a set of embed points generated. Embedded
breaks are designed to give the developer more control “behind the scenes”. The
BreakManager is not related to the traditional Break logic supported by the structure of
the report.
ReportManagerClass
LevelManagerClass
INCLUDE('ABBREAK.INC'),ONCE
INCLUDE('ABBROWSE.INC'),ONCE
INCLUDE('ABREPORT.INC'),ONCE
MAP
INCLUDE('PEOPL005.INC'),ONCE !procedure decl
END
Progress:Thermometer BYTE !
FilesOpened BYTE !
TestCount LONG !
Process:View VIEW(people)
PROJECT(PEO:FirstName)
PROJECT(PEO:Gender)
PROJECT(PEO:Id)
PROJECT(PEO:LastName)
END
LocMyFocusControlExT SHORT(0) !Used by the ENTER Instead of Tab template
LocEnableEnterByTab BYTE(1) !Used by the ENTER Instead of Tab template
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Progress:Thermometer),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?Progress:UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?Progress:PctText),CENTER
BUTTON('Cancel'),AT(45,42,50,15),USE(?Progress:Cancel)
END
BreakManagerClass 121
report REPORT,AT(1000,1540,6000,7458),PRE(RPT),FONT('Arial',10,,),THOUS
HEADER,AT(1000,1000,6000,542)
STRING('People by Last Name’),AT(0,20,6000,220),CENTER,FONT(,,,FONT:bold)
BOX,AT(0,260,6000,280),COLOR(COLOR:Black),FILL(COLOR:Silver)
LINE,AT(1500,260,0,280),COLOR(COLOR:Black)
LINE,AT(3000,260,0,280),COLOR(COLOR:Black)
LINE,AT(4500,260,0,280),COLOR(COLOR:Black)
STRING('Id'),AT(50,310,1400,170),TRN
STRING('First Name'),AT(1550,310,1400,170),TRN
STRING('Last Name'),AT(3050,310,1400,170),TRN
STRING('Gender'),AT(4550,310,1400,170),TRN
END
detail DETAIL,AT(,,6000,281),USE(?unnamed)
LINE,AT(1500,0,0,280),COLOR(COLOR:Black)
LINE,AT(3000,0,0,280),COLOR(COLOR:Black)
LINE,AT(4500,0,0,280),COLOR(COLOR:Black)
STRING(@S10),AT(50,50,1400,170),USE(PEO:Id),RIGHT(1)
STRING(@S30),AT(1550,50,1400,170),USE(PEO:FirstName)
STRING(@S30),AT(3050,50,1400,170),USE(PEO:LastName)
STRING(@S1),AT(4552,52,240,167),USE(PEO:Gender)
STRING(@n_4),AT(5208,42),USE(TestCount),RIGHT(1)
LINE,AT(50,280,5900,0),COLOR(COLOR:Black)
END
FOOTER,AT(1000,9000,6000,219)
STRING(@pPage <<<#p),AT(5250,30,700,135),PAGENO,USE(?PageCount)
END
END
ThisWindow CLASS(ReportManager)
Init PROCEDURE(),BYTE,PROC,DERIVED! Method added to host embed code
Kill PROCEDURE(),BYTE,PROC,DERIVED! Method added to host embed code
OpenReport PROCEDURE(),BYTE,PROC,DERIVED! Method added to host embed code
SetAlerts PROCEDURE(),DERIVED ! Method added to host embed code
TakeWindowEvent PROCEDURE(),BYTE,PROC,DERIVED! Method added to host embed code
END
CODE
GlobalResponse = ThisWindow.Run() !Opens the window and starts an Accept Loop
!---------------------------------------------------------------------------
DefineListboxStyle ROUTINE
!|
!| This routine create all the styles to be shared in this window
!| It's called after the window open
!|
122 ABC Library Reference
!---------------------------------------------------------------------------
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
CODE
GlobalErrors.SetProcedureName('PrintPEO:KeyLastName')
SELF.Request = GlobalRequest ! Store the incoming request
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?Progress:Thermometer
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
SELF.AddItem(Translator)
Relate:people.Open
! File people used by this procedure, so make sure it's RelationManager is open
SELF.FilesOpened = True
BreakMgr.Init() !Initialize the BreakManager object
BreakMgr.AddBreak() !A break exists
BreakMgr.AddLevel() !People Count is the name of the brteak
BreakMgr.AddResetField(PEO:Gender)!resets when gender changes
BreakMgr.AddTotal(TestCount,1) !Performs a count when break occurs
SELF.AddItem(BreakMgr)
BreakManagerClass - Properties
The BreakManagerClass contains no public properties.
BreakManagerClass - Methods
The BreakManagerClass contains the following methods:
AddBreak Identifies to the corresponding report that an embedded break object is active.
The AddBreak method identifies that an embedded break object is active for a corresponding
report. An internal BreakID number is assigned for each break object created. This BreakID is
incremented when a subsequent AddBreak method is executed.
Implementation: The AddBreak method is called for each break object that is active for a report.
Each object is instantiated from the LevelManagerClass. An AddLevel method
follows each AddBreak method.
Example:
BreakMgr.AddBreak() !First Break
BreakMgr.AddLevel() !Auto assign level 1
BreakMgr.AddResetField(PEO:Gender)
BreakMgr.AddTotal(TestCount,1)
BreakMgr.AddBreak() !Second Break
BreakMgr.AddLevel() !Break2
breakid An integer that identifies which internal break to assign this level to.
The AddLevel method identifies the order of break execution that is assigned to a corresponding
report. This is used when nested breaks are assigned, and controls which break is executed first.
Implementation: The AddLevel method is called after each break is added, directly following the
AddBreak method.
Example:
BreakMgr.AddBreak() !First Break
BreakMgr.AddLevel() !Auto assign level 1
BreakMgr.AddResetField(PEO:Gender)
BreakMgr.AddTotal(TestCount,1)
BreakMgr.AddBreak() !Second Break
BreakMgr.AddLevel() !Break2
AddResetField( fieldlabel )
Implementation: The AddResetField method is called after each break and level is added,
directly following the AddLevel method. In the template interface, it is only active
when the Reset on Break option is set to TRUE.
Example:
BreakMgr.AddBreak() !First Break
BreakMgr.AddLevel() !Auto assign level 1
BreakMgr.AddResetField(PEO:Gender) !Reset on break is active
BreakMgr.AddTotal(TestCount,1)
BreakMgr.AddBreak() !Second Break
BreakMgr.AddLevel() !Break2
AddTotal Identify the break total type and optional source/target fields and condition.
target The label of a field that the total result will be stored into.
source The label of a field that the total result will be calculated from.
type A byte that identifies the total type defined for the break.
A count type = 1, average type = 2, sum type = 3.
reset A byte that specifies whether or not the target variable is reset on each
break detected. A value of 1 specifies a reset, zero will not reset the
target value.
condition A valid expression that will force a reset when evaluated to TRUE.
The AddTotal method is an overloaded method that caluculates three types of conditional or
unconditional totaling.
Implementation: The AddTotal method is called after each break and level is added, directly
following the AddResetField method. In the template interface, it is only active
when totaling is added to the break.
Example:
BreakMgr.Init()
BreakMgr.AddBreak()
BreakMgr.AddLevel() !Count Break
BreakMgr.AddResetField(PEO:Gender)
BreakMgr.AddTotal(CountValue,1)
BreakMgr.AddBreak()
BreakMgr.AddLevel() !SumBreak
BreakMgr.AddResetField(PEO:Gender)
BreakMgr.AddTotal(SumValue,SourceToTotal,eBreakTotalSum,1)
BreakMgr.AddBreak()
BreakMgr.AddLevel() !ConditionalAverage
BreakMgr.AddResetField(PEO:Gender)
BreakMgr.AddTotal(AverageValue,SourceToAverage,eBreakTotalAve,0,'PEO:Gender = ''M''')
BreakManagerClass 127
The Init method initializes the BreakManager by clearing any prior entries in the internal Break
Queue, which holds any breaks defined. Normally, the Destruct method also performs a similar
function, but the Init method ensures that the Break Queue is clean before calling the report.
Implementation: The Init method is called prior to the first AddBreak method.
Example:
CODE
GlobalErrors.SetProcedureName('PrintPEO:KeyLastName')
SELF.Request = GlobalRequest ! Store the incoming request
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?Progress:Thermometer
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest) ! Clear GlobalRequest after storing locally
CLEAR(GlobalResponse)
SELF.AddItem(Translator)
Relate:people.Open
SELF.FilesOpened = True
BreakMgr.Init()
BreakMgr.AddBreak()
128 ABC Library Reference
The TakeEnd method is a virtual method that performs any necessary code action prior to the
close of the active break.
Implementation: The TakeEnd method is used by the ABC templates to print a custom footer
detail for the active break. There are embed points available if you need to prime
any variables prior to its printing.
Example:
BreakMgr.TakeEnd PROCEDURE(SHORT BreakId,SHORT LevelId)
CODE
CASE BreakId
END
OF 2
CASE LevelId
OF 1 !SumBreak
PRINT(RPT:sumdetail)
END
OF 3
CASE LevelId
OF 1 !ConditionalAverage
PRINT(RPT:AverageDetail)
END
END
PARENT.TakeEnd(BreakId,LevelId)
BreakManagerClass 129
The TakeStart method is a virtual method that performs any necessary code action prior to the
start of the active break.
Implementation: The TakeStart method is used by the ABC templates to print a custom header
detail for the active break. There are embed points available if you need to prime
any variables prior to its printing.
Example:
BreakMgr.TakeStart PROCEDURE(SHORT BreakId,SHORT LevelId)
CODE
CASE BreakId
OF 1
CASE LevelId
OF 1 !Count Break
PRINT(RPT:CountDetail)
END
OF 3
CASE LevelId
OF 1 !ConditionalAverage
PRINT(RPT:AverageDetail)
END
END
PARENT.TakeStart(BreakId,LevelId)
130 ABC Library Reference
UpdateTotal A virtual method called prior to the start and ending of any break totaling.
The UpdateTotal method is a virtual method that performs any necessary code action prior to the
start and finish of any totaling defined in an active break.
Implementation:
The UpdateTotal method is used by the ABC templates to allow any modifications or extra
cleanup of any totaling performed for an active break. The virtual method embeds provide a
“Before Totaling” and “After Totaling” embed point for every total defined in each break.
BrowseEIPManagerClass 131
BrowseEIPManagerClass
BrowseEIPManagerClass--Overview
The BrowseEIPManagerClass is an EIPManager that displays an Edit-in-place dialog, and
handles events for that dialog. Each BrowseClass utilizing Edit-in-place declares a
BrowseEIPManagerClass to manage the events and processes that are used by each Edit-in-
place field in the browse.
See Also:
BrowseEIPManagerClass Concepts
BrowseEIPManagerClass--Conceptual Example
132 ABC Library Reference
BrowseEIPManagerClass Concepts
Each Edit-in-place control is a window created on top of the browse from which it is called. The
EIPManager dynamically creates an Edit-in-place object and control upon request (Insert,
Change, or Delete) by the end user. When the end user accepts the edited record the
EIPManager destroys the edit-in-place object and control.
See Also:
BrowseEIPManagerClass--Conceptual Example
BrowseEIPManagerClass 133
BrowseClass
The BrowseClass.AskRecord method is the calling method for edit-in-place functionality when
edit-in-place is enabled.
EditClass
The BrowseEIPManager provides the basic or "under the hood" interface between the Edit
classes and the Browse class. All fields in the browse utilizing customized edit-in-place controls
are kept track of by the BrowseEIPManager via the BrowseEditQueue.
BrowseEIPManagerClass--Conceptual Example
The following example shows a sequence of statements to declare, and instantiate a
BrowseEIPManager object. The example page-loads a LIST of actions and associated priorities,
then edits the list items via edit-in-place. Note that the BrowseClass object declares a
BrowseEIPManager which is a refrence to the EIPManager as declared in ABBrowse.INC.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABBROWSE.INC'),ONCE
INCLUDE('ABEIP.INC'),ONCE
INCLUDE('ABWINDOW.INC'),ONCE
MAP
END
Actions FILE,DRIVER('TOPSPEED'),PRE(ACT),CREATE,BINDABLE,THREAD
KeyAction KEY(ACT:Action),NOCASE,OPT
Record RECORD,PRE()
Action STRING(20)
Priority DECIMAL(2)
Completed DECIMAL(1)
END
END
Access:Actions &FileManager
Relate:Actions &RelationManager
GlobalErrors ErrorClass
GlobalRequest BYTE(0),THREAD
ActionsView VIEW(Actions)
END
Queue:Browse QUEUE
ACT:Action LIKE(ACT:Action)
ACT:Priority LIKE(ACT:Priority)
ViewPosition STRING(1024)
END
BrowseWindow WINDOW('Browse Records'),AT(0,0,247,140),SYSTEM,GRAY
LIST,AT(5,5,235,100),USE(?List),IMM,HVSCROLL,MSG('Browsing Records'),|
FORMAT('80L~Action~@S20@8R~Priority~L@N2@'),FROM(Queue:Browse)
BUTTON('&Insert'),AT(5,110,40,12),USE(?Insert),KEY(InsertKey)
BUTTON('&Change'),AT(50,110,40,12),USE(?Change),KEY(CtrlEnter),DEFAULT
BUTTON('&Delete'),AT(95,110,40,12),USE(?Delete),KEY(DeleteKey)
END
BrowseEIPManagerClass 135
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,DERIVED
Kill PROCEDURE(),BYTE,PROC,DERIVED
END
BRW1 CLASS(BrowseClass)
Q &Queue:Browse
Init PROCEDURE|
(SIGNED ListBox,*STRING Posit,VIEW V,QUEUE Q,RelationManager RM,WindowManager WM)
END
BRW1::EIPManager BrowseEIPManager
CODE
GlobalErrors.Init
Relate:Actions.Init
GlobalResponse = ThisWindow.Run()
Relate:Actions.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue =PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?List
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar)
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
Relate:Actions.Open
FilesOpened = True
BRW1.Init|
(?List,Queue:Browse.ViewPosition,BRW1::View:Browse,Queue:Browse,Relate:Actions,SELF)
OPEN(BrowseWindow)
SELF.Opened=True
BRW1.Q &= Queue:Browse
BRW1.AddSortOrder(,ACT:KeyAction)
BRW1.AddLocator(BRW1::Sort0:Locator)
BRW1::Sort0:Locator.Init(,ACT:Action,1,BRW1)
BRW1.AddField(ACT:Action,BRW1.Q.ACT:Action)
BRW1.AddField(ACT:Priority,BRW1.Q.ACT:Priority)
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
136 ABC Library Reference
BRW1.DeleteControl=?Delete
BRW1.AddToolbarTarget(Toolbar)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue =PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Actions.Close
END
RETURN ReturnValue
CODE
PARENT.Init(ListBox,Posit,V,Q,RM,WM)
SELF.EIP &= BRW1::EIPManager
BrowseEIPManagerClass 137
BrowseEIPManagerClass Properties
BrowseEIPManagerClass Properties
The BrowseEIPManagerClass contains the following property and inherits all the properties of the
EIPManagerClass.
BC (browse class)
BC &BrowseClass, PROTECTED
The BC property is a reference to the calling BrowseClass object.
138 ABC Library Reference
BrowseEIPManagerClass Methods
BrowseEIPManagerClass--Functional Organization--Expected Use
As an aid to understanding the EIPManagerClass, it is useful to organize its methods into two
large categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EIPManagerClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeNewSelectionD handle Event:NewSelections
Occasional Use:
ClearColumnD reset column property values
TakeCompletedD process completion of edit
Derived Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are derived, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
ClearColumn, DERIVED
The ClearColumn method checks for a value in the LastColumn property and conditionally sets
the column values to 0.
Example:
BrowseEIPManager.TakeCompleted PROCEDURE(BYTE Force)
SaveAns UNSIGNED,AUTO
Id USHORT,AUTO
CODE
SELF.Again = 0
SELF.ClearColumn
SaveAns = CHOOSE(Force = 0,Button:Yes,Force)
IF SELF.Fields.Equal()
SaveAns = Button:No
ELSE
IF ~Force
SaveAns = SELF.Errors.Message(Msg:SaveRecord,|
Button:Yes+Button:No+Button:Cancel,Button:Yes)
END
END
! code to handle user input from SaveRecord message
Implementation: The Init method primes variables and calls the InitControls method which then
initializes the appropriate edit-in-place controls. It is indirectly called by the
BrowseClass.AskRecord method via a call to an inherited Run method.
Example:
WindowManager.Run PROCEDURE
CODE
IF ~SELF.Init()
SELF.Ask
END
SELF.Kill
RETURN CHOOSE(SELF.Response=0,RequestCancelled,SELF.Response)
Example:
WindowManager.Run PROCEDURE
CODE
IF ~SELF.Init()
SELF.Ask
END
SELF.Kill
RETURN CHOOSE(SELF.Response=0,RequestCancelled,SELF.Response)
TakeCompleted Determines the edit-in-place dialog's action after either a loss of focus or an end
user action.
force An integer constant, variable, EQUATE, or expression that indicates the record
being edited should be saved without prompting the end user.
The TakeCompleted method either saves the record being edited and end the edit-in-place
process, or prompts the end user to save the record and end the edit-in-place process, cancel the
changes and end the edit-in-place process, or remain editing.
Example:
EIPManager.TakeFocusLoss PROCEDURE
CODE
CASE CHOOSE(SELF.FocusLoss&=NULL,EIPAction:Default,BAND(SELF.FocusLoss,EIPAction:Save))
OF EIPAction:Always OROF EIPAction:Default
SELF.TakeCompleted(Button:Yes)
OF EIPAction:Never
SELF.TakeCompleted(Button:No)
ELSE
SELF.TakeCompleted(0)
END
Example:
WindowManager.TakeEvent PROCEDURE
RVal BYTE(Level:Benign)
I USHORT,AUTO
CODE
IF ~FIELD()
RVal = SELF.TakeWindowEvent()
IF RVal THEN RETURN RVal.
END
CASE EVENT()
OF EVENT:Accepted
RVal = SELF.TakeAccepted()
OF EVENT:Rejected
RVal = SELF.TakeRejected()
OF EVENT:Selected
RVal = SELF.TakeSelected()
OF EVENT:NewSelection
RVal = SELF.TakeNewSelection()
OF EVENT:AlertKey
IF SELF.HistoryKey AND KEYCODE() = SELF.HistoryKey
SELF.RestoreField(FOCUS())
END
END
IF RVal THEN RETURN RVal.
BrowseClass
BrowseClass Overview
The BrowseClass is a ViewManager with a user interface for navigating through the result set of
the underlying VIEW.
BrowseClass Concepts
The BrowseClass uses several related classes to provide standard browse functionality--that is,
file-loaded or page-loaded lists with automatic scrolling, searching, ranging, filtering, resets,
conditional colors, conditional icons, etc. These classes can be used to build other components
and functionality as well.
Added to this standard functionality, is Edit-In-Place--that is, you can update the VIEW's primary
file by typing directly into the browse list. No separate update procedure is required, and the
updates are appropriately autoincremented, referentially constrained, and field validated.
Following are the classes that provide this browse functionality. The classes and their respective
roles are:
The BrowseClass is fully documented in the remainder of this chapter. Each related class is
documented in its own chapter.
The BrowseClass is derived from the ViewManager, plus it relies on many of the other Application
Builder Classes (RelationManager, FieldPairsClass, ToolbarClass, PopupClass, etc.) to
accomplish its tasks. Therefore, if your program instantiates the BrowseClass, it must also
instantiate these other classes. Much of this is automatic when you INCLUDE the BrowseClass
header (ABBROWSE.INC) in your program's data section. See the Conceptual Example.
The ABC Templates automatically include all the classes and generate all the code necessary to
support the functionality specified in your application's Browse Procedure and BrowseBox Control
templates.
The templates derive a class from the BrowseClass for each BrowseBox in the application. By
default, the derived class is called BRW# where # is the BrowseBox control template instance
number. This derived class object supports all the functionality specified in the BrowseBox
template.
The derived BrowseClass is local to the procedure, is specific to a single BrowseBox and relies
on the global file-specific RelationManager and FileManager objects for the browsed files. The
templates provide the derived class so you can customize the BrowseBox behavior on a per-
instance basis. See Control Templates--BrowseBox for more information.
The BrowseClass source code is installed by default to the Clarion \LIBSRC folder. The specific
BrowseClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a BrowseClass object and related objects. The example initializes and page-
loads a LIST, then handles a number of associated events, including searching, scrolling, and
updating. When they are initialized properly, the BrowseClass and WindowManager objects do
most of the work (default event handling) internally.
PROGRAM
INCLUDE('ABWINDOW.INC') !declare WindowManager class
INCLUDE('ABBROWSE.INC') !declare BrowseClass
MAP
END
State FILE,DRIVER('TOPSPEED'),PRE(ST),THREAD
StateCodeKey KEY(ST:STATECODE),NOCASE,OPT
Record RECORD,PRE()
STATECODE STRING(2)
STATENAME STRING(20)
END
END
Access:State.Init PROCEDURE
CODE
PARENT.Init(State,GlobalErrors)
SELF.FileNameValue = 'State'
SELF.Buffer &= ST:Record
SELF.AddKey(ST:StateCodeKey,'ST:StateCodeKey',0)
Relate:State.Init PROCEDURE
CODE
Access:State.Init
PARENT.Init(Access:State,1)
150 ABC Library Reference
BrowseClass Properties
BrowseClass Properties
The BrowseClass inherits all the properties of the ViewManager from which it is derived. See
ViewManager Properties for more information.
In addition to the inherited properties, the BrowseClass contains the following properties:
ActiveInvisible BYTE
The ActiveInvisible property indicates whether to fill or refill the browse queue when the browse
LIST is "invisible" because it is on a non-selected TAB or is otherwise hidden. A value of one (1)
refills the queue when the LIST is invisible; a value of zero (0) suppresses the refill.
Setting ActiveInvisible to zero (0) improves performance for procedures with "invisible" browse
lists; however, buffer contents for the invisible browse list are not current and should not be relied
upon.
AllowUnfilled BYTE
The AllowUnfilled property indicates whether to always display a "full" list, or to allow a partially
filled list when the result set "ends" in mid-list. A value of one (1) displays a partially filled list and
improves performance by suppressing any additional reads needed to fill the list; a value of zero
(0) always displays a filled list.
Setting AllowUnfilled to one (1) improves performance for browse lists, especially for those using
SQL data.
Implementation: The ResetQueue method implements the behavior specified by the AllowUnfilled
property.
ArrowAction BYTE
The ArrowAction property indicates the action to take when the end user presses the up or
down arrow key during an edit-in-place process. There are three types of actions that
ArrowAction controls:
The specified actions are implemented by the Ask method. Set the actions by assigning, adding,
or subtracting the following EQUATEd values to ArrowAction. The following EQUATEs are in
ABBROWSE.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0) !save according to the Ask method
Always EQUATE(1) !always save the changes
Never EQUATE(2) !never save the changes
Prompted EQUATE(4) !ask whether to save the changes
Remain EQUATE(8) !continue editing
RetainColumn EQUATE(16) !maintain column position in new row
END
Example:
BRW1.ArrowAction = EIPAction:Prompted !ask to save changes
BRW1.ArrowAction = EIPAction:Prompted+EIPAction:Remain !ask to save, keep editing
!1st editable column
BRW1.ArrowAction = EIPAction:Remain+EIPAction:RetainColumn!default save, keep editing
!same column
AskProcedure USHORT
The AskProcedure property identifies the procedure to update a browse item. A value of zero (0)
uses the BrowseClass object's own AskRecord method to do updates. Any other value uses a
separate procedure registered with the WindowManager object.
Implementation: Typically, the WindowManager object (Init method) sets the value of the
AskProcedure property when a separate update procedure is needed. The Ask
method passes the AskProcedure value to the WindowManager.Run method to
indicate which procedure to execute.
Implementation: The BrowseClass.Init method does not initialize the ChangeControl property. You
should initialize the ChangeControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
Implementation: The CurrentChoice property is updated as the scroll bar for the LIST control is
moved within the Listbox.
The specified actions are implemented by the Ask method. Set the actions by assigning, adding,
or subtracting the following EQUATEd values to ArrowAction. The following EQUATEs are in
ABBROWSE.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0) !save according to the Ask method
Always EQUATE(1) !always save the changes
Never EQUATE(2) !never save the changes
Prompted EQUATE(4) !ask whether to save the changes
Remain EQUATE(8) !continue editing
END
Implementation: The BrowseClass.Init method does not initialize the DeleteControl property. You
should initialize the DeleteControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
The AddEditControl method adds new edit-in-place classes and their associated browse list
columns to the EditList property.
Implementation: You do not need to initialize this property to implement the default edit-in-place
controls. The EditList property supports custom edit-in-place controls.
EIP &BrowseEIPManager
The EIP property is a reference to the BrowseEIPManager class used by this BrowseClass
object.
EnterAction BYTE
The EnterAction property indicates the action to take when the end user presses the ENTER key
during an edit-in-place process.There are two types of actions that EnterAction controls:
The specified actions are implemented by the Ask method. Set the actions by assigning, adding,
or subtracting the following EQUATEd values to ArrowAction. The following EQUATEs are in
ABBROWSE.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0) !save according to the Ask method
Always EQUATE(1) !always save the changes
Never EQUATE(2) !never save the changes
Prompted EQUATE(4) !ask whether to save the changes
Remain EQUATE(8) !continue editing
END
Example:
BRW1.EnterAction = EIPAction:Prompted !ask to save changes
BRW1.EnterAction = EIPAction:Prompted+EIPAction:Remain !ask to save, keep
editing
FocusLossAction BYTE
The FocusLossAction property indicates the action to take with regard to pending changes
when the edit control loses focus during an edit-in-place process.
The specified action is implemented by the Ask method. Set the action by assigning, adding, or
subtracting one of the following EQUATEd values to FocusLossAction. The following EQUATEs
are in ABBROWSE.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0) !save according to the Ask method
Always EQUATE(1) !always save the changes
Never EQUATE(2) !never save the changes
Prompted EQUATE(4) !ask whether to save the changes
END
Example:
BRW1.FocusLossAction = EIPAction:Prompted !ask to save changes
Implementation: The SetAlerts method sets the value of the HasThumb property. The
UpdateThumb method uses the HasThumb property to implement correct thumb
and scroll bar behavior.
Implementation: The ResetQueue method implements the behavior specified by the HideSelect
property.
Implementation: The Init method creates an instance of ILC for the list control. The Kill method
disposes of that interface instance.
Implementation: The BrowseClass.Init method does not initialize the InsertControl property. You
should initialize the InsertControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
The BrowseClass.Init method initializes the ListQueue property. See the Conceptual Example.
The BrowseClass.Init method instantiates the PopupClass object referenced by the Popup
property. See the Conceptual Example.
Implementation: The PrevChoice property is updated as the scroll bar for the LIST control is
moved within the Listbox.
Implementation: The BrowseClass.Init method does not initialize the PrintControl property. You
should initialize the PrintControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
Implementation: Typically, the WindowManager object (Init method) sets the value of the
PrintProcedure property when a Browse Print is called. The Ask method passes
the AskProcedure value to the WindowManager.Run method to indicate which
procedure to execute.
Query &QueryClass
The Query property is a reference to the QueryClass which manages Query-by-Example
processes for the BrowseClass.
Implementation: The BrowseClass.Init method does not initialize the QueryControl property. You
should initialize the QueryControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
A value of zero (0) disables sharing (the query is only active for the tab in which it is set); a value
of 1 enables sharing.
Implementation: The QueryShared property is ser by the Query Button template interface when
the Auto-share between tabs option is checked.
BrowseClass 163
A value of zero (0) disables quick scanning; a non-zero value enables quick scanning. Quick
scanning is the normal way to read records for browsing. However, rereading the buffer may
provide slightly improved data integrity in some multi-user circumstances at the cost of
substantially slower reads.
Implementation: TheBrowseClass.Fetch method implements the faster reads only during the
page-loading process, and only if the QuickScan property is not zero. The
BrowseClass.Fetch method SENDs the 'QUICKSCAN=ON' driver string to the
applicable files' database drivers with the RelationManager.SetQuickScan
method.
Setting RetainRow to one (1) can cause a performance penalty in applications using TopSpeed's
pre-Accelerator ODBC driver.
Implementation: The Init method sets the RetainRow property to one (1). The ResetQueue
method implements the behavior specified by the RetainRow property.
Implementation: The BrowseClass.Init method does not initialize the SelectControl property. You
should initialize the SelectControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
The HideSelect property is only effective when the Selecting property indicates update mode.
Sort &BrowseSortOrder
The Sort property is a reference to a structure containing all the sort information for this
BrowseClass object. The BrowseClass methods use this property to implement multiple sort
orders, range limits, filters, and locators for a single browse list.
Notice this BrowseSortOrder queue contains all the fields in the SortOrder queue
declared in ABFILE.INC as follows:
SortOrder QUEUE,TYPE !VIEW sort information
Filter &FilterQueue !ANDed filter expressions
FreeElement ANY !The Free key element
LimitType BYTE !Range limit type flag
MainKey &KEY !The KEY
Order &STRING !ORDER expression (equal to KEY)
RangeList &FieldPairsClass !fields in the range limit
END
So, the BrowseSortOrder queue is, among other things, a queue of queues.
The AddSortOrder method defines sort orders for the browse. The SetSort
method applies or activates a sort order for the browse. Only one sort order is
active at a time.
StartAtCurrent BYTE
The StartAtCurrent property indicates whether the BrowseClass object initially positions to the
first item in the sort order or positions to the item specified by the contents of the Browse's view
buffer. A value of zero (0 or False) positions to the first item; a value of one (1 or True) positions
to the item specified by the contents of the view buffer.
Implementation: The SetSort method implements the StartAtCurrent initial position. The SetSort
method positions the browse list based on the contents of the fields in the active
sort order, including the free element field.
Example:
BRW1.StartAtCurrent = True
ST:StateCode = 'K' !set key component value
BrowseSt.Init(?StList,StateQ.ViewPosition,StView,StateQ,Relate:State,SELF)
TabAction BYTE
The TabAction property indicates the action to take when the end user presses the TAB key
during an edit-in-place process. There are two types of actions that TabAction controls:
The specified actions are implemented by the Ask method. Set the actions by assigning, adding,
or subtracting the following EQUATEd values to TabAction. The following EQUATEs are in
ABBROWSE.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0) !save according to the Ask method
Always EQUATE(1) !always save the changes
Never EQUATE(2) !never save the changes
Prompted EQUATE(4) !ask whether to save the changes
Remain EQUATE(8) !continue editing
END
Example:
BRW1.TabAction = EIPAction:Prompted !ask to save changes
BRW1.TabAction = EIPAction:Prompted+EIPAction:Remain !ask to save, keep
editing
Toolbar &ToolbarClass
The Toolbar property is a reference to the ToolbarClass for this BrowseClass object. The
ToolbarClass object collects toolbar events and passes them on to the active ToolbarTarget
object for processing.
The ToolbarClass.SetTarget method sets the active target for a ToolbarClass object.
Implementation: The ToolbarClass object for a browse is the object that detects toolbar events,
such as scroll down or page down, and passes them on to the active
ToolbarListBoxClass (ToolbarTarget) object. In the standard template
implementation, there is a single global toolbar, and a ToolbarClass object per
procedure that may drive several different browses and forms, each of which is a
ToolbarTarget. Only one ToolbarTarget is active at a time.
ToolbarItem &ToolbarListBoxClass
The ToolbarItem property is a reference to the ToolbarListBoxClass for this BrowseClass object.
The ToolbarListBoxClass (ToolbarTarget) object receives toolbar events (from a ToolbarClass
object) and processes them.
The ToolbarClass.SetTarget method sets the active target for a ToolbarClass object.
Implementation: The ToolbarClass object for a browse is the object that detects toolbar events,
such as scroll down or page down, and passes them on to the active
ToolbarListBoxClass (ToolbarTarget) object. In the standard template
implementation, there is a single global toolbar, and a ToolbarClass object per
procedure that may drive several different browses and forms, each of which is a
ToolbarTarget. Only one ToolbarTarget is active at a time.
Implementation: The BrowseClass.Init method does not initialize the ToolControl property. You
should initialize the ToolControl property after the BrowseClass.Init method is
called. See the Conceptual Example.
BrowseClass Methods
BrowseClass Methods
The BrowseClass inherits all the methods of the ViewManager from which it is derived. See
ViewManager Methods for more information.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
ApplyRange conditionally range limit and filter the records
Fetch loads a page of items into the browse list
Kill shut down the BrowseClass object
Next get the next record from the browse view
Previous get the previous record from the browse view
ResetI reset the view position
ResetFromAsk reset browse object after update
ResetFromBuffer refill queue based on current record buffer
ResetFromFile refill queue based on FILE POSITION
ResetFromView reset browse object to its result set
ResetQueue fill or refill the browse queue
ScrollEnd scroll to the first or last item
ScrollOne scroll up or down one item
ScrollPage scroll up or down one page of items
SetAlerts alert keys for list, locator, and edit controls
SetQueueRecord copy data from file buffer to queue buffer
SetSort apply sort order to browse
ResetSort apply sort order to browse
TakeKey process an alerted keystroke
TakeEvent process the current ACCEPT loop event
TakeNewSelection process a new browse list item selection
TakeScroll process a scroll event
TakeVCRScroll process a VCR scroll event
UpdateBuffer copy data from queue buffer to file buffer
UpdateViewRecord copy selected item to corresponding file buffers
UpdateWindow apply pending scroll, locator, range, etc.
Implementation: You do not need to call this method to use the default editclass. If you do not call
the AddEditControl method for a browse list column, the BrowseClass
automatically instantiates the EditClass declared in ABBROWSE.INC for that
column.
Example:
INCLUDE('ABBROWSE.INC') !declare browse & related classes
INCLUDE('MYCOMBO.INC') !declare custom Edit-in-place control class
!other browse class declarations
CODE
MyBrowse.AddEditControl(,1) !column 1 not editable
MyBrowse.AddEditControl(ComboClass,2) !edit column 2 with combo control
AddField Identifies the corresponding FILE and QUEUE fields for a browse list column.
filefield The fully qualified label of the FILE field or memory variable. The filefield is the
original source of the browse LIST's data.
queuefield The fully qualified label of the corresponding QUEUE field. The queuefield is
loaded from the filefield, and is the immediate source of the browse LIST's data.
The AddField method identifies the corresponding FILE and QUEUE fields for a browse list
column. You must call AddField for each column displayed in the browse list.
You may also use the AddField method to pair memory variables with QUEUE fields by
specifying a variable label as the filefield parameter.
Implementation: For browses with edit-in-place, you must add fields (call the AddField method) in
the same sequence that you declare the browse QUEUE fields.
Example:
INCLUDE('ABBROWSE.INC') !declare browse & related classes
States FILE,DRIVER('TOPSPEED'),PRE(StFile) !declare States file
ByCode KEY(StFile:Code),NOCASE,OPT
Record RECORD,PRE()
Code STRING(2)
Name STRING(20)
END
END
StQType QUEUE,TYPE !declare the St QUEUE type
Code LIKE(StFile:Code)
Name LIKE(StFile:Name)
Position STRING(512)
END
BrowseStClass CLASS(BrowseClass),TYPE !declare the BrowseSt CLASS
Q &StQType
END
StQ StQType !declare the (real) StQ QUEUE
BrowseSt BrowseStClass !declare the BrowseSt object
CODE
BrowseSt.AddField(StFile:Code,BrowseSt.Q.Code) !pair up fields in
BrowseSt.AddField(StFile:Name,BrowseSt.Q.Name) !FILE & QUEUE
176 ABC Library Reference
AddItem(RecordProcessor)
AddLocator( locator )
Implementation: The specified locator is sort order specific--it is enabled only when the associated
sort order is active. The SetSort method applies or activates a sort order for the
browse. Only one sort order is active at a time.
Example:
BrowseSt.AddSortOrder(BrowseSt:Step,StFile:ByCode) !add sort order and
BrowseSt.AddLocator(BrowseSt:Locator) !associated locator
BrowseSt:Locator.Init(?Loc,StFile:StCode,1,BrowseSt)!init locator object
AddResetField( resetfield)
AddResetField Specifies a field that resets the browse list when the contents of the field
changes.
resetfield The label of the field to monitor for changes.
For the active sort order (defined by the preceding call to the AddSortOrder or SetSort method),
the AddResetField method specifies a field that the browse object monitors for changes, then,
when the contents of the field changes, refreshes the browse list. Typically, you call the
AddResetField method immediately after the AddSortOrder method.
You may call AddResetField multiple times to establish multiple reset fields for a sort order.
Implementation: The specified resetfield is sort order specific--it is enabled only when the
associated sort order is active. The SetSort method sets the active sort order for
the browse. SetSort also calls ApplyRange to monitor the reset fields for changes
and SetSort resets the browse when a change occurs.
Example:
BrowseSt.AddSortOrder(BrowseSt:Step,StFile:ByCode) !add sort order
BrowseSt.AddLocator(BrowseSt:Locator) !and associated locator
BrowseSt.AddResetField(Local:StFilter) !and associated reset field
The AddLocator method adds an associated locator for the sort order defined by the preceding
call to AddSortOrder.
The AddResetField method adds an associated reset field for the sort order defined by the
preceding call to AddSortOrder. You may add multiple reset fields for each sort order with
multiple calls to AddResetField.
The inherited AddRange method adds an associated range limit for the sort order defined by the
preceding call to AddSortOrder.
Implementation: The AddSortOrder method adds an entry at a time to the Sort property.
Example:
BrowseSt.AddSortOrder(BrowseSt:Step,StFile:ByCode) !add sort order
BrowseSt.AddLocator(BrowseSt:Locator) !and associated locator
BrowseSt.AddResetField(Local:StFilter) !and associated reset field
AddToolbarTarget( toolbar )
AddToolbarTarget Registers the browse list as a potential target of the specified toolbar.
toolbar The label of the ToolbarClass object that directs toolbar events to this
BrowseClass object.
The AddToolbarTarget method registers the BrowseClass object as a potential target of the
specified toolbar.
The ToolbarClass.SetTarget method sets the active target for a ToolbarClass object.
Implementation: The Toolbar object for a browse is the object that detects toolbar events, such as
scroll down or page down, and passes them on to the active ToolbarTarget
object. In the standard template implementation, there is a single global toolbar,
and a Toolbar object per procedure that may drive several different browses and
forms, each of which is a ToolbarTarget. Only one ToolbarTarget is active at a
time.
Example:
BrowseSt.AddToolbarTarget(Browse:Toolbar) !tie BrowseSt object to Toolbar object
BrowseZIP.AddToolbarTarget(Browse:Toolbar) !tie BrowseZIP object to Toolbar object
!program code
Browse:Toolbar.SetTarget(?StList) !state list is current toolbar target
!program code
Browse:Toolbar.SetTarget(?ZIPList) !ZIP list is current toolbar target
The inherited AddRange method adds an associated range limit for each sort order. The
AddResetField method establishes reset fields for each browse sort order.
Implementation: The ApplyRange method returns one (1) if a screen redraw is required or zero (0)
if no redraw is required.
Example:
IF BrowseSt.ApplyRange() !refresh browse queue if things changed
DISPLAY(?StList) !redraw LIST if queue refreshed
END
The TakeEvent method calls the Ask method. The Ask method assumes the
UpdateViewRecord method has been called to ensure correct record buffer
contents.
Return value EQUATEs are declared in \LIBSRC\TPLEQU.CLW:
RequestCompleted EQUATE (1) !Update Completed
RequestCancelled EQUATE (2) !Update Aborted
Example:
BrowseClass.TakeEvent PROCEDURE
!procedure data
CODE
!procedure code
CASE ACCEPTED()
OF SELF.DeleteControl
SELF.Window.Update()
SELF.Ask(DeleteRecord) !delete a browse item
OF SELF.ChangeControl
SELF.Window.Update()
SELF.Ask(ChangeRecord) !change a browse item
OF SELF.InsertControl
SELF.Window.Update()
SELF.Ask(InsertRecord) !insert a browse item
182 ABC Library Reference
OF SELF.SelectControl
SELF.Window.Response = RequestCompleted
POST(EVENT:CloseWindow)
ELSE
SELF.TakeAcceptedLocator
END
Example:
BrowseClass.Ask PROCEDURE(BYTE Req)
Response BYTE
CODE
LOOP
SELF.Window.VCRRequest = VCR:None
IF Req=InsertRecord THEN
SELF.PrimeRecord
END
IF SELF.AskProcedure
Response = SELF.Window.Run(SELF.AskProcedure,Req) !do edit-in-place update
SELF.ResetFromAsk(Req,Response)
ELSE
Response = SELF.AskRecord(Req)
END
UNTIL SELF.Window.VCRRequest = VCR:None
RETURN Response
Example:
ScrollOne PROCEDURE(SIGNED Event)
CODE
IF Event = Event:ScrollUp AND CurrentChoice > 1
CurrentChoice -= 1
ELSIF Event = Event:ScrollDown AND CurrentChoice < RECORDS(ListQueue)
CurrentChoice += 1
ELSE
ItemsToFill = 1
MyBrowse.Fetch( CHOOSE( Event = EVENT:ScrollUp, FillForward, FillBackward ))
END
Example:
186 ABC Library Reference
Kill, VIRTUAL
The Kill method shuts down the BrowseClass object.
Implementation: Among other things, the BrowseClass.Kill method calls the PARENT.Kill
(ViewManager.Kill) method to shut down the browse's ViewManager object. See
View Manager for more information.
Example:
CODE !Setup the BrowseClass object:
BrowseState.Init(?StateList,| ! identify its LIST control,
StateQ.Position, | ! its VIEW position string,
StateView, | ! its source/target VIEW,
StateQ, | ! the LIST's source QUEUE,
Relate:State | ! the primary file RelationManager
ThisWindow) ! the WindowManager
!program code
Next, VIRTUAL
The Next method gets the next record from the browse view and returns a value indicating its
success or failure.
Next returns Level:Benign if successful, Level:Notify if it reached the end of the file, and
Level:Fatal if it encountered a fatal error.
Implementation: Corresponding return value EQUATEs are declared in ABERROR.INC. See Error
Class for more information on these severity level EQUATEs.
Level:Benign EQUATE(0)
Level:User EQUATE(1)
Level:Program EQUATE(2)
Level:Fatal EQUATE(3)
Level:Cancel EQUATE(4)
Level:Notify EQUATE(5)
Example:
CASE MyBrowse.Next() !get next record
OF Level:Benign !if successful, continue
OF Level:Fatal !if fatal error
RETURN ! end this procedure
OF Level:Notify !if end of file reached
MESSAGE('Reached end of file.') ! acknowledge EOF
END
Example:
IF SELF.ListQueue.Records()
SELF.CurrentChoice = SELF.ILC.Choice()
SELF.ListQueue.Fetch(SELF.CurrentChoice)
WATCH(SELF.View)
REGET(SELF.View,SELF.ListQueue.GetViewPosition())
RC = ERRORCODE()
IF
RC = NoDriverSupport
Pos = POSITION (SELF.View)
RESET(SELF.View,SELF.ListQueue.GetViewPosition())
WATCH(SELF.View)
NEXT(SELF.View)
RC = ERRORCODE()
RESET(SELF.View,Pos)
END
IF RC <> 0
SELF.NeedRefresh = SELF.NotifyUpdateError()
END
END
PostNewSelection
The PostNewSelection method posts an EVENT:NewSelection to the browse list to support
scrolling, inserts, deletes, and other changes of position within the browse list.
Example:
UpdateMyBrowse ROUTINE
!update code
MyBrowse.ResetFromFile !after insert or change, reload Q from file
MyBrowse.PostNewSelection !after update, post a new selection event
!so window gets properly refreshed
BrowseClass 191
Previous, VIRTUAL
The Previous method gets the previous record from the browse view and returns a value
indicating its success or failure.
Implementation: Returns Level:Benign if successful, Level:Notify if it reached the end of the file,
and Level:Fatal if it encountered a fatal error. Corresponding severity level
EQUATEs are declared in ABERROR.INC. See Error Class for more information
on error severity levels.
Level:Benign EQUATE(0)
Level:User EQUATE(1)
Level:Program EQUATE(2)
Level:Fatal EQUATE(3)
Level:Cancel EQUATE(4)
Level:Notify EQUATE(5)
Example:
CASE MyBrowse.Previous() !get previous record
OF Level:Benign !if successful, continue
OF Level:Fatal !if fatal error
RETURN ! end this procedure
OF Level:Notify !if end of file reached
MESSAGE('Reached end of file.')! acknowledge EOF
END
Example:
DeleteMyBrowse ROUTINE
!delete code
MyBrowse.Records() !disable delete button (and menu) if no items
ResetFields(reinitialize FieldPairsClass)
ResetFields
The ResetFields method reinitializes the FieldPairs recognized by the FieldPairsClass.
Implementation: The ResetFields method reinitializes the FieldPairs by first disposing the
FieldsPairsClass and then initializing the FieldPairsClass.
Implementation: The Ask and AskRecord methods call ResetFromAsk as needed to reset the
BrowseClass object.
Example:
BrowseClass.Ask PROCEDURE(BYTE Req)
Response BYTE
CODE
LOOP
SELF.Window.VCRRequest = VCR:None
IF Req=InsertRecord THEN
SELF.PrimeRecord
END
IF SELF.AskProcedure
Response = SELF.Window.Run(SELF.AskProcedure,Req)
SELF.ResetFromAsk(Req,Response) !reset the browse after update
ELSE
Response = SELF.AskRecord(Req)
END
UNTIL SELF.Window.VCRRequest = VCR:None
RETURN Response
ResetFromBuffer, VIRTUAL
The ResetFromBuffer method fills or refills the browse queue starting from the record in the
primary file buffer (and secondary file buffers if applicable). If the record is found,
ResetFromBuffer fills the browse queue starting from that record. If the record is not found,
ResetFromBuffer fills the browse queue starting from the nearest matching record.
If the active sort order (key) allows duplicates and duplicate matches exist, ResetFromBuffer fills
the browse queue starting from the first matching record.
Tip: Use ResetFromBuffer when the primary and secondary file positions and values
are valid, but the result set may no longer match the buffer values. For example,
after a locator or scrollbar thumb move.
Example:
IF EVENT() = EVENT:ScrollDrag !if thumb moved
IF ?MyList{PROP:VScrollPos} <= 1 !handle scroll to top
POST(Event:ScrollTop, ?MyList)
ELSIF ?MyList{PROP:VScrollPos} = 100 !handle scroll to bottom
POST(Event:ScrollBottom, ?MyList)
ELSE !handle intermediate scroll
MyBrowse.Sort.FreeElement =
MyBrowse.Sort.Step.GetValue(?MyList{PROP:VScrollPos})
MyBrowse.ResetFromBuffer !and reload the queue from that point
END
END
ResetFromFile, VIRTUAL
The ResetFromFile method fills or refills the browse queue starting from the current POSITION
of the primary file. If no POSITION has been established, ResetFromFile fills the browse queue
starting from the beginning of the file.
Tip: Use ResetFromFile when the primary file position is valid but secondary records
and their contents may not be. For example, when returning from an update.
Implementation: ResetFromFile succeeds even if the record buffer is cleared and is typically used
to get the current record after an update.
Example:
MyBrowseClass.ResetFromAsk PROCEDURE(*BYTE Request,*BYTE Response)
CODE
IF Response = RequestCompleted
FLUSH(SELF.View)
IF Request = DeleteRecord
DELETE(SELF.ListQueue)
SELF.ResetQueue(Reset:Queue) !refill queue after delete
ELSE
SELF.ResetFromFile !refill queue after insert or change
END
ELSE
SELF.ResetQueue(Reset:Queue)
END
BrowseClass 197
ResetFromView, VIRTUAL
The ResetFromView method resets the BrowseClass object to conform to the current result set.
Tip: Use ResetFromView when you want to reset for any changes that may have
happened to the entire record set, such as new records added or deleted by other
workstations.
Example:
BRW1.ResetFromView PROCEDURE
ForceRefresh:Cnt LONG
CODE
SETCURSOR(Cursor:Wait)
SELF.Reset
LOOP
CASE SELF.Next()
OF Level:Notify
BREAK
OF Level:Fatal
RETURN
END
SELF.SetQueueRecord
ForceRefresh:Cnt += 1
END
ForceRefresh = ForceRefresh:Cnt
SETCURSOR()
198 ABC Library Reference
A resetmode value of Reset:Queue usually produces a more efficient queue refill than
Reset:Done.
Example:
DeleteMyBrowse ROUTINE
!delete code
MyBrowse.ResetQueue(Reset:Queue) !after delete, refresh Q
MyBrowse.PostNewSelection !after delete, post a new selection event
!so window gets properly refreshed
ResetResets, PROTECTED
The ResetResets method copies the current values of the Reset fields so any subsequent
changes in their contents can be detected.
The AddResetField method adds an associated reset field for the sort order defined by the
preceding call to AddSortOrder. You may add multiple reset fields for each sort order with
multiple calls to AddResetField.
Example:
MyBrowse.CheckReset PROCEDURE
IF NOT SELF.Sort.Resets.Equal() !if reset fields changed,
SELF.ResetQueue(Reset:Queue) !refresh Q
SELF.ResetResets !take a new copy of the reset field values
END
Tip: Use ResetSort followed by UpdateWindow to refresh and redisplay your ABC
BrowseBoxes. Or, use the WindowManager.Reset method.
Implementation: The ResetSort method calls the SetSort method to applt the current sort order.
The ABC Templates override the ResetSort method to apply the sort order based
on the selected tab.
Example:
BRW1.ResetSort FUNCTION(BYTE Force) !apply appropriate sort order
CODE
IF CHOICE(?CurrentTab) = 1 !If 1st tab selected
RETURN SELF.SetSort(1,Force) !apply first sort order
ELSE !otherwise
RETURN SELF.SetSort(2,Force) !apply second sort order
END
Example:
BrowseClass.TakeScroll PROCEDURE( SIGNED Event )
CODE
IF RECORDS(SELF.ListQueue)
CASE Event
OF Event:ScrollUp OROF Event:ScrollDown
SELF.ScrollOne( Event )
OF Event:PageUp OROF Event:PageDown
SELF.ScrollPage( Event )
OF Event:ScrollTop OROF Event:ScrollBottom
SELF.ScrollEnd( Event )
END
END
Example:
BrowseClass.TakeScroll PROCEDURE( SIGNED Event )
CODE
IF RECORDS(SELF.ListQueue)
CASE Event
OF Event:ScrollUp OROF Event:ScrollDown
SELF.ScrollOne( Event )
OF Event:PageUp OROF Event:PageDown
SELF.ScrollPage( Event )
OF Event:ScrollTop OROF Event:ScrollBottom
SELF.ScrollEnd( Event )
END
END
Example:
BrowseClass.TakeScroll PROCEDURE( SIGNED Event )
CODE
IF RECORDS(SELF.ListQueue)
CASE Event
OF Event:ScrollUp OROF Event:ScrollDown
SELF.ScrollOne( Event )
OF Event:PageUp OROF Event:PageDown
SELF.ScrollPage( Event )
OF Event:ScrollTop OROF Event:ScrollBottom
SELF.ScrollEnd( Event )
END
END
SetAlerts, VIRTUAL
The SetAlerts method alerts standard keystrokes for the browse's list control and for any
associated locator controls.
The BrowseClass.SetAlerts method also sets up a popup menu for the browse
list that mimics the behavior of any control buttons (insert, change, delete,
select).
Example:
PrepareStateBrowse ROUTINE !Setup the BrowseClass object:
BrowseState.Init(?StateList,| ! identify its LIST control,
StateQ.Position, | ! its VIEW position string,
StateView, | ! its source/target VIEW,
StateQ, | ! the LIST's source QUEUE,
Relate:State) ! and primary file RelationManager
BrowseState.SetAlerts !alert LIST and locator keystrokes
The SetLocatorFromSort method uses the first field of the sort as the locator field if there is a
sort order active.
Implementation: None
206 ABC Library Reference
SetQueueRecord, VIRTUAL
The SetQueueRecord method copies corresponding data from the filefield fields to the
queuefield fields specified by the AddField method. Typically these are the file buffer fields and
the browse list's queue buffer fields so that the queue buffer matches the file buffers.
Example:
MyBrowseClass.SetQueueRecord PROCEDURE
CODE
SELF.Fields.AssignLeftToRight !copy data from file to q buffer
SELF.ViewPosition = POSITION( SELF.View )!set the view position
!your custom code here
The order value is typically a value returned by the AddSortOrder method which identifies the
particular sort order. Since AddSortOrder returns sequence numbers, a value of one (1) applies
the sort order specified by the first call to AddSortOrder; two (2) applies the sort order specified
by the next call to AddSortOrder; etc. A value of zero (0) applies the default sort order.
Example:
IF FIELD() = ?FirstTab !if first tab selected
IF MyBrowse.SetSort(1,0) !apply the first sort order
MyBrowse.ResetThumbLimits !if sort changed, reset thumb limits
END
MyBrowse.UpdateBuffer !update file buffer from selected item
END
TakeAcceptedLocator, VIRTUAL
The TakeAcceptedLocator method applies an accepted locator value to the browse list--the
BrowseClass object scrolls the list to the requested item.
Locators with entry controls are the only locators whose values are accepted. Other types of
locators are invoked in other ways, for example, with alerted keys. Locator values are accepted
whenthe end user TABS off or otherwise switches focus away from the locator's entry control.
Example:
IF FIELD() = ?MyLocator !focus on locator field
IF EVENT() = EVENT:Accepted !if accepted
MyBrowse.TakeAcceptedLocator !BrowseClass object handles it
END
END
See Also: AddLocator
BrowseClass 209
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the BrowseClass object.
The TakeEvent method handles all events associated with the browse list except a new selection
event. The TakeNewSelection method handles new selection events for the browse.
Implementation: TakeKey returns one (1) if any action is taken, otherwise it returns zero (0).
Example:
IF FIELD() = ?MyBrowseList !focus on browse list
IF EVENT() EVENT:AlertKey !if alerted keystroke
MyBrowse.TakeKey !BrowseClass object handles it
END
END
Example:
IF FIELD() = ?MyBrowse !focus on browse list
IF EVENT() = EVENT:NewSelection !if new selection
MyBrowse.TakeNewSelection() !BrowseClass object handles it
ELSE !if other event
MyBrowse.TakeEvent !BrowseClass object handles it
END
END
212 ABC Library Reference
Example:
IF FIELD() = ?MyBrowse !focus on browse list
CASE EVENT() !scroll event
OF EVENT:ScrollUp
OROF EVENT:ScrollDown
OROF EVENT:PageUp
OROF EVENT:PageDown
OROF EVENT:ScrollTop
OROF EVENT:ScrollBottom
MyBrowse.TakeScroll !BrowseClass object handles it
END
END
Implementation: A vcrevent value of VCR:Forward scrolls down one item; VCR:Backward scrolls
up one item; VCR:PageForward scrolls down one page; VCR:PageBackward
scrolls up one page; VCR:Last scrolls to the last list item; VCR:First scrolls to the
first list item. Corresponding vcrevent EQUATEs are declared in
\LIBSRC\ABTOOLBA.INC.
ITEMIZE,PRE(VCR)
Forward EQUATE(Toolbar:Down)
Backward EQUATE(Toolbar:Up)
PageForward EQUATE(Toolbar:PageDown)
PageBackward EQUATE(Toolbar:PageUp)
First EQUATE(Toolbar:Top)
Last EQUATE(Toolbar:Bottom)
Insert EQUATE(Toolbar:Insert)
None EQUATE(0)
END
The TakeVCRScroll method calls the TakeScroll method, translating the vcrevent
to the appropriate scrollevent.
Example:
LOOP !process repeated scroll events
IF VCRRequest = VCR:None !if no more events
BREAK !break out of loop
ELSE !if scroll event
MyBrowse.TakeVCRScroll( VCRRequest ) !BrowseClass object handles it
END
END
UpdateBuffer, VIRTUAL
The UpdateBuffer method copies corresponding data from the queuefield fields to the filefield
fields specified by the AddField method for the currently selected browse item. Typically these are
the browse list's queue buffer fields and the file buffer fields so that the file buffers match the
currently selected browse list item.
Example:
IF FIELD() = ?FirstTab !if first tab selected
IF MyBrowse.SetSort(1,0) !apply the first sort order
MyBrowse.ResetThumbLimits !if sort changed, reset thumb limits
END
MyBrowse.UpdateBuffer !update file buffer from selected item
MyBrowse.UpdateResets !update file buffer from reset fields
END
Tip: You may use the UpdateQuery method in combination with the
QueryClass.AddItem method to define a query interface that contains the
displayed fields plus other queryable items.
Implementation: The UpdateQuery method sets the value of the Query property, then calls the
QueryClass.AddItem method for each displayed field, so that each displayed field
accepts filter criteria in the query dialog.
Example:
QueryForm QueryFormClass
QueryVis QueryFormVisual
BRW1 CLASS(BrowseClass)
Q &CusQ
END
CusWindow.Init PROCEDURE()
CODE
!open files, views, window, etc.
IF DefaultQuery
BRW1.UpdateQuery(QueryForm)
ELSE
BRW1.Query &= QueryForm
QueryForm.AddItem('UPPER(CUS:NAME)','','')
QueryForm.AddItem('UPPER(CUS:CITY)','','')
QueryForm.AddItem('CUS:ZIP_CODE','','')
END
RETURN Level:Benign
UpdateResets, PROTECTED
The UpdateResets method copies reset field values to corresponding file buffer fields.
The AddResetField method defines the reset fields for the BrowseClass object.
Example:
MyBrowseClass.Next PROCEDURE !method of class derived from BrowseClass
CODE
IF Level:Fatal = PARENT.Next() !do parent method
POST(EVENT:CloseWindow) !if fails, shut down
ELSE !otherwise
SELF.UpdateResets !update file buffer from reset fields
END
UpdateThumb
The UpdateThumb method positions the scrollbar thumb and enables or disables the vertical
scroll bar depending on the number of items in the browse list, the currently selected item, and
the active step distribution method. See Control Templates--BrowseBox for more information on
thumb behavior.
Implementation: The AddSortOrder method sets the stepdistribution methods for the BrowseClass
object.
Example:
IF FIELD() = ?MyBrowse !focus on browse list
IF EVENT() = EVENT:NewSelection !if new selection
IF MyBrowse.TakeNewSelection() !BrowseClass object handles it
MyBrowse.UdateThumb !Reposition the thumb
END
END
END
218 ABC Library Reference
UpdateThumbFixed, PROTECTED
The UpdateThumbFixed method positions the scrollbar fixed thumb and enables or disables the
vertical scroll bar depending on the number of items in the browse list, the currently selected item,
and the active step distribution method. See Control Templates--BrowseBox for more information
on fixed thumb behavior.
Implementation: The AddSortOrder method sets the step distribution methods for the
BrowseClass object.
Example:
MyBrowseClass.UpdateThumb PROCEDURE
CODE
IF SELF.Sort.Thumb &= NULL !if no step object
SELF.UpdateThumbFixed !reposition thumb as fixed
ELSE
!reposition thumb per step object
END
BrowseClass 219
UpdateViewRecord, VIRTUAL
The UpdateViewRecord method regets the browse's VIEW record for the selected browse list
item so the VIEW record can be written to disk. The UpdateViewRecord method arms automatic
optimistic concurrency checking so the eventual write (PUT) to disk returns an error if another
user changed the data since it was retrieved by UpdateViewRecord.
Example:
IF FIELD() = ?ChangeButton !on change button
IF EVENT() = EVENT:Accepted !if button clicked
MyBrowse.UpdateViewRecord !refresh buffers and arm WATCH
DO MyBrowse:ButtonChange !call the update routine
END
END
220 ABC Library Reference
UpdateWindow, VIRTUAL
The UpdateWindow method updates display variables to match the current state of the browse
list.
Tip: Use ResetSort followed by UpdateWindow to refresh and redisplay your ABC
BrowseBoxes. Or, use the WindowManager.Reset method.
Example:
IF FIELD() = ?MyBrowse !focus on browse list
IF EVENT) = EVENT:NewSelection !if new selection
IF MyBrowse.TakeNewSelection() !BrowseClass object handles it
MyBrowse.SetSort(0,1) !reapply sort order
MyBrowse.UpdateBuffer !refresh file buffer from selected item
MyBrowse.UpdateWindow !update display variables (locator)
DISPLAY() !and redraw the window
END
END
END
BrowseQueue Interface 221
BrowseQueue Interface
BrowseQueue Concepts
The BrowseQueue interface is a defined set of behaviors that relate to the VIEW and QUEUE
that the LIST control uses.
BrowseQueue Methods
Fetch Retrieves an entry from the queue for the LIST control.
position An integer constant, variable, EQUATE, or expression
that indicates the relative position in the queue for the
LIST.
The Fetch method retrieves an entry from the queue that the LIST control is using at the relative
position specified.
Insert([position])
Records
The Records method returns the number of records available in the queue for the LIST control.
SetViewPosition(position)
Update
The Update method updates an entry in the queue that the LIST control is using.
Who(column)
Who Returns the queue field name for the specified column.
column An integer constant, variable, EQUATE, or expression
that contains a column number from the queue.
The Who method returns the queue field name for the column specified by the column
parameter.
BrowseToolbarClass
BrowseToolbarClass Overview
The BrowseToolbarClass handles events for specialized buttons for scrolling in the associated
BrowseBox. This class works with the BrowseClass and the WindowManager objects to
accomplish these tasks.
BrowseToolbarClass Concepts
The BrowseToolbarClass object interacts with the BrowseClass and WindowManager to allow the
toolbar buttons to scroll the browse highlight bar within the BrowseBox. When a toolbar button is
pressed and EVENT:Accepted is posted to the associated Browse control.
BrowseToolbarClass Properties
Implementation: The BrowseToolbarClass.Init method sets the value of the Browse property.
Implementation: The BrowseToolbarClass.Init method sets the value of the Window property.
BrowseToolbarClass Methods
Init(WindowManager, BrowseClass)
InitMisc(history, help)
There are predefined equates that represent each button available on the toolbar. These equates
can be found at the top of ABTOOLBA.INC.
ResetFromBrowse, VIRTUAL
The ResetFromBrowse method synchronizes the toolbar controls with their corresponding
brrowse control. These controls include the Select, Insert, Change, Delete, History, Help and
Locate buttons.
TakeEvent, VIRTUAL
The TakeEvent method processes all accepted events for the toolbar controls. When an
accepted event occurs, an EVENT:Accepted is posted to the corresponding Browse control.
When a NewSelection event occurs on the BrowseBox, the ResetFromBrowse method is called
to redisplay the toolbar controls with the correct properties (hide, unhide, enable, disable).
BufferedPairsClass
BufferedPairsClass Overview
The BufferedPairsClass is a FieldPairs class with a third buffer area (a "save" area). The
BufferedPairsClass can compare the save area with the primary buffers, and can restore data
from the save area to the primary buffers (to implement a standard "cancel" operation).
BufferedPairsClass Concepts
The BufferedPairsClass lets you move data between field pairs, and lets you compare the field
pairs to detect whether any changes occurred since the last operation.
This class provides methods that let you identify or "set up" the targeted field pairs.
Note: The paired fields need not be contiguous in memory, nor do they need to be part of
a structure. You can build a virtual structure simply by adding a series of
otherwise unrelated fields to a BufferedPairsClass object. The BufferedPairsClass
methods then operate on this virtual structure.
Once the field pairs are identified, you call a single method to move all the fields in one direction
(left to right), and others single methods to move all the fields in the other directions (right to left,
left to buffer, etc.). You simply have to remember which entity (set of fields) you described as
"left" and which entity you described as "right." Other methods compares the sets of fields and
return a value to indicate whether or not they are equivalent.
Various ABC Library objects instantiate BufferedPairsClass objects as needed; therefore, the
template generated code does not directly reference the BufferedPairsClass.
The BufferedPairsClass source code is installed in the Clarion \LIBSRC folder. The
BufferedPairsClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a BufferedPairsClass object.
And you want to move data between the file buffer and the queue buffer.
INCLUDE('ABUTIL.INC') !declare BufferedPairsClass
Fields BufferedPairsClass !declare Fields object
CODE
Fields.Init !initialize Fields object
Fields.AddPair(CUST:CustNo, CustQ.CustNo) !establish CustNo pair
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:Zip, CustQ.Zip) !establish Zip pair
BufferedPairsClass Properties
BufferedPairsClass Properties
The BufferedPairsClass inherits the properties of the FieldPairsClass from which it is derived.
See FieldPairsClass Properties for more information.
In addition to (or instead of) the inherited properties, the BufferedPairsClass contains the RealList
property.
RealList &FieldPairsQueue
The RealList property is a reference to the structure that holds all the field pairs recognized by
the BufferedPairsClass object.
Use the AddPair method to add field pairs to the RealList property. For each field pair, the
RealList property includes the designated "Left" field, the designated "Right" field, plus a "Buffer"
field you can use as an intermediate storage area (a save area).
The "Left," "Right," and "Buffer" designations are reflected in other BufferedPairsClass method
names (for example, field assignment methods--AssignLeftToRight and AssignRightToBuffer) so
you can easily and accurately control the movement of data between the three sets of fields.
The Init method creates the List and RealList properties; the Kill method disposes of them.
AddPair adds field pairs to the RealList property.
BufferedPairsClass Methods
BufferedPairsClass Methods
The BufferedPairsClass inherits all the methods of the FieldPairsClass from which it is derived.
See FieldPairsClass Methods for more information.
In addition to (or instead of) the inherited methods, the BufferedPairsClass contains other
methods listed below.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Occasional Use:
AssignLeftToRight assign each "left" field to its "right" counterpart
AssignLeftToBuffer assign each "left" field to its "buffer" counterpart
AssignRightToLeft assign each "right" field to its "left" counterpart
AssignRightToBuffer assign each "right" field to its "buffer" counterpart
AssignBufferToLeft assign each "buffer" field to its "left" counterpart
AssignBufferToRight assign each "buffer" field to its "right" counterpart
EqualLeftRight return 1 if each left equal right, otherwise return 0
EqualLeftBuffer return 1 if each left equal buffer, otherwise return 0
EqualRightBuffer return 1 if right equal buffer, otherwise return 0
ClearLeft CLEAR each "left" field
ClearRight CLEAR each "right" field
BufferedPairsClass 237
Inappropriate Use:
These methods are inherited from the FieldPairsClass and typically are not used in the context of
this (BufferedPairsClass) derived class.
Virtual Methods
Typically you will not call these methods directly. However, we anticipate you will often want to
override these methods, and because they are virtual, they are very easy to override. These
methods do provide reasonable default behavior in case you do not want to override them.
238 ABC Library Reference
The fields need not be contiguous in memory, nor do they need to be part of a structure.
Therefore you can build a virtual structure simply by adding a series of otherwise unrelated fields
to a BufferedPairs object. The other BufferedPairs methods then operate on this virtual structure.
Implementation: AddPair assumes the RealList property has already been created by Init or by
some other method.
By calling AddPair for a series of fields (for example, the corresponding fields in a RECORD and
a QUEUE), you effectively build three virtual structures containing the fields and a (one-to-one-to-
one) relationship between the structures.
Example:
INCLUDE('ABUTIL.INC') !declare BufferedPairs Class
Fields &BufferedPairsClass !declare BufferedPairs reference
Customer FILE,DRIVER('TOPSPEED'),PRE(CUST),CREATE,BINDABLE
ByNumber KEY(CUST:CustNo),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CustNo LONG
Name STRING(30)
Phone STRING(20)
END
END
CustQ QUEUE
CustNo LONG
Name STRING(30)
Phone STRING(20)
END
CODE
BufferedPairsClass 239
AssignBufferToLeft
The AssignBufferToLeft method copies the contents of each "buffer" field to its corresponding
"left" field in the RealList property.
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualRightBuffer !compare QUEUE fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignBufferToLeft !restore original to CustQ (display) buffer
END
END
AssignBufferToRight
The AssignBufferToRight method copies the contents of each "buffer" field to its corresponding
"right" field in the RealList property.
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualRightBuffer !compare QUEUE fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToBuffer
OF BUTTON:Yes
Fields.AssignBufferToRight
END
END
AssignLeftToBuffer
The AssignLeftToBuffer method copies the contents of each "left" field to its corresponding
"buffer" field in the RealList property.
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualRightBuffer !compare QUEUE fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft
OF BUTTON:Yes
Fields.AssignLeftToBuffer
END
END
AssignRightToBuffer
The AssignRightToBuffer method copies the contents of each "right" field to its corresponding
"buffer" field in the RealList property.
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualRightBuffer !compare QUEUE fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToBuffer
OF BUTTON:Yes
Fields.AssignBufferToRight
END
END
EqualLeftBuffer
The EqualLeftBuffer method returns one (1) if each "left" field equals its corresponding "buffer"
field; otherwise it returns zero (0).
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualLeftBuffer !compare CUST fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignBufferToLeft !restore original to CustQ (display) buffer
END
END
EqualRightBuffer
The EqualRightBuffer method returns one (1) if each "right" field equals its corresponding
"buffer" field; otherwise it returns zero (0).
Implementation: The "left" field is the first (left) parameter of the AddPair method. The "right" field
is the second (right) parameter of the AddPair method. The BufferedPairsClass
automatically supplies the "buffer" field.
Example:
Fields.AddPair(CUST:Name, CustQ.Name) !establish Name pair
Fields.AddPair(CUST:Phone, CustQ.Phone) !establish Phone pair
Fields.AddPair(CUST:ZIP, CustQ.ZIP) !establish ZIP pair
!some code
IF ~Fields.EqualRightBuffer !compare CUST fields to save buffer
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignBufferToLeft !restore original to CustQ (display) buffer
END
END
Init
The Init method initializes the BufferedPairsClass object.
Implementation: The Init method creates the List and RealList properties. This method "points" the
inherited List property to the RealList property so there is, in fact, only one list of
fields which may be referred to as RealList.
Example:
INCLUDE('ABUTIL.INC') !declare BufferedPairs Class
Fields &BufferedPairsClass !declare BufferedPairs reference
CODE
Fields &= NEW BufferedPairsClass !instantiate BufferedPairs object
Fields.Init !initialize BufferedPairs object
.
.
.
Fields.Kill !terminate BufferedPairs object
DISPOSE(Fields) !release memory allocated for BufferedPairs object
Kill
The Kill method disposes any memory allocated during the object's lifetime and performs any
other necessary termination code.
Implementation: The Kill method disposes the List and RealList properties created by the Init
method.
Example:
INCLUDE('ABUTIL.INC') !declare BufferedPairs Class
Fields &BufferedPairsClass !declare BufferedPairs reference
CODE
Fields &= NEW BufferedPairsClass !instantiate BufferedPairs object
Fields.Init !initialize BufferedPairs object
.
.
.
Fields.Kill !terminate BufferedPairs object
DISPOSE(Fields) !release memory allocated for BufferedPairs object
ConstantClass
ConstantClass Overview
The ConstantClass provides an easy, flexible, and efficient way to "loop through" constant data.
That is, the ConstantClass parses structures like the following so you can access each
(unlabeled) data item discretely:
Errors GROUP,STATIC
Items USHORT(40) !item count
USHORT(Msg:RebuildKey) !begin item 1
BYTE(Level:Notify)
PSTRING('Invalid Key')
USHORT(Msg:RebuildFailed) !begin item 2
BYTE(Level:Fatal)
PSTRING('Key was not built')
!38 more USHORT,BYTE,PSTRING combinations
END
ConstantClass Concepts
The ConstantClass parses and loads constant data such as error messages or translation text
from the GROUP structure that declares the data into other data structures or memory variables
(one item at a time). It can also write all the constant data into a QUEUE or a FILE.
The ConstantClass intelligently handles irregular data--you can declare the constant text data
with a series of strings of varying lengths so that no space is wasted. The ConstantClass also
handles a variety of numeric datatypes including BYTE, SHORT, USHORT, and LONG.
The ConstantClass provides several ways to stop processing the constant data, including a
simple item count, a text match, and a read-to-the-end option.
A single ConstantClass object can process multiple GROUP structures with the same (or
incremental) layouts.
250 ABC Library Reference
To use the ConstantClass, you must declare the constant data within a GROUP structure. The
GROUP structure may declare a single sequence using any combination of the permitted
datatypes, or a series of such sequences (the GROUP repeats the combination of datatypes as
many times as needed). The ConstantClass permits CSTRING, PSTRING, BYTE, SHORT,
USHORT, and LONG datatypes. The GROUP structure may contain an initial BYTE or USHORT
that specifies how many times a sequence of datatypes is repeated. For example:
Errors GROUP,STATIC
Items BYTE(2) !optional item count
USHORT(Msg:RebuildKey) !begin first item
BYTE(Level:Notify)
PSTRING('Invalid Key') !end first item
USHORT(Msg:RebuildFailed) !begin second item
BYTE(Level:Fatal)
PSTRING('Key not built') !end second item
END
If the GROUP is declared within a procedure it must have the STATIC attribute. See the
Language Reference for more information.
The ConstantClass uses two methods to describe or understand the structure of the constant
data it processes: the Init method and the AddItem method. The Init method (termination
parameter) indicates whether or not the GROUP structure declares an item count as well as the
datatype of the item count (see Init). The AddItem method identifies each repeating component of
the GROUP structure as well as the target variable that receives the contents of the repeating
component (see AddItem).
ConstantClass 251
The TranslatorClass, ErrorClass, ToolbarClass, and PrintPreview classes all use the
ConstantClass. These classes automatically instantiate the ConstantClass as needed.
All ABC Library references to the ConstantClass are encapsulated with ABC Library methods--the
ABC Templates do not directly reference the ConstantClass.
The ConstantClass source code is installed by default to the Clarion \LIBSRC. The specific
ConstantClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a ConstantClass object. The example loads translation pairs from a constant
GROUP into two CSTRINGs, which are then passed as parameters to another TranslatorClass
method. Note that the target CSTRINGs could just as easily be fields in a QUEUE or FILE buffer.
INCLUDE('ABUTIL.INC') !declare ConstantClass, TranslatorClass
Spanish GROUP !declare constant data
Items BYTE(50) !item count
PSTRING('One') !begin first item
PSTRING('Uno')
PSTRING('Two') !begin second item
PSTRING('Dos')
!48 more PSTRING pairs
END
LangQ QUEUE
Text CSTRING(50)
Repl CSTRING(50)
Done BYTE
END
CODE
!process items one-at-a-time:
Const.Init(Term:BYTE) !initialize the Const object,
!the first BYTE contains item count
Const.AddItem(ConstType:PString, Text) !Describe constant structure and
Const.AddItem(ConstType:PString, Repl) ! variables to accept the values
Const.AddItem(ConstType:PString, EndFlag)
Const.TerminatorValue = 1 ! terminate when endFlag =1
Const.TerminatorField = 50 ! 50th field is the terminating field
Const.TerminatorInclude = True ! include the terminating record
Const.Set(Spanish) ! pass the constant data to Const object
LOOP WHILE Const.Next()= Level:Benign !copy constant data one at a time
!do something with Text and Repl !to AddItem variables
END
Const.Kill !shut down Const object
ConstantClass Properties
TerminatorField (identify the terminating field)
TerminatorField USHORT
The TerminatorField property contains a value that can be set to a number that
represents the number (1 based) of the field that will tested to see if it contains the
termination value. The default value is 1.
See Also:
TerminatorInclude
TerminatorValue
ConstantClass.Next
Conceptual Example
TerminatorInclude BOOL
The TerminatorInclude property, when set to true (1), will include the record that matches the
terminator value in the "returned records". When set to FALSE (0), the record containing the
termination value will not be included in the returned records. By default, this property is set to
FALSE (0)
See Also:
TerminatorField
TerminatorValue
Conceptual Example
ConstantClass.Next
254 ABC Library Reference
TerminatorValue ANY
The TerminatorValue property contains a value that the ConstantClass object looks for within
the constant data. When the ConstantClass object finds the TerminatorValue, it stops processing
the constant data (inclusive).
The TerminatorValue property is only one of several techniques you can use to mark the end of
the constant data. See the Init method for more information on this and other techniques.
Implementation: The Init method CLEARs the TerminatorValue property; therefore, you should set
the TerminatorValue property after the Init method executes.
The Next() method returns Level:Notify when the characters of the constant data
matches the value of the TerminatorValue property. The Next(FILE) and
Next(QUEUE) methods stop processing when the ConstantClass object finds the
TerminatorValue.
The TerminatorField property can be set to a number that represents the number
(1 based) of the field that will tested to see if it contains the termination value.
When the TerminatorInclude property is set to true, this will include the record
that matches the terminator value in the 'returned records'. When false, the
record containing termination value will not be included in the returned records.
By default this is set to false.
ConstantClass Methods
ConstantClass Functional Organization--Expected Use
As an aid to understanding the ConstantClass, it is useful to organize the its methods into two
large categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the ConstantClass methods.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
Next copy one or all constant items to targets
Occasional Use:
Reset reset the object to beginning of the constant data
Virtual Methods
AddItem Sets the (repeating) constant datatype and its corresponding target variable.
datatype An integer constant, variable, EQUATE or expresssion that identifies the
datatype of a repeating constant within the constant GROUP structure. Valid
datatype values are ConstType:Cstring, ConstType:Pstring, ConstType:Byte,
ConstType:Short, ConstType:Ushort, and ConstType:Long.
target The label of the variable that receives the constant value.
The AddItem method sets a (repeating) constant datatype and its corresponding target variable.
Use multiple calls to the AddItem method to "describe" the constant data structure as well as the
target variables that receive the constant data.
Implementation: You should call AddItem for each repeating datatype declared in the constant
GROUP structure. The Next method processes the constant data items
described by the AddItem calls. EQUATEs for the datatype parameter are
declared in ABUTIL.INC:
ITEMIZE(1),PRE(ConstType)
First EQUATE
Cstring EQUATE(ConstType:First)
Pstring EQUATE
Byte EQUATE !1 byte unsigned integer
Short EQUATE !2 byte signed integer
UShort EQUATE !2 byte unsigned interger
Long EQUATE !4 byte signed integer
Last EQUATE(ConstType:Long)
END
Example:
Errors GROUP,STATIC
USHORT(Msg:RebuildKey) !begin first item
PSTRING('Invalid Key') !end first item
USHORT(Msg:RebuildFailed) !begin second item
PSTRING('Key not built') !end second item
END
ErrorQ QUEUE
ID LONG
Text CSTRING(255)
END
CODE
!The following describes the Errors GROUP and its corresonding target variables
Const.AddItem(ConstType:Ushort, ErrorQ.ID) !USHORT constant maps to error ID
Const.AddItem(ConstType:PString, ErrorQ.Text)!PSTRING constant maps to error text
Init( [termination] )
The termination parameter provides two important pieces of information to the ConstantClass
object: it tells the ConstantClass object whether there is a non-repeating item count declared at
the beginning of the constant data (describes the structure of the constant data), and it tells the
ConstantClass object how to recognize the end of the constant data. Valid termination values are:
Implementation: The Init method CLEARs the TerminatorValue property. The Init method
allocates memory and should always be paired with the Kill method, which frees
the memory.
Example:
Const.Init(Term:BYTE) !Initialize the Const object,
!the first BYTE contains item count
Const.AddItem(ConstType:PString, LangQ.Text)
258 ABC Library Reference
Kill
The Kill method frees any memory allocated during the life of the object and does any other
required termination code.
Example:
Const.Init(Term:BYTE) !Initialize the Const object,
! the first BYTE contains item count
Const.AddItem(ConstType:PString, LangQ.Text) !Describe constant structure and
Const.AddItem(ConstType:PString, LangQ.Repl) !variables to accept the values
Const.Set(Spanish) !pass the constant data to Const object
Const.Next(LangQ) !copy all constant items to the LangQ
Const.Kill !shut down Const object
260 ABC Library Reference
Next( | file |)
| queue | )
Prior calls to the AddItem method determine the makeup of the item as well as the target
variables that receive the item. The target variables should be within the file or queue structure to
make the corresponding ADD meaningful.
The Init method determines what constitutes the end of the constant data.
Implementation: The Next(FILE) and Next(QUEUE) methods call the Next() method for each
constant item, then execute an ADD(file) or ADD(queue) for each item.
Example:
Spanish GROUP !declare constant data
Items BYTE(50) !item count
PSTRING('One') !begin first item
PSTRING('Uno')
PSTRING('Two') !begin second item
PSTRING('Dos')
!48 more PSTRING pairs
END
LangQ QUEUE
Text CSTRING(50)
Repl CSTRING(50)
END
Next, PROC
The Next method copies the next constant item to its respective targets (as defined by the
AddItem method) and returns a value indicating whether the item was copied. A return value of
Level:Benign indicates the item was copied successfully; a return value of Level:Notify indicates
the item was not copied because the end of the constant data, as defined by the Init method, was
reached.
Prior calls to the AddItem method determine the makeup of the item as well as the target
variables that receive the item.
Implementation: The Next method parses a single item in the constant data, performing any
required datatype conversions, and increments appropriate internal counters.
Example:
Spanish GROUP !declare constant data
Items BYTE(50) !item count
PSTRING('One') !begin first item
PSTRING('Uno')
PSTRING('Two') !begin second item
PSTRING('Dos')
!48 more PSTRING pairs
END
Reset
The Reset method resets internal counters to start processing constant data from the beginning.
Implementation: The Set, Next(FILE) and Next(QUEUE) methods call the Reset method. Typically
you will not call this method.
Example:
ConstantClass.Set PROCEDURE(*STRING Src)
CODE
DISPOSE(SELF.Str)
SELF.Str &= NEW STRING(LEN(Src))
SELF.Str = Src
SELF.SourceSize=LEN(SELF.Str)
SELF.Reset
264 ABC Library Reference
Set( datasource )
Implementation: The Set method takes a copy of datasource and calls the Reset method to reset
internal counters to process datasource copy from the beginning.
Example:
Spanish GROUP !declare constant data
Items BYTE(50) !item count
PSTRING('One') !begin first item
PSTRING('Uno')
PSTRING('Two') !begin second item
PSTRING('Dos')
!48 more PSTRING pairs
END
LangQ QUEUE
Text CSTRING(50)
Repl CSTRING(50)
END
CODE
!process all items at a time
Const.Init(Term:BYTE) !re initialize the Const object,
! the first BYTE contains item count
Const.AddItem(ConstType:PString, LangQ.Text) !Describe constant structure and
Const.AddItem(ConstType:PString, LangQ.Repl) ! variables to accept the values
Const.Set(Spanish) !pass the constant data to Const object
Const.Next(LangQ) !copy all constant items to the LangQ
Const.Kill !shut down Const object
Crystal8 Class
Seagate Software’s Crystal Reports is one of the leading report writers delivering Windows
reports. For more information on this product see Seagate Software at
www.seagatesoftware.com.
Clarion’s Crystal Report interface is comprised of templates, libraries, and DLLs that
communicate with Seagate’s Crystal Reports, version 8. The DLL is accessed by a Class
Interface and is hooked to your application using simple standard Clarion code. This interface
allows a seamless integration of previously defined Crystal reports within a Clarion application.
The Crystal report engine accesses data and creates the report. The report can be previewed in
a Clarion window.
Clarion’s Crystal Reports implementation is compatible with both the ABC and Legacy
templates. It can only be used in 32-bit applications.
Crystal8 Methods
AllowPrompt (prompt for runtime parameter data)
AllowPrompt(| allowpromptflag |)
The AllowPrompt method can conditionally allow the Crystal report that is being previewed or
printed to prompt for runtime parameter fields. These parameter fields must be defined in the
Crystal report. This method returns a BYTE representing the value of allowpromptflag.
Example:
oCrystal8.AllowPrompt(1)
268 ABC Library Reference
CanDrillDown(| candrilldown |)
The CanDrillDown method allows a Crystal Report to use the defined drill down support.
For more information on Crystal’s drill down feature refer to the Crystal Report
documentation. This method returns a BYTE representing the value of candrilldown.
Example:
oCrystal8.CanDrillDown(1)
Crystal8Class 269
HasCancelButton (| hascancelbutton |)
The HasCancelButton method is used to optionally display a cancel button on the report
preview window. This method returns a BYTE representing the value of hascancelbutton.
Example:
oCrystal8.HasCancelButton(1)
270 ABC Library Reference
HasCloseButton (| hasclosebutton |)
The HasCloseButton method is used to optionally display a close button on the report
preview window. This method returns a BYTE representing the value of hasclosebutton.
Example:
oCrystal8.HasCloseButton(1)
Crystal8Class 271
HasExportButton (| hasexportbutton |)
The HasExportButton method is used to optionally display an export button on the report
preview window. This method returns a BYTE representing the value of hasexportbutton.
Example:
oCrystal8.HasExportButton(1)
272 ABC Library Reference
HasLaunchButton (| haslaunchbutton |)
HasLaunchButton Allow a launch button on the report preview window.
The HasLaunchButton method is used to optionally display a launch button on the report
preview window. This method returns a BYTE representing the value of haslaunchbutton.
The launch button is used to launch the Seagate Analysis tool.
Example:
oCrystal8.HasLaunchButton(1)
Crystal8Class 273
HasNavigationControls (| hasnavigationcontrols |)
Example:
oCrystal8.HasNavigationControls(1)
274 ABC Library Reference
HasPrintButton (| hasprintbutton |)
The HasPrintButton method is used to optionally display a print button on the report
preview window. This method returns a BYTE representing the value of hasprintbutton.
Example:
oCrystal8.HasPrintButton(1)
Crystal8Class 275
HasPrintSetupButton (| hasprintsetupbutton |)
The HasPrintSetupButton method is used to optionally display a print setup button on the
report preview window. This method returns a BYTE representing the value of
hasprintsetupbutton.
Example:
oCrystal8.HasPrintSetupButton(1)
276 ABC Library Reference
HasProgressControls (| hasprogresscontrols |)
Example:
oCrystal8.HasProgressControls(1)
Crystal8Class 277
HasRefreshButton (| hasrefreshbutton |)
The HasRefreshButton method is used to optionally display a refresh button on the report
preview window. This method returns a BYTE representing the value of hasrefreshbutton.
Example:
oCrystal8.HasRefreshButton(1)
278 ABC Library Reference
HasSearchButton (| hassearchbutton |)
The HasSearchButton method is used to optionally display a search button on the report
preview window. This method returns a BYTE representing the value of hassearchbutton.
Example:
oCrystal8.HasSearchButton(1)
Crystal8Class 279
HasZoomControl (| haszoomcontrol |)
The HasZoomControl method is used to optionally display a zoom control on the report
preview window. This method returns a BYTE representing the value of haszoomcontrol.
Example:
oCrystal8.HasZoomControl(1)
280 ABC Library Reference
Init (reportname)
reportname A string constant, variable, EQUATE, or expression containing the report name.
This report name is used when previewing a report. It is also the window caption
(text).
The Init method initializes the Crystal8 object. This method also sets the title of the
preview window, if the report is previewed. A BYTE is returned from this method and
represents whether the report engine is successfully initialized.
Example:
oCrystal8.Init( ReportPathName )
Crystal8Class 281
Kill
The Kill method shuts down the Crystal8 object, releasing any memory allocated durring
the lifetime of the object.
Example:
oCrystal8.Kill()
282 ABC Library Reference
windowtitle A string constant, variable, EQUATE, or expression containing the text to display
in the report preview window’s title bar. This parameter is optional.
systemmenu An integer constant, variable, EQUATE, or expression that specifies whether the
preview window will contain a system menu. A value of TRUE will give the
preview window a system menu. A value of FALSE (the default value) will not
include the system menu on the preview window. This parameter is optional.
maximizebox An integer constant, variable, EQUATE, or expression that specifies whether the
preview window will contain a maximize button. A value of TRUE (the default
value) will place the maximize button on the preview window. A value of FALSE
will not include the maximize box on the preview window. This parameter is
optional.
3dflag An integer constant, variable, EQUATE, or expression that specifies whether the
preview window will have a 3D look. The 3D look provides the window with a
gray backgound and chiseled control look. A value of TRUE (the default value)
will provide the preview window with the 3D look. A value of FALSE will not
provide the preview window with the 3d look. This parameter is optional.
The Preview method is used to preview a Crystal report within a Clarion window. This
method supports several preview window options.
Example:
copies An integer constant, variable, EQUATE, or expression that specifies the number
of copies of the report to print. The default for this parameter is 1. This parameter
is optional.
printersetup An integer constant, variable, EQUATE, or expression that specifies whether the
Printer Setup dialog is displayed before sending the report to the printer.
Specifying TRUE or 1 for this parameter will cause the Printer Setup dialog to be
displayed; a value of FALSE or 0 (the default value) will allow the report to go
directly to the printer. This parameter is optional.
The _Print method prints a Crystal report directly to the printer without any option to
preview the report. The printer setup dialog is optional before the report is sent to the
printer.
Example:
oCrystal8._Print( 1, 1 )
284 ABC Library Reference
Query( | querystring |)
querystring A string constant, variable, EQUATE, or expression containing the SQL query to
be sent to the SQL data source. This parameter is optional.
The Query method is used to either get or set the SQL query. If the querystring is omitted
from the method call, the current query is retrieved.
Example:
SelectionFormula(| formulastring |)
The SelectionFormula method is used to either get or set the report’s formula used to
limit retrieved records. If the formulastring is omitted from the method call, the current
formula is retrieved.
Example:
ShowDocumentTips(| showdocumenttips |)
Example:
oCrystal8.ShowDocumentTips(1)
Crystal8Class 287
ShowReportControls (| showreportcontrols |)
The ShowReportControls method is used to display the print controls. The print controls
include the First, Previous, Next, and Last Page buttons as well as the buttons for
Cancel, Close, Export, and Print to Printer. This method returns a BYTE representing the
value of showreportcontrols.
Example:
oCrystal8.ShowReportControls(1)
288 ABC Library Reference
ShowToolbarTips(| showtooltips |)
The ShowToolbarTips method is used to enable tooltips on the toolbar of the report
preview window. This method returns a BYTE representing the value of showtooltips.
Example:
oCrystal8.ShowToolBarTips(1)
cwRTFClass 289
cwRTF Class
cwRTF Overview
Clarion's implementation of Rich Text Format (RTF) is derived from Microsoft's Rich Edit
Control, version 3.0. Rich Text provides a storage format for text that keeps the text compatible
among different operating systems, and software applications. A rich text control allows a user
to enter, edit, format, print, and save text.
Clarion's Rich Text support is compatible with both the ABC and Legacy templates. It may only
be used in a 32-bit application. Multiple RTF controls may be used on a single window.
Clarion's Rich Text Classes and Templates are wrappers around Microsoft's Rich Edit Control
DLL's. The presence of RichEdxx.DLL is required in the Windows/System directory. There are
three versions of this DLL. The following list of operating systems shows which DLL each system
installs and supports. Other programs may install a newer version of the Rich Edit DLL.
cwRTF Properties
cwRTF Properties
The cwRTF class contains many properties that although are not PRIVATE, should not be used.
These methods are used internally.
hRTFWindow LONG
The hRTFWindow property is a handle to the RTF control.
292 ABC Library Reference
cwRTF Methods
AlignParaCenter (center paragraph)
AlignParaCenter
The AlignParaCenter method is used to center the current or selected paragraph of text within
the rich text control. The current paragraph is the one that the cursor is within.
Example:
oRTF_RTFTextBox.AlignParaCenter() !Center paragraph
Example:
oRTF_RTFTextBox.AlignParaLeft() !Left justify paragraph
Example:
oRTF_RTFTextBox.AlignParaRight() !Right justify paragraph
cwRTFClass 293
ChangeFontStyle(fontstyle)
Example:
oRTF_RTFTextBox.ChangeFontStyle(FONT:Italic ) !Font Style
oRTF_RTFTextBox.ChangeFontStyle(loc:fontstyle ) !Variable Font Style
CanRedo
The CanRedo method is used to to see if there is data in the redo buffer. A return value of one (1
or True) indicates there is redo data in the buffer, a redo operation is available; a return value of
zero (0 or False) is returned if there is no redo data in the buffer, a redo operation is not available.
Example:
loc:redo =oRTF_RTFTextBox.CanRedo() !Check for data in the Redo buffer
294 ABC Library Reference
Example:
loc:undo =oRTF_RTFTextBox.CanUndo() !Check for data in the Undo buffer
Example:
oRTF_RTFTextBox.Color()!Color text
Example:
oRTF_RTFTextBox.Copy() !Copy text to clipboard
cwRTFClass 295
Example:
oRTF_RTFTextBox.Cut() !Cut text to clipboard
This method returns a value indicating the character position where the text was found.
Example:
loc:position =oRTF_RTFTextBox.Find(loc:find ) ! Search for contents of
loc:find
loc:position =oRTF_RTFTextBox.Find('mytext ' ) ! Search for 'mytext'
loc:position =oRTF_RTFTextBox.Find() ! Show find dialog
296 ABC Library Reference
FlatButtons(buttonstatus)
Example:
oRTF_RTFTextBox.FlatButtons(1 ) !Flat buttons
oRTF_RTFTextBox.FlatButtons(0 ) !Raised buttons
cwRTFClass 297
Example:
!Using variables
oRTF_RTFTextBox.Font(FontName,FontSize,FontColor,FontStyle )
!Specific Font Attributes
oRTF_RTFTextBox.Font('Arial ',10,COLOR:Red,FONT:Underline )
!Font Dialog
oRTF_RTFTextBox.Font()
298 ABC Library Reference
text A string variable that will receive the specified text. The
highlighted text will be assigned to the variable if no
starting and ending positions are specified. If positions
are specified the text specified by these positions will be
assigned to the string variable.
Example:
oRTF_RTFTextBox.GetText(loc:find, ,) !read text into loc:find
loc:length =oRTF_RTFTextBox.GetText(loc:find,,) !return string length
window The label of the WINDOW that contains the rich text
control.
Example:
oRTF_RTFTextBox.Init( Window, ?RTFTextBox, 1, 1, 1 )
300 ABC Library Reference
IsDirty([saveflag])
IsDirty Determines if the data in the rich text control has been
modified.
Example:
loc:dirty =oRTF_RTFTextBox.IsDirty(1) !Prompt to save changes
loc:dirty =oRTF_RTFTextBox.IsDirty(0) !No prompt to save changes
cwRTFClass 301
Kill([isdirty])
Example:
oRTF_RTFTextBox.Kill( TRUE )
LeftIndent(indentsize)
Example:
oRTF_RTFTextBox.LeftIndent(.5) !Indent 1/2 inch from left
302 ABC Library Reference
LimitTextSize(maxtextsize)
LimitTextSize Limits the amount of text that can be placed in the rich
text control regardless of the method used to save the
data field or file.
Example:
oRTF_RTFTextBox.LimitTextSize(2000) !Limit text to 2000 characters
LoadField(fieldname)
LoadField Load the rich text control with the data contained in the
field specified.
fieldname The fully qualified label of a field to load the data from.
The LoadField method is used to load a string or memo rich text field into the rich text control.
Example:
oRTF_RTFTextBox.LoadField(let:letter ) !Load RTF field
cwRTFClass 303
LoadFile Load the rich text control with the data contained in the
file specified.
Example:
oRTF_RTFTextBox.LoadField(let:letter ) !Load RTF field
Example:
oRTF_RTFTextBox.NewFile()
Example:
oRTF_RTFTextBox.Offset(1 ) !Offset by 1 inch
304 ABC Library Reference
Example:
oRTF_RTFTextBox.PageSetup()
Example:
oRTF_RTFTextBox.ParaBulletsOff() !Turn bullets off
Bullets:On (•)
Bullets:Arabic (1, 2, 3,...)
Bullets:LowerLetters (a, b, c,...)
Bullets:UpperLetters (A, B, C,...)
Bullets:LowerRoman (i, ii, iii,...)
Bullets:UpperRoman (I, II, III,...)
Example:
oRTF_RTFTextBox.ParaBulletsOn(BULLET:On) !Turn bullets on
cwRTFClass 305
Paste
The Paste method is used to paste clipboard text into the rich text control .
Example:
oRTF_RTFTextBox.Paste() !Paste text to clipboard
_Print(showsetup, [jobtitle])
If the PageSetup dialog is used, the method will return a one (1 or True) value if the OK button on
the dialog is pressed. A zero (0 or False) is returned if the Cancel button on the Page Seup dialog
is pressed. If the Page Setup dialog is not used, a one (1 or True) is returned.
Example:
oRTF_RTFTextBox._Print(1 ) !Show Print Setup dialog before printing
oRTF_RTFTextBox._Print(0 ) !Do not show Print Setup dialog
oRTF_RTFTextBox._Print(0, 'JobTitle' ) !Do not show Print Setup dialog
status = oRTF_RTFTextBox._Print(1, 'JobTitle' )!Do not show Print Setup dialog
306 ABC Library Reference
Redo
The Redo method is used to reapply the action that was previously undone on the rich text
control. Redo can be used on the previous 100 actions.
Example:
oRTF_RTFTextBox.Redo() !Redo previous undo action to rich text control
Replace([findtext], [replacetext])
Example:
!Using Variables
loc:replace =oRTF_RTFTextBox.Replace(loc:find,loc:replace )
!Replace dialog
loc:replace =oRTF_RTFTextBox.Replace()
RightIndent(indentsize)
Example:
oRTF_RTFTextBox.RightIndent(.5) !Indent 1/2 inch from right
SaveField(fieldname)
SaveField Save the rich text control data to the field specified.
Example:
oRTF_RTFTextBox.SaveField(let:letter )
308 ABC Library Reference
SaveFile(filename)
Example:
oRTF_RTFTextBox.SaveFile(loc:Filename )
oRTF_RTFTextBox.SaveFile('0101SS.RTF ' )
SelectText(startpos, endpos)
Example:
!Select text from position 1 to 20
oRTF_RTFTextBox.SelectText(1,20 )
!Select text from variable positions
oRTF_RTFTextBox.SelectText(loc:startpos,loc:endpos )
cwRTFClass 309
SetDirtyFlag(status)
SetDirtyFlag Sets the modified flag for the rich text control
Example:
oRTF_RTFTextBox.SetDirtyFlag( 0) ! Clear dirty flag
SetFocus
The SetFocus method is used to give the rich text control focus.
Example:
oRTF_RTFTextBox.SetFocus
310 ABC Library Reference
Example:
oRTF_RTFTextBox.SetText(loc:find,0,) !place text at current position
oRTF_RTFTextBox.SetText(loc:find,10,20) !place text at specified position
cwRTFClass 311
ShowControl(showstate)
Example:
oRTF_RTFTextBox.ShowControl( 0 ) ! Hide control
oRTF_RTFTextBox.ShowControl( 1 ) ! Unhide control
Undo
The Undo method is used to undo (reverse) the action previously taken on the rich text control.
Example:
oRTF_RTFTextBox.Undo()!Undo previous change to rich text control
312 ABC Library Reference
DbAuditManager 313
DbAuditManager
DbAuditManager Overview
The DbAuditManager class declares an audit manager that consistently handles all database
auditing operations. This class provides methods that create and update an audit log file.
This class also implements the DbdChangeAudit interface. This interface aids in the update of the
log file.
DbAuditManager Properties
The DbAuditManager contains the following properties:
Implementation: The Action property is set by the OnInsert, OnDelete, OnChange, and
BeforeChange methods. It is used to update the log file by the AddLogFile
method.
Implementation: The ColumnInfo queue is initialized by the Init method and updated by the
AddItem method.
Implementation: The LogFiles queue is initialized by the Init method and updated by the
AddLogFile method.
FM (DbLogFileManager object)
DbAuditManager Methods
The DbAuditManager class contains the following methods:
Implementation: This method is called one time for each field that will appear in the log file.
There is one extra column that always appears in the log file. This is the
action column that defines the update action that occurred to cause the log
file update.
AddLogFile(filename, logfilename)
Implementation: In template generated code, the AddLogFile method is called after the
DbAuditManager object is initialized. This method should be a called once for
each file being auditied.
BeforeChange
filename A string constant, variable, EQUATE, or expression
containing the label of the file that is to be audited.
BFP The label of a BufferedPairsClass object. See
BufferedPairsClass for more information.
The BeforeChange method saves the values of the record before a change is made. These
values are used for comparison after the record is saved back to disk.
Implementation: The BeforeChange method sets the Action property and saves the current
field values to the log file. This method is called from the
DbChangeManager.CheckChanges method.
Implementation: In template generated code, the Init method is called in the main application
module. It is called with the GlobalErrors error handler.
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and does any other
required termination code.
Implementation: The Kill method frees memory allocated to the ColumnInfo, LogFiles, and
LFM properties.
320 ABC Library Reference
Implementation: The OnChange method sets the Action property and calls the AppendLog
method. This method is called from the DbChangeManager.CheckChanges
method.
Implementation: The OnDelete method sets the Action property and calls the AppendLog
method. This method is called from the RelationManager's Delete method.
Implementation: OnFieldChange is a VIRTUAL method so that other base class methods can
directly call the OnFieldChange virtual method in a derived class. This lets
you easily implement your own custom version of this method.
Implementation: The OnInsert method sets the Action property and calls the AppendLog
method. This method is called from the FileManager's Insert method.
OpenLogFile(filename), PROTECTED
Implementation: This method is called by the AppendLog method to ensure the log file exists
before trying to update it.
SetFM(filename), PROTECTED
A one (1 or True) value is returned if the log file has been correctly initialized into the LogFiles
structure; a zero (0 or False) is returned otherwise.
Implementation: The SetFM method is called by the AddItem and AppendLog methods.
DbChangeManager
DbChangeManager Overview
The DbChangeManager class declares an audit manager that consistently handles all database
change operations.
DbChangeManager Properties
The DbChangeManager contains the following properties:
DbChangeManager Methods
The DbChangeManager class contains the following methods:
Implementation: This method is called one time for each field that will appear in the log file.
AddThread(filename)
CheckChanges(filename, file)
CheckPair(FP)
Equal(filename)
Implementation: The Equal method simply calls FieldPairsClass.Equat method which calls the
FieldPairsClass.EqualLeftRight method which in turn does all the comparison
work.
Init(IDBC), VIRTUAL
Implementation: In template generated code, the Init method is called in the main application
module.
330 ABC Library Reference
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and does any other
required termination code.
Implementation: The Kill method frees memory allocated to the NameQueue and
TriggerQueue structures.
SetThread(filename)
Update(filename)
Update
filename A string constant, variable, EQUATE, or expression
containing the label of the file that is audited.
The Update method calls the BufferFieldPairs class to update the record buffer with the changes
made in order for the audit log file to be updated with the before and after values.
DbLogFileManager
DbLogFileManager Overview
The DbLogFileManager class declares a file manager that consistently handles the routine
database operations on the audit log file. The DbLogFileManager is derived from the
FileManager class.
DbLogFileManager Properties
DbLogFileManager Properties
The DbLogFileManager inherits all the properties of the FileManager class from which it is
derived. See FileManager Properties for more information.
In addition to the inherited properties, the DbLogFileManager contains the following properties:
Opened BYTE
The Opened property indicates whether the DbLogFileManager's FILE (the log file) has been
opened. A value of one (1 or True) indicates the FILE is open; a value of zero (0 or False)
indicates the FILE is not opened.
DbLogFileManager 335
DbLogFileManager Methods
DbLogFileManager Methods
The DbLogFileManager inherits all the methods of the FileManager class from which it is
derived. See FileManager Methods for more information.
In addition to the inherited methods, the DbLogFileManager contains the following methods:
EditClass
EditClass Overview
The EditClass lets you implement a dynamic edit-in-place control for each column in a LIST. The
EditClass is an abstract class--it is not useful by itself, but serves as the foundation and
framework for its derived classes. See EditCheckClass, EditColorClass, EditFileClass,
EditDropListClass, EditFontClass, and EditMultiSelectClass.
EditClass Concepts
The EditClass creates an input control (CHECK, ENTRY, SPIN, COMBO, etc.), accepts input
from the end user, then returns the input to a specified variable, typically the variable associated
with a specific LIST cell--a field in the LIST control's data source QUEUE. The EditClass also
signals the calling procedure whenever significant edit-in-place events occur, such as tabbing to a
new column, cancelling the edit, or completing the edit (moving to a new record or row). The
EditClass provides virtual methods (TakeEvent) to allow you to take control of significant edit-in-
place events.
The BrowseClass (AskRecord method) uses the EditClass to accomplish edit-in-place data entry
by assigning the EditClass input control to a specific LIST cell--see BrowseClass.AskRecord.
The EditClass serves as the foundation and framework for its derived classes. See
EditCheckClass, EditColorClass, EditEntryClass, EditFileClass, EditFileDropClass,
EditFontClass, and EditMultiSelectClass. These derived classes each provide a different type of
input control or input user interface. You can control the values returned by these derived
EditClass objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to this chapter's specification; however, the EditClass may be
called by non-BrowseClass procedures and objects.
The BrowseClass.AskProcedure property indicates whether the BrowseClass object uses the
EditClass for updates.
The BrowseClass.AskRecord method is the engine for the edit-in-place functionality. This method
uses the EditClass to dynamically create the Edit-in-place control upon request (Insert, Change,
or Delete) by the end user. When the end user moves off the edited record (enter key, click on
another item) the AskRecord method saves or deletes the record and uses the EditClass to
destroy the Edit-in-place control.
338 ABC Library Reference
If you accept the BrowseUpdateButtons default edit-in-place behavior, the generated code does
not reference the EditClass, because the default edit-in-place behavior is implemented in the
BrowseClass (see BrowseClass.AskRecord), and no additional generated code is needed.
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
EditClass 341
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
?PropList{PROP:LineHeight}=12 !enlarge rows to accomodate EditClass icons
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddEditControl(Edit:PR:FieldName,1) !Register Edit:PR:FieldName with BRW1
BRW1.AddEditControl(Edit:PR:Color,2) !Register Edit:PR:Color with BRW1
BRW1.AddEditControl(Edit:PR:ControlType,3)!Register Edit:PR:ControlType with BRW1
BRW1.AddEditControl(Edit:PR:Hide,4) !Register Edit:PR:Hide with BRW1
BRW1.AddEditControl(Edit:PR:IconFile,5) !Register Edit:PR:IconFile with BRW1
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
CODE
PARENT.Init(FieldNumber,ListBox,UseVar)
342 ABC Library Reference
EditClass Properties
The EditClass contains the following properties.
FEQ UNSIGNED
The FEQ property contains the control number of the edit-in-place control.
The CreateControl method sets the value of the FEQ property when it creates the control.
ReadOnly BYTE
The ReadOnly property is a flag indicating that the edit-in-place control is not editable.
EditClass Methods
Functional Organization--Expected Use
As an aid to understanding the EditClass, it is useful to organize its methods into two large
categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EditClass methods.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventV handle events for the edit control
Occasional Use:
CreateContolV a virtual to create the edit control
SetAlertsV alert appropriate keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
must set the value of the FEQ property.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Implementation: The BrowseClass.AskRecord method calls the Init method. The Init method
creates the edit-in-place control, loads it with the selected list item's data,
and alerts the appropriate edit-in-place navigation keys.
Example:
MyEditClass.Init(1,?MyList,StateQ:StateCode) !initialize EditClass object
!program code
MyEditClass.Kill !shut down EditClass object
Implementation: The BrowseClass.AskRecord method calls the Kill method. The Kill method
destroys the edit-in-place control created by the Init method.
Example:
MyEditClass.Init(1,?MyList,StateQ:StateCode) !initialize EditClass object
!program code
MyEditClass.Kill !shut down EditClass object
Implementation: The Init method calls the CreateControl method to create the input control
and set the FEQ property. The Init method then calls the SetAlerts method to
alert standard edit-in-place keystrokes for the edit control. Alerted keys are:
TabKey !next field
ShiftTab !previous field
EnterKey !complete and save
EscKey !complete and cancel
DownKey !complete and save, then edit next row
UpKey !complete and save, then edit prior row
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Example:
EditInPlace::CUS:Number.SetReadOnly()
Example:
EditClassAction ROUTINE
CASE SELF.EditList.Control.TakeEvent(EVENT())
OF EditAction:Forward
!handle tab forward (new field, same record)
OF EditAction:Backward
!handle tab backward (new field, same record)
OF EditAction:Next
!handle down arrow (new record, offer to save prior record)
OF EditAction:Previous
!handle up arrow (new record, offer to save prior record)
OF EditAction:Complete
!handle OK or enter key (save record)
OF EditAction:Cancel
!handle Cancel or esc key (restore record)
END
EditSpinClass
EditSpinClass--Overview
The EditSpinClass is an EditClass that supports a SPIN control. The EditSpinClass lets you
implement a dynamic edit-in-place SPIN control for a column in a LIST.
EditSpinClass Concepts
The EditSpinClass creates a SPIN control, accepts input from the end user, then returns the input
to the variable specified by the Init method, typically the variable associated with a specific LIST
cell--a field in the LIST control's data source QUEUE. The EditSpinClass also signals the calling
procedure whenever significant edit-in-place events occur, such as tabbing to a new column,
cancelling the edit, or completing the edit (moving to a new record or row). The EditSpinClass
provides a virtual TakeEvent method to let you take control of significant edit-in-place events.
The EditSpinClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseEIPManagerClass
The EditSpinClass source code is installed by default to the Clarion \LIBSRC folder. The specific
EditSpinClass source code and their respective components are contained in:
EditSpinClass--Conceptual Example
The following example shows a sequence of statements to declare, instantiate, initialize, use, and
terminate an EditSpinClass object and a related BrowseClass object. The example page-loads a
LIST of actions and associated attributes (priority and completed), then edits the "Priority" items
with an EditSpinClass object. Note that the BrowseClass object calls the "registered"
EditSpinClass object's methods as needed.
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,DERIVED
Kill PROCEDURE(),BYTE,PROC,DERIVED
END
BRW1 CLASS(BrowseClass)
Q &ActQ
END
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue =PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?List
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
Relate:Actions.Open
FilesOpened = True
BRW1.Init(?List,ActQ.ViewActions,BRW1::ViewActions,ActQ,Relate:Actions,SELF)
OPEN(ActionWindow)
SELF.Opened=True
BRW1.Q &= ActQ
BRW1.AddSortOrder(ACT:KeyAction)
BRW1.AddField(ACT:Action,BRW1.Q.ACT:Action)
BRW1.AddField(ACT:Priority,BRW1.Q.ACT:Priority)
BRW1.AddField(ACT:Completed,BRW1.Q.ACT:Completed)
BRW1.AddEditControl(EditInPlace::ACT:Priority,2) !Add cutom edit-inplace class
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert:2
BRW1.ChangeControl=?Change:2
BRW1.DeleteControl=?Delete:2
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue =PARENT.Kill()
354 ABC Library Reference
EditSpinClass Properties
EditSpinClass Properties
The EditSpinClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
356 ABC Library Reference
EditSpinClass Methods
EditSpinClass Methods
The EditSpinClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the SPIN control
Occasional Use:
CreateContolV create the SPIN control
SetAlertsVI alert keystrokes for the SPIN control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method sets
the value of the FEQ property. Use the Init method or the CreateControl method
to set any required properties of the SPIN control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
EditCheckClass
EditCheckClass Overview
The EditCheckClass is an EditClass that supports a CHECK control. The EditCheckClass lets
you implement a dynamic edit-in-place CHECK control for a column in a LIST.
EditCheckClass Concepts
The EditCheckClass creates a CHECK control, accepts input from the end user, then returns the
input to the variable specified by the Init method, typically the variable associated with a specific
LIST cell—a field in the LIST control's data source QUEUE. The EditCheckClass also signals the
calling procedure whenever significant edit-in-place events occur, such as tabbing to a new
column, cancelling the edit, or completing the edit (moving to a new record or row). The
EditCheckClass provides a virtual TakeEvent method to let you take control of significant edit-in-
place events.
The EditCheckClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden) !edit this LIST field with a CHECK control
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
BUTTON('&Delete'),AT(267,121),USE(?Delete)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
EditCheckClass 363
OPEN(PropWindow)
SELF.Opened=True
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddEditControl(Edit:PR:Hide,4) !Use Edit:PR:Hide to edit BRW1 column 4
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditCheckClass Properties
The EditCheckClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
EditCheckClass 365
EditCheckClass Methods
The EditCheckClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
In addition to (or instead of) the inherited methods, the EditCheckClass contains the following
methods:
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the CHECK control
Occasional Use:
CreateContolV create the CHECK control
SetAlertsVI alert keystrokes for the CHECK control
Virtual Methods
Typically you will not call these methods directly—the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
sets the value of the FEQ property. Use the Init method or the CreateControl
method to set any required properties of the CHECK control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
EditColorClass
EditColorClassOverview
The EditColorClass is an EditClass that supports the Windows Color dialog by way of a dynamic
edit-in-place COMBO control.
EditColorClass Concepts
The EditColorClass creates a COMBO control with an ellipsis button that invokes the Windows
Color dialog. The EditColorClass accepts a color selection from the end user, then returns the
selection to the variable specified by the Init method, typically the variable associated with a
specific LIST cell--a field in the LIST control's data source QUEUE.
The EditColorClass also signals the calling procedure whenever significant edit-in-place events
occur, such as tabbing to a new column, cancelling the edit, or completing the edit (moving to a
new record or row). The EditColorClass provides a virtual TakeEvent method to let you take
control of significant edit-in-place events.
The EditColorClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color) !edit this LIST field with the color dialog
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
370 ABC Library Reference
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
EditColorClass 371
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddEditControl(Edit:PR:Color,2) !Use Edit:PR:Color to edit BRW1 column 2
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditColorClass Properties
EditColorClass Properties
The EditColorClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties for more information.
In addition to the inherited properties, the EditColorClass contains the following properties:
Title CSTRING(256)
The Title property contains a string that sets the title bar text in the Windows color dialog.
Implementation: The EditColorClass (TakeEvent method) uses the Title property as the title
parameter to the COLORDIALOG procedure. See COLORDIALOG in the
Language Reference for more information.
EditColorClass Methods
EditColorClass Functional Organization--Expected Use
As an aid to understanding the EditColorClass it is useful to organize its methods into two large
categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EditColorClass methods.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventV handle events for the edit control
Occasional Use:
CreateContolV create the edit (COMBO) control
SetAlertsVI alert keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
creates a COMBO control with an ellipsis button and sets the value of the
FEQ property.
Use the Init method or the CreateControl method to set any required
properties of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Example:
EditClassAction ROUTINE
CASE SELF.EditList.Control.TakeEvent(EVENT())
OF EditAction:Forward !handle tab forward (new field, same record)
OF EditAction:Backward !handle tab backward (new field, same record)
OF EditAction:Next !handle down arrow (new record, offer to save prior record)
OF EditAction:Previous !handle up arrow (new record, offer to save prior record)
OF EditAction:Complete !handle OK or enter key (save record)
OF EditAction:Cancel !handle Cancel or esc key (restore record)
END
See Also: Init, BrowseClass.AskRecord
EditDropComboClass 377
EditDropComboClass
EditDropComboClass Overview
The EditDropComboClass is an EditClass that supports a dynamic edit-in-place COMBO control
for a column in a LIST.
EditDropComboClass Concepts
The EditDropComboClass creates a COMBO control, accepts input from the end user, then
returns the input to the variable specified by the Init method, typically the variable associated with
a specific LIST cell—a field in the LIST control's data source QUEUE. The EditDropComboClass
also signals the calling procedure whenever significant edit-in-place events occur, such as
tabbing to a new column, canceling the edit, or completing the edit (moving to a new record or
row). The EditDropComboClass provides a virtual TakeEvent method to let you take control of
significant edit-in-place events.
The EditDropComboClass is derived from the EditDropListClass which in turn is derived from the
EditClass. The EditClass serves as the foundation and framework for its derived classes. These
derived classes each provide a different type of input control or input user interface. You can
control the values returned by these derived EditClass objects by using their virtual methods. See
the Conceptual Example.
BrowseEIPManagerClass
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType) !edit this field with a COMBO control
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
BUTTON('&Change'),AT(218,121),USE(?Change),DEFAULT
BUTTON('&Delete'),AT(267,121),USE(?Delete)
END
!declare Edit:PR:ControlType-EIP COMBO
Edit:PR:ControlType CLASS(EditDropComboClass)
Init PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar),VIRTUAL
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
EditDropComboClass 381
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
!Use Edit:PR:ControlType to edit BRW1 col 3
BRW1.AddEditControl(Edit:PR:ControlType,3)
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditDropComboClass Properties
The EditDropComboClass inherits all of the properties of the EditDropListClass and EditClass
from which is derived. See EditClass Properties and EditClass Concepts for more information.
EditDropComboClass 383
EditDropComboClass Methods
The EditDropComboClass inherits all the methods of the EditDropListClass and EditClass from
which it is derived. See EditClass Methods and EditClass Concepts for more information.
Occasional Use:
CreateContolV create the LIST control
Virtual Methods
Typically you will not call this method directly—the Non-Virtual methods call it. However, we
anticipate you will often want to override this method, and because it is virtual, it is very easy to
override. This method does provide reasonable default behavior in case you do not want to
override it.
Implementation: The Init method calls the CreateControl method. The CreateControl method
sets the value of the FEQ property. Use the Init method or the CreateControl
method to set any required properties of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
EditDropListClass
EditDropListClass Overview
The EditDropListClass is an EditClass that supports a DROPLIST control. The EditDropListClass
lets you implement a dynamic edit-in-place DROPLIST control for a column in a LIST.
EditDropListClass Concepts
The EditDropListClass creates a DROPLIST control, accepts input from the end user, then
returns the input to the variable specified by the Init method, typically the variable associated with
a specific LIST cell--a field in the LIST control's data source QUEUE. The EditDropListClass also
signals the calling procedure whenever significant edit-in-place events occur, such as tabbing to a
new column, cancelling the edit, or completing the edit (moving to a new record or row). The
EditDropListClass provides a virtual TakeEvent method to let you take control of significant edit-
in-place events.
The EditDropListClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType) !edit this field with a DROPLIST control
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
EditDropListClass 389
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditDropListClass Properties
EditDropListClass Properties
The EditDropListClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
EditDropListClass 391
EditDropListClass Methods
EditDropListClass Functional Organization--Expected Use
As an aid to understanding the EditDropListClass it is useful to organize its methods into two
large categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EditDropListClass methods.
Non-Virtual Methods
The non-virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the LIST control
Occasional Use:
CreateContolV create the LIST control
SetAlertsV alert keystrokes for the LIST control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
sets the value of the FEQ property. Use the Init method or the CreateControl
method to set any required properties of the DROPLIST control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
SetAlerts, VIRTUAL
The SetAlerts method alerts appropriate keystrokes for the edit-in-place DROPLIST control.
Implementation: The Init method calls the CreateControl method to create the input control
and set the FEQ property. The Init method then calls the SetAlerts method to
alert appropriate edit-in-place keystrokes for the edit control. Alerted keys
are:
TabKey !next field
ShiftTab !previous field
EnterKey !complete and save
EscKey !complete and cancel
Tip: Arrowup and Arrowdown keys are not alerted for a DROPLIST control because
these keys are used to navigate within the DROPLISt.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Example: EditInPlace::CUS:Number.SetReadOnly()
Example:
WindowManager.TakeEvent PROCEDURE
CODE
! Event handling code
LOOP i=1 TO RECORDS(SELF.FileDrops)
GET(SELF.FileDrops,i)
ASSERT(~ERRORCODE())
SELF.FileDrops.FileDrop.TakeEvent
END
EditEntryClass
EditEntryClass Overview
The EditEntryClass is an EditClass that supports an ENTRY control. The EditEntryClass lets you
implement a dynamic edit-in-place ENTRY control for a column in a LIST.
EditEntryClass Concepts
The EditEntryClass creates an ENTRY control, accepts input from the end user, then returns the
input to the variable specified by the Init method, typically the variable associated with a specific
LIST cell--a field in the LIST control's data source QUEUE. The EditEntryClass also signals the
calling procedure whenever significant edit-in-place events occur, such as tabbing to a new
column, cancelling the edit, or completing the edit (moving to a new record or row). The
EditEntryClass provides a virtual TakeEvent method to let you take control of significant edit-in-
place events.
The EditEntryClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
Tip: The BrowseClass instantiates the EditEntryClass as the default edit-in-place object
whenever edit-in-place is requested (when BrowseClass.AskProcedure is zero).
398 ABC Library Reference
You can also use the BrowseUpdateButtons control template (Configure EditInPlace) to
explicitly instantiate an EditEntryClass object called EditInPlace::fieldname and register the object
with the BrowseClass object. The BrowseClass object then calls the registered EditEntryClass
object's methods as needed. By explicitly requesting an EditEntryClass object, you gain access to
EditEntryClass method embed points. See Control Templates--BrowseUpdateButtons for more
information.
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
EditEntryClass 399
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
ViewPosition STRING(1024)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
400 ABC Library Reference
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName) !edit with Edit:PR:Name
BRW1.AddField(PR:Color,BRW1.Q.PR:Color) !default EditEntryClass
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)!edit with default EditEntryClass
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden) !edit with default EditEntryClass
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile) !edit with default EditEntryClass
BRW1.AddEditControl(Edit:PR:Name,1) !Use Edit:PR:Name for BRW1 col 1
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditEntryClass 401
CODE
PARENT.Init(FieldNumber,ListBox,UseVar)
SELF.Feq{PROP:CAP}=True !force EIP mixed case input
EditEntryClass Properties
EditEntryClass Properties
The EditEntryClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
EditEntryClass 403
EditEntryClass Methods
EditEntryClass Methods
The EditEntryClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the ENTRY control
Occasional Use:
CreateContolV create the ENTRY control
SetAlertsVI alert keystrokes for the ENTRY control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
sets the value of the FEQ property. Use the Init method or the CreateControl
method to set any required properties of the ENTRY control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
EditFileClass
EditFileClass Overview
The EditFileClass is an EditClass that supports the Windows File dialog by way of a dynamic edit-
in-place COMBO control.
EditFileClass Concepts
The EditFileClass creates a COMBO control with an ellipsis button that invokes the Windows File
dialog. The EditFileClass accepts a pathname selection from the end user, then returns the
selection to the variable specified by the Init method, typically the variable associated with a
specific LIST cell--a field in the LIST control's data source QUEUE.
The EditFileClass also signals the calling procedure whenever significant edit-in-place events
occur, such as tabbing to a new column, cancelling the edit, or completing the edit (moving to a
new record or row). The EditFileClass provides a virtual TakeEvent method to let you take control
of significant edit-in-place events.
The EditFileClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
ControlType STRING(12)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile) !edit this LIST field with the file dialog
ViewPosition STRING(1024)
END
408 ABC Library Reference
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
EditFileClass 409
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddEditControl(Edit:PR:IconFile,5) !Use Edit:PR:IconFile to edit BRW1 col 5
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
EditFileClass Properties
EditFileClass Properties
The EditFileClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
Implementation: The EditFileClass (TakeEvent method) uses the FileMask property as the
flag parameter to the FILEDIALOG procedure. See FILEDIALOG in the
Language Reference for more information.
The FilePattern property should contain one or more descriptions followed by their corresponding
file masks in the form description|masks|description|masks. All elements in the string must be
delimited by the vertical bar (|). For example, 'all files *.*|*.*|Clarion source
*.clw;*.inc|*.clw;*.inc' defines two selections for the File dialog's List Files of Type drop-
down list. See the extensions parameter to the FILEDIALOG function in the Language Reference
for more information.
412 ABC Library Reference
Implementation: The EditFileClass (TakeEvent method) uses the Title property as the title
parameter to the FILEDIALOG procedure. See FILEDIALOG in the
Language Reference for more information.
EditFileClass Methods
EditFileClass Functional Organization--Expected Use
As an aid to understanding the EditFileClass it is useful to organize its methods into two large
categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EditFileClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the edit control
Occasional Use:
CreateContolV create the edit (COMBO) control
SetAlertsVI alert keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
creates a COMBO control with an ellipsis button and sets the value of the
FEQ property.
Use the Init method or the CreateControl method to set any required
properties of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Example:
EditClassAction ROUTINE
CASE SELF.EditList.Control.TakeEvent(EVENT())
OF EditAction:Forward !handle tab forward (new field, same record)
OF EditAction:Backward !handle tab backward (new field, same record)
OF EditAction:Next !handle down arrow (new record, offer to save prior record)
OF EditAction:Previous !handle up arrow (new record, offer to save prior record)
OF EditAction:Complete !handle OK or enter key (save record)
OF EditAction:Cancel !handle Cancel or esc key (restore record)
END
EditFontClass
EditFontClass Overview
The EditFontClass is an EditClass that supports the Windows Font dialog by way of a dynamic
edit-in-place COMBO control.
EditFontClass Concepts
The EditFontClass creates a COMBO control with an ellipsis button that invokes the Windows
Font dialog. The EditFontClass accepts a font specification from the end user, then returns the
specification to the variable specified by the Init method, typically the variable associated with a
specific LIST cell--a field in the LIST control's data source QUEUE.
The EditFontClass also signals the calling procedure whenever significant edit-in-place events
occur, such as tabbing to a new column, cancelling the edit, or completing the edit (moving to a
new record or row). The EditFontClass provides a virtual TakeEvent method to let you take
control of significant edit-in-place events.
The EditFontClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
MAP END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
Font STRING(40)
ControlType STRING(12)
ApplyTo CSTRING(500)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:Font LIKE(PR:Font)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
PR:ApplyTo LIKE(PR:ApplyTo)
ViewPosition STRING(1024)
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
EditFontClass 421
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
?PropList{PROP:LineHeight}=12 !enlarge rows to accomodate EIP icons
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:Font,BRW1.Q.PR:Font)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddField(PR:ApplyTo,BRW1.Q.PR:ApplyTo)
BRW1.AddEditControl(Edit:PR:Font,3) !Use Edit:PR:Font to edit BRW1 col 3
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
Comma = INSTRING(',',SaveFont,1,1)
i+=1
IF Comma
EXECUTE i
SELF.TypeFace = SaveFont[1 : Comma-1] !get Typeface
SELF.FontSize = SaveFont[1 : Comma-1] !get FontSize
BEGIN
SELF.FontColor = SaveFont[1 : Comma-1] !get FontColor & Style
SELF.FontStyle = SaveFont[Comma+1 : LEN(SaveFont)]
END
END
SaveFont=SaveFont[Comma+1 : LEN(SaveFont)]
END
END
END
Access:Property.Init PROCEDURE
CODE
PARENT.Init(Property,GlobalErrors)
SELF.FileNameValue = 'Property'
SELF.Buffer &= PR:Record
SELF.Create = 1
SELF.AddKey(PR:NameKey,'PR:NameKey',0)
Relate:Property.Init PROCEDURE
CODE
Access:Property.Init
PARENT.Init(Access:Property,1)
Relate:Property.Kill PROCEDURE
CODE
Access:Property.Kill
PARENT.Kill
EditFontClass 423
EditFontClass Properties
EditFontClass Properties
The EditFontClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
In addition to the inherited properties, the EditFontClass contains the following properties:
Title CSTRING(256)
The Title property contains a string that sets the title bar text in the Windows font dialog.
Implementation: The EditFontClass (TakeEvent method) uses the Title property as the title
parameter to the FONTDIALOG procedure. See FONTDIALOG in the
Language Reference for more information.
EditFontClass Methods
EditFontClass Methods
The EditFontClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventV handle events for the edit control
Occasional Use:
CreateContolV create the edit (COMBO) control
SetAlertsVI alert keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
creates a COMBO control with an ellipsis button and sets the value of the
FEQ property.
Use the Init method or the CreateControl method to set any required
properties of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
EditMultiSelectClass
EditMultiSelectClass Overview
The EditMultiSelectClass is an EditClass that supports a MultiSelect dialog by way of a dynamic
edit-in-place COMBO control.
EditMultiSelectClass Concepts
The EditMultiSelectClass creates a COMBO control with an ellipsis button that invokes the
MultiSelect dialog. The MultiSelect dialog is an interface for selecting and ordering items from a
list.
The EditMultiSelectClass provides an AddValue method so you can prime the dialog's Available
Items and Selected Items lists.
The EditMultiSelectClass accepts input (selection actions) from the end user, then signals the
calling procedure when selection actions occur. The EditMultiSelectClass provides a virtual
TakeAction method to let you take control of the end user input.
The EditMultiSelectClass also signals the calling procedure whenever significant edit-in-place
events occur, such as tabbing to a new column, canceling the edit, or completing the edit (moving
to a new record or row). The EditMultiSelectClass provides a virtual TakeEvent method to let you
take control of significant edit-in-place events.
The EditMultiSelectClass is derived from the EditClass. The EditClass serves as the foundation
and framework for its derived classes. These derived classes each provide a different type of
input control or input user interface. You can control the values returned by these derived
EditClass objects by using their virtual methods. See the Conceptual Example.
BrowseClass
The EditClass is loosely integrated into the BrowseClass. The BrowseClass depends on the
EditClass operating according to it's documented specifications; however, the EditClass may be
called by non-BrowseClass procedures and objects.
428 ABC Library Reference
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABEIP.INC')
MAP
END
Property FILE,DRIVER('TOPSPEED'),PRE(PR),CREATE,BINDABLE,THREAD
NameKey KEY(PR:FieldName),NOCASE,OPT
Record RECORD,PRE()
FieldName STRING(30)
Color STRING(20)
Hidden STRING(1)
IconFile STRING(30)
Font STRING(40)
ControlType STRING(12)
ApplyTo CSTRING(500)
END
END
PropView VIEW(Property)
END
PropQ QUEUE
PR:FieldName LIKE(PR:FieldName)
PR:Color LIKE(PR:Color)
PR:Font LIKE(PR:Font)
PR:ControlType LIKE(PR:ControlType)
PR:Hidden LIKE(PR:Hidden)
PR:IconFile LIKE(PR:IconFile)
PR:ApplyTo LIKE(PR:ApplyTo)
ViewPosition STRING(1024)
END
430 ABC Library Reference
BRW1 CLASS(BrowseClass)
Q &PropQ
END
!declare Edit:PR:ApplyTo-EIP multi dialog
Edit:PR:ApplyTo CLASS(EditMultiSelectClass)
Init PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar),VIRTUAL
TakeAction PROCEDURE(BYTE Action,<STRING Item>,LONG Pos1=0,LONG Pos2=0),VIRTUAL
END
GlobalErrors ErrorClass
Access:Property CLASS(FileManager)
Init PROCEDURE
END
Relate:Property CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
GlobalErrors.Init
Relate:Property.Init
GlobalResponse = ThisWindow.Run()
Relate:Property.Kill
GlobalErrors.Kill
EditMultiSelectClass 431
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?PropList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
Relate:Property.Open
BRW1.Init(?PropList,PropQ.ViewPosition,PropView,PropQ,Relate:Property,SELF)
OPEN(PropWindow)
SELF.Opened=True
?PropList{PROP:LineHeight}=12 !enlarge rows to accomodate EIP icons
BRW1.Q &= PropQ
BRW1.AddSortOrder(,PR:NameKey)
BRW1.AddField(PR:FieldName,BRW1.Q.PR:FieldName)
BRW1.AddField(PR:Color,BRW1.Q.PR:Color)
BRW1.AddField(PR:Font,BRW1.Q.PR:Font)
BRW1.AddField(PR:ControlType,BRW1.Q.PR:ControlType)
BRW1.AddField(PR:Hidden,BRW1.Q.PR:Hidden)
BRW1.AddField(PR:IconFile,BRW1.Q.PR:IconFile)
BRW1.AddField(PR:ApplyTo,BRW1.Q.PR:ApplyTo)
BRW1.AddEditControl(Edit:PR:ApplyTo,7) !use Edit:PR:ApplyTo to edit BRW1 col 7
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
ItemQ.Ord=Pos2
GET(ItemQ, ItemQ.Ord) !get the "bumped" item
ItemQ.Ord=Pos1
PUT(ItemQ) !reposition the "bumped" item
ItemQ.Item=Item
GET(ItemQ, ItemQ.Item) !get the selected item
ItemQ.Ord=Pos2
PUT(ItemQ) !reposition the selected item
SORT(ItemQ,ItemQ.Ord) !reorder Q of selected items
HoldIt=''
LOOP Pos = 1 TO RECORDS(ItemQ) !refill comma separated list
GET(ItemQ,Pos)
IF HoldIt
HoldIt=HoldIt&','&ItemQ.Item
ELSE
HoldIt=ItemQ.Item
END
END
OF MSAction:StartProcess !begin AddAll (>>) or DeleteAll (<<)
SETCURSOR(CURSOR:Wait)
OF MSAction:EndProcess !end AddAll (>>) or DeleteAll (<<)
SETCURSOR()
END
SELF.UseVar=HoldIt
Access:Property.Init PROCEDURE
CODE
PARENT.Init(Property,GlobalErrors)
SELF.FileNameValue = 'Property'
SELF.Buffer &= PR:Record
SELF.Create = 1
SELF.AddKey(PR:NameKey,'PR:NameKey',0)
Relate:Property.Init PROCEDURE
CODE
Access:Property.Init
PARENT.Init(Access:Property,1)
Relate:Property.Kill PROCEDURE
CODE
Access:Property.Kill
PARENT.Kill
434 ABC Library Reference
EditMultiSelectClass Properties
EditMultiSelectClass Properties
The EditMultiSelectClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
In addition to the inherited properties, the EditMultiSelectClass contains the following properties:
Title CSTRING(256)
The Title property contains a string that sets the title bar text in the MultiSelect dialog.
EditMultiSelectClass 435
EditMultiSelectClass Methods
EditMultiSelectClass Methods
The EditMultiSelectClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeActionV handle user actions for the dialog
TakeEventV handle events for the edit control
Occasional Use:
CreateContolV create the edit (COMBO) control
Reset clear the MultiSelect dialog
SetAlertsVI alert keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Example:
Edit:PR:ApplyTo.Init PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar)
CODE
PARENT.Init(FieldNumber,ListBox,UseVar)
SELF.Reset
SELF.AddValue('Browse',INSTRING('Browse',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Form',INSTRING('Form',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Report',INSTRING('Report',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Window',INSTRING('Window',SELF.UseVar,1,1)) !set multi-select choice
438 ABC Library Reference
Implementation: The Init method calls the CreateControl method. The CreateControl method
creates a read only COMBO control with an ellipsis button and sets the value
of the FEQ property.
Use the Init method or the CreateControl method to set any required
properties of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Implementation: The Reset method clears the Available and Selected items lists in the
MultiSelect dialog. Use the AddValue method to refill these lists.
Example:
Edit:PR:ApplyTo.Init PROCEDURE(UNSIGNED FieldNumber,UNSIGNED ListBox,*? UseVar)
CODE
PARENT.Init(FieldNumber,ListBox,UseVar)
SELF.Reset
SELF.AddValue('Browse',INSTRING('Browse',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Form',INSTRING('Form',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Report',INSTRING('Report',SELF.UseVar,1,1)) !set multi-select choice
SELF.AddValue('Window',INSTRING('Window',SELF.UseVar,1,1)) !set multi-select choice
Tip: The TakeAction processing is immediate and occurs while the MultiSelect dialog is
open. The MultiSelect dialog does not generate an action or an event when the
dialog closes.
Implementation: The TakeEvent method (indirectly) calls the TakeAction method each time
the end user makes a new selection or moves a selection in the MultiSelect
dialog.
440 ABC Library Reference
Corresponding EQUATEs for the MultiSelect dialog action are declared in ABEIP.INC as follows:
MSAction ITEMIZE(1),PRE
Add EQUATE !add / select
Delete EQUATE !delete / deselect
Move EQUATE !reposition a selected item
StartProcess EQUATE !begin an add/delete series
EndProcess EQUATE !end an add/delete series
END
Example:
!This implementation of TakeAction converts the end user selections into
!comma separated items in a string.
Edit:PR:ApplyTo.TakeAction PROCEDURE(BYTE Action,<STRING Item>,LONG Pos1=0,LONG Pos2=0)
HoldIt CSTRING(1024) !indexable string of end user choices
Pos USHORT !index to parse end user selections
Comma USHORT !index to parse end user selections
ItemQ QUEUE !Q to reorder end user selections
Item CSTRING(100)
Ord BYTE
END
CODE
PARENT.TakeAction(Action,Item,Pos1,Pos2)
HoldIt=SELF.UseVar
CASE Action
OF MSAction:Add !end user selected an Item
HoldIt=CHOOSE(HoldIt,HoldIt&','&Item,Item)
OF MSAction:Delete !end user deselected an Item
Pos=INSTRING(Item,HoldIt,1,1)
IF Pos=1 !first item
HoldIt=HoldIt[Pos+LEN(Item)+1 : LEN(HoldIt)] !deselect first item
ELSE
IF Pos+LEN(Item) > LEN(HoldIt) !last item
HoldIt=HoldIt[1 : Pos-2] !deselect last item
ELSE !deselect any other item
HoldIt=HoldIt[1 : Pos-1] & HoldIt[Pos+LEN(Item)+1 : LEN(HoldIt)]
END
END
OF MSAction:Move !Selected Item moved up or down
FREE(ItemQ) ! Pos1=Item's "old" position
CLEAR(ItemQ) ! Pos2=Item's "new" position
Comma=1
LOOP WHILE Comma !build Q of Selected Items
Comma = INSTRING(',',HoldIt,1,1) ! to use for repositioning
ItemQ.Ord+=1
IF Comma
ItemQ.Item = HoldIt[1 : Comma-1]
EditMultiSelectClass 441
ADD(ItemQ,ItemQ.Ord)
HoldIt=HoldIt[Comma+1 : LEN(HoldIt)] !comma separated list of user choices
ELSE
ItemQ.Item = HoldIt
ADD(ItemQ,ItemQ.Ord)
END
END
ItemQ.Ord=Pos2
GET(ItemQ, ItemQ.Ord) !get the "bumped" item
ItemQ.Ord=Pos1
PUT(ItemQ) !reposition the "bumped" item
ItemQ.Item=Item
GET(ItemQ, ItemQ.Item) !get the selected item
ItemQ.Ord=Pos2
PUT(ItemQ) !reposition the selected item
SORT(ItemQ,ItemQ.Ord) !reorder Q of selected items
HoldIt=''
Example:
EditClassAction ROUTINE
CASE SELF.EditList.Control.TakeEvent(EVENT())
OF EditAction:Forward !handle tab forward (new field, same record)
OF EditAction:Backward !handle tab backward (new field, same record)
OF EditAction:Next !handle down arrow (new record, offer to save prior record)
OF EditAction:Previous !handle up arrow (new record, offer to save prior record)
OF EditAction:Complete !handle OK or enter key (save record)
OF EditAction:Cancel !handle Cancel or esc key (restore record)
END
See Also: Init, BrowseClass.AskRecord
EditTextClass 443
EditTextClass
EditTextClass: Overview
The EditTextClass is an EditClass that supports memo and large string fields by way of an edit-in-
place COMBO control.
EditTextClass Concepts
The EditTextClass creates a COMBO control with an ellipsis button that invokes a text dialog.
The EditTextClass also signals the calling procedure whenever significant edit-in-place events
occur, such as tabbing to a new column, cancelling the edit, or completing the edit (moving to a
new record or row). The EditTextClass provides a virtual TakeEvent method to let you take
control of significant edit-in-place events.
EditClass
The EditTextClass is derived from the EditClass. The EditClass serves as the foundation and
framework for its derived classes. These derived classes each provide a different type of input
control or input user interface. You can control the values returned by these derived EditClass
objects by using their virtual methods. See the Conceptual Example.
BrowseEIPManagerClass
The EditClass is managed by the BrowseEIPManagerClass. The BrowseEIPManagerClass
depends on the EditClass operating according to its documented specifications; however, the
EditClass may be called by non-BrowseClass procedures and objects.
444 ABC Library Reference
EditTextClass Properties
The EditTextClass inherits all the properties of the EditClass from which it is derived. See
EditClass Properties and EditClass Concepts for more information.
In addition to the inherited properties, the EditTextClass contains the following properties:
Title CSTRING(256)
The Title property contains a string that sets the title bar text in the dialog containing the text
control.
Implementation: The EditTextClass (TakeEvent method) uses the Title property as the title text for
the titlebar of the dialog containing the text control.
EditTextClass Methods
The EditTextClass inherits all the methods of the EditClass from which it is derived. See
EditClass Methods and EditClass Concepts.
As an aid to understanding the EditTextClass it is useful to organize its methods into two large
categories according to their expected use—the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EditTextClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeEventVI handle events for the edit control
Occasional Use:
CreateContolV create the edit (COMBO) control
SetAlertsVI alert keystrokes for the edit control
Virtual Methods
Typically you will not call these methods directly—the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are virtual, they
are very easy to override. These methods do provide reasonable default behavior in case you do
not want to override them.
Implementation: The Init method calls the CreateControl method. The CreateControl method
creates a COMBO control with an ellipsis button.
Use the Init method or the CreateControl method to set any required properties
of the COMBO control.
Example:
EditClass.Init PROCEDURE(UNSIGNED FieldNo,UNSIGNED ListBox,*? UseVar)
CODE
SELF.ListBoxFeq = ListBox
SELF.CreateControl()
ASSERT(SELF.Feq)
SELF.UseVar &= UseVar
SELF.Feq{PROP:Text} = ListBox{PROPLIST:Picture,FieldNo}
SELF.Feq{PROP:Use} = UseVar
SELF.SetAlerts
Example:
EditClassAction ROUTINE
CASE SELF.EditList.Control.TakeEvent(EVENT())
OF EditAction:Forward !handle tab forward (new field, same record)
OF EditAction:Backward !handle tab backward (new field, same record)
OF EditAction:Next !handle down arrow (new record, offer to save prior record)
OF EditAction:Previous !handle up arrow (new record, offer to save prior record)
OF EditAction:Complete !handle OK or enter key (save record)
OF EditAction:Cancel !handle Cancel or esc key (restore record)
END
EIPManagerClass
EIPManagerClass--Overview
The EIPManagerClass is a WindowManager that displays an edit-in-place dialog, and handles
events for that dialog . The EIPManagerClass is an abstract class--it is not useful by itself, but
serves as the foundation and framework for the BrowseEIPManagerClass. See
BrowseEIPManagerClass.
EIPManagerClass Concepts
Each edit-in-place control is created on top of the browse from which it is called. The
EIPManager dynamically creates an edit-in-place object and control upon request (Insert,
Change, or Delete) by the end user. When the end user accepts the edited record the
EIPManager destroys the edit-in-place object and control.
WindowClass
BrowseClass
EditClasses
The EIPManager provides the basic or "under the hood" interface between the Edit classes and
the Browse class. The EIPManager uses the EditQueue to keep track of the fields in the browse
utilizing edit-in-place.
450 ABC Library Reference
EIPManagerClass--Conceptual Example
The following example shows a sequence of statements to declare, and instantiate an
EIPManager object. The example page-loads a LIST of actions and associated priorities, then
edits the list items via edit-in-place. Note that the BrowseClass object references the
BrowseEIPManager which is an EIPManager object, as referenced in ABBrowse.INC.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABBROWSE.INC'),ONCE
INCLUDE('ABEIP.INC'),ONCE
INCLUDE('ABWINDOW.INC'),ONCE
MAP
END
Actions FILE,DRIVER('TOPSPEED'),PRE(ACT),CREATE,BINDABLE,THREAD
KeyAction KEY(ACT:Action),NOCASE,OPT
Record RECORD,PRE()
Action STRING(20)
Priority DECIMAL(2)
Completed DECIMAL(1)
END
END
Access:Actions &FileManager
Relate:Actions &RelationManager
GlobalErrors ErrorClass
GlobalRequest BYTE(0),THREAD
ActionsView VIEW(Actions)
END
Queue:Browse QUEUE
ACT:Action LIKE(ACT:Action)
ACT:Priority LIKE(ACT:Priority)
ViewPosition STRING(1024)
END
BrowseWindow WINDOW('Browse Records'),AT(0,0,247,140),SYSTEM,GRAY
LIST,AT(5,5,235,100),USE(?List),IMM,HVSCROLL,MSG('Browsing Records'),|
FORMAT('80L~Action~@S20@8R~Priority~L@N2@'),FROM(Queue:Browse)
BUTTON('&Insert'),AT(5,110,40,12),USE(?Insert),KEY(InsertKey)
BUTTON('&Change'),AT(50,110,40,12),USE(?Change),KEY(CtrlEnter),DEFAULT
BUTTON('&Delete'),AT(95,110,40,12),USE(?Delete),KEY(DeleteKey)
END
452 ABC Library Reference
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,DERIVED
Kill PROCEDURE(),BYTE,PROC,DERIVED
END
BRW1 CLASS(BrowseClass)
Q &Queue:Browse
Init PROCEDURE(SIGNED ListBox,*STRING Posit,VIEW V,QUEUE Q,RelationManager RM,WindowManager WM)
END
CODE
GlobalErrors.Init
Relate:Actions.Init
GlobalResponse = ThisWindow.Run()
Relate:Actions.Kill
GlobalErrors.Kill
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue =PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?List
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar)
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
Relate:Actions.Open
FilesOpened = True
BRW1.Init(?List,Queue:Browse.ViewPosition,BRW1::View:Browse,Queue:Browse,Relate:Actions,SELF)
OPEN(BrowseWindow)
SELF.Opened=True
BRW1.Q &= Queue:Browse
BRW1.AddSortOrder(,ACT:KeyAction)
BRW1.AddLocator(BRW1::Sort0:Locator)
BRW1::Sort0:Locator.Init(,ACT:Action,1,BRW1)
BRW1.AddField(ACT:Action,BRW1.Q.ACT:Action)
BRW1.AddField(ACT:Priority,BRW1.Q.ACT:Priority)
BRW1.ArrowAction = EIPAction:Default+EIPAction:Remain+EIPAction:RetainColumn
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
EIPManagerClass 453
BRW1.AddToolbarTarget(Toolbar)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue =PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Actions.Close
END
RETURN ReturnValue
BRW1.Init|
PROCEDURE(SIGNED ListBox,*STRING Posit,VIEW V,QUEUE Q,RelationManagerRM,WindowManager WM)
CODE
PARENT.Init(ListBox,Posit,V,Q,RM,WM)
SELF.EIP &= BRW1::EIPManager ! Browse object's reference to the BrowseEIPManager
454 ABC Library Reference
EIPManagerClass Properties
Note: The Arrow property should be treated as a PROTECTED property except during
initialization.
Implementation: When the EIPManager is instantiated from a browse the Arrow property will point
to the BrowseClass.ArrowAction.
Enter &BYTE
The Enter property is a reference to the BrowseClass.EnterAction property, and indicates the
action to take when the end user presses the ENTER key during an edit-in-place process.
Note: The Enter property should be treated as a PROTECTED property except during
initialization.
Implementation: The AddControl method adds browse list columns to the EQ property. An entry
without an associated control indicates a column that has been specified as non-
edit-in-place.
You do not need to initialize this property to implement the default edit-in-place
controls. The EQ property supports custom edit-in-place controls.
Note: The Fields property should be treated as a PROTECTED property except during
initialization.
FocusLoss &BYTE
The FocusLoss property is a reference to the BrowseClass.FocusLossAction property, and
indicates the action to take with regard to pending changes when the edit control loses focus
during an edit-in-place process.
Insert BYTE
The Insert property indicates where in the list a new record will be added when the end user
inserts a new record. The default placement is below the selected record.
Implementation: There are three places a new record can be placed in a list when using edit-in-
place: above the selected record; below the selected record (the default); or
appended to the bottom of the list.
Note: This does not change the sort order. After insertion, the list is resorted and the
new record appears in the proper position within the sort sequence.
The specified placements are implemented by the BrowseEIPManager.Init method. Set the
record insertion point by assigning, adding, or subtracting the following EQUATEd values to
Insert. The following EQUATEs are in ABEdit.INC:
ITEMIZE,PRE(EIPAction)
Default EQUATE(0)
Always EQUATE(1)
Never EQUATE(2)
Prompted EQUATE(4)
Save EQUATE(7)
Remain EQUATE(8)
Before EQUATE(9) ! insert before/above selected record
Append EQUATE(10) ! insert at the bottom of the list
RetainColumn EQUATE(16)
END
ListControl SIGNED
The ListControl property contains the control number of the LIST control that is utilizing edit-in-
place.
Implementation: The LastColumn method is assigned the value of the Column property in the
ResetColumn method.
EIPManagerClass 459
Implementation: The TakeEvent and TakeFieldEvent methods assign the appropriate value to the
Repost property. The Kill method posts the specified event to the appropriate
edit-in-place control based on the value contained in the RepostField property.
Implementation: The TakeFieldEvent method assigns the appropriate value to the RepostField
property. The Kill method posts the specified event to the appropriate edit-in-
place control based on the value contained in the RepostField property.
Implementation: The Run method is passed a parameter which contains the value assigned to the
Req property.
Implementation: The TakeAction method conditionally assigns a value of one (1) to the
SeekForward property based on the actions of the end user.
Tab &BYTE
The Tab property is a reference to the BrowseClass.TabAction property that indicates the action
to take when the end user presses the TAB key during an edit-in-place process.
Note: The Tab property should be treated as a PROTECTED property except during
initialization.
EIPManagerClass Methods
EIPManagerClass--Functional Organization--Expected Use
As an aid to understanding the EIPManagerClass, it is useful to organize its methods into two
large categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the EIPManagerClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
TakeAcceptAll handle all validation settings
TakeEventD handle events for the edit control
TakeNewSelectionD handle Event:NewSelection
Occasional Use:
AddControl register edit-in-place controls
ClearColumnV reset column property values
CreateContolV a virtual to create the edit control
GetEditV identify edit-in-place field
Next get the next edit-in-place field
ResetColumnV reset edit-in-place object to selected field
SetAlertsV alert appropriate keystrokes for the edit control
TakeActionV process end user actions
TakeCompletedV process completion of edit
TakeFocusLossV process loss of focus
TakeFieldEventD handle field specific events
Typically you will not call these methods directly--the Non-Virtual methods call them. However,
we anticipate you will often want to override these methods, and because they are either derived
or virtual, they are very easy to override. These methods do provide reasonable default behavior
in case you do not want to override them.
The AddControl method specifies the editclass that defines the edit-in-place control for the
browse column. Use autofree with caution; you should only DISPOSE of memory allocated with a
NEW statement. See the Language Reference for more information on NEW and DISPOSE.
The AddControl method also registers fields which will not be editable via edit-in-place. In this
instance the EditClass parameter is omitted.
Example:
BrowseClass.AddEditControl PROCEDURE(EditClass EC,UNSIGNED Id,BYTE Free)
CODE
SELF.CheckEIP
SELF.EIP.AddControl(EC,Id,Free)
ClearColumn, VIRTUAL
The ClearColumn method checks for a value in the LastColumn property and conditionally sets
the column values to zero (0).
Example:
EIPManager.TakeNewSelection PROCEDURE ! Must be overridden to handle out-of-row click
CODE
IF FIELD() = SELF.ListControl AND KEYCODE() = MouseLeft ! An in-row mouse click
SELF.ClearColumn
SELF.Column = SELF.ListControl{PROPLIST:MouseUpField}
SELF.ResetColumn
END
RETURN Level:Benign
Implementation: GetEdit is called by the Next method, and returns one (1) if any value is in the
Control field of the EditQueue, otherwise it returns zero (0).
Example:
EIPManager.Next PROCEDURE
CODE
GET(SELF.EQ,RECORDS(SELF.EQ))
? ASSERT(~ERRORCODE())
LastCol=SELF.EQ.Field
LOOP
CLEAR(SELF.EQ)
SELF.EQ.Field = SELF.Column
GET(SELF.EQ,SELF.EQ.Field)
IF ~ERRORCODE() AND SELF.GetEdit()
BREAK
END
!executable code
Implementation: The BrowseEIPManager.Init method calls the Init method. The Init method
primes variables and calls the InitControls method which then initializes the
appropriate edit-in-place controls.
Example:
BrowseEIPManager.Init ! initialize BrowseEIPManagerClass object
!program code
RETURN PARENT.Init() ! call to the EIPManager.Init
Implementation: The Init method calls the InitControls method. The InitControls method checks for
custom edit-in-place controls in the EditQueue before adding a default edit-in-
place control.
Example:
EIPManager.Init PROCEDURE
CODE
IF SELF.Column = 0 THEN SELF.Column = 1.
SELF.LastColumn = 0
SELF.Repost = 0
SELF.RepostField = 0
ASSERT(~SELF.EQ &= NULL)
SELF.EQ.Field = 1
SELF.InitControls
SELF.ResetColumn
RETURN Level:Benign
Implementation: The BrowseEIPManager.Kill method calls the Kill method with a PARENT call.
The Kill method destroys the edit-in-place controls created by the InitControls
method.
Example:
BrowseEIPManager.Kill PROCEDURE
CODE
SELF.BC.ResetFromAsk(SELF.Req,SELF.Response)
RETURN PARENT.Kill()
Next, PROTECTED
The Next method gets the next edit-in-place control in the direction specified (forward or
backward) by the end user.
Implementation: The Next method loops through the EditQueue and gets the next edit-in-place
control based on the RETURN value of the GetEdit method.
Example:
EIPManager.ResetColumn PROCEDURE
CODE
SETKEYCODE(0)
SELF.Next
IF SELF.Column <> SELF.LastColumn
SELF.ListControl{PROP:Edit,SELF.EQ.Field} = SELF.EQ.Control.Feq
SELECT(SELF.EQ.Control.Feq)
SELF.LastColumn = SELF.Column
END
Implementation: The ResetColumn method resets the FEQ to the selected ListControl field.
Example:
EIPManager.TakeCompleted PROCEDURE(BYTE Force)
CODE
SELF.Column = 1
IF SELF.Again
SELF.ResetColumn
END
Run( request )
Example:
BrowseClass.AskRecord PROCEDURE(BYTE Req)
CODE
SELF.CheckEIP
RETURN SELF.EIP.Run(Req)
TakeAcceptAll ( ), VIRTUAL
Example:
EIPManager.TakeFieldEvent PROCEDURE
I UNSIGNED(1)
CODE
IF FIELD() = SELF.ListControl THEN RETURN Level:Benign .
LOOP I = 1 TO RECORDS(SELF.EQ)+1
! Optimised to pick up subsequent events from same field
IF ~SELF.EQ.Control &= NULL AND SELF.EQ.Control.Feq = FIELD()
SELF.TakeAction(SELF.EQ.Control.TakeEvent(EVENT()))
RETURN Level:Benign
END
GET(SELF.EQ,I)
END
! Code to handle an unknown field
TakeCompleted Determines the edit-in-place dialog's action after either a loss of focus or an end
user action.
action An integer constant, variable, EQUATE, or expression that indicates an end user
requested action.
The TakeCompleted method conditionally calls the ResetColumn method. The
BrowseEIPManager.TakeCompleted provides the bulk of the process completion functionality,
and is derived from the TakeCompleted method.
Example:
EIPManager.TakeFocusLoss PROCEDURE
CODE
CASE CHOOSE(SELF.FocusLoss&=NULL,EIPAction:Default,BAND(SELF.FocusLoss,EIPAction:Save)
OF EIPAction:Always OROF EIPAction:Default
SELF.TakeCompleted(Button:Yes)
OF EIPAction:Never
SELF.TakeCompleted(Button:No)
ELSE
SELF.TakeCompleted(0)
END
Implementation: The TakeFieldEvent method calls the TakeEvent method. The TakeEvent
method calls the TakeFocusLoss method subsequent to returning a Level:Fatal.
Example:
EIPManager.TakeFieldEvent PROCEDURE
I UNSIGNED(1)
CODE
IF FIELD() = SELF.ListControl THEN RETURN Level:Benign .
LOOP I = 1 TO RECORDS(SELF.EQ)+1
! Optimised to pick up subsequent events from same field
IF ~SELF.EQ.Control &= NULL AND SELF.EQ.Control.Feq = FIELD()
SELF.TakeAction(SELF.EQ.Control.TakeEvent(EVENT()))
RETURN Level:Benign
END
GET(SELF.EQ,I)
END
! Code to handle an unknown field
Example:
MyWindowManager.TakeEvent PROCEDURE
RVal BYTE(Level:Benign)
I USHORT,AUTO
CODE
IF ~FIELD()
RVal = SELF.TakeWindowEvent()
IF RVal THEN RETURN RVal.
END
CASE EVENT()
OF EVENT:Accepted; RVal = SELF.TakeAccepted()
OF EVENT:Rejected; RVal = SELF.TakeRejected()
OF EVENT:Selected; RVal = SELF.TakeSelected()
OF EVENT:NewSelection; RVal = SELF.TakeNewSelection()
OF EVENT:Completed; RVal = SELF.TakeCompleted()
OF EVENT:CloseWindow OROF EVENT:CloseDown
RVal = SELF.TakeCloseEvent()
END
IF RVal THEN RETURN RVal.
IF FIELD()
RVal = SELF.TakeFieldEvent()
END
RETURN RVal
EIPManagerClass 475
TakeFocusLoss, VIRTUAL
The TakeFocusLoss method determines the appropriate action to take when the EIPManager
window loses focus, and calls the TakeCompleted method with the appropriate parameter.
Example:
EIPManager.TakeFieldEvent PROCEDURE
I UNSIGNED(1)
CODE
IF FIELD() = SELF.ListControl THEN RETURN Level:Benign .
LOOP I = 1 TO RECORDS(SELF.EQ)+1
! Optimized to pick up subsequent events from same field
IF ~SELF.EQ.Control &= NULL AND SELF.EQ.Control.Feq = FIELD()
SELF.TakeAction(SELF.EQ.Control.TakeEvent(EVENT()))
RETURN Level:Benign
END
GET(SELF.EQ,I)
END
! Code to handle an unknown field
Example:
BrowseEIPManager.TakeNewSelection PROCEDURE
CODE
IF FIELD() = SELF.ListControl
IF CHOICE(SELF.ListControl) = SELF.BC.CurrentChoice
RETURN PARENT.TakeNewSelection()
ELSE
! Code to handle Focus change to different record
END
END
EntryLocatorClass
EntryLocatorClass Overview
The EntryLocatorClass is a LocatorClass with an input control (ENTRY, COMBO, or SPIN). An
Entry Locator is a multi-character locator that activates when the locator control is accepted (not
upon each keystroke).
Use an Entry Locator when you want a multi-character search on numeric or alphanumeric keys
and you want to delay the search until the user accepts the locator control. This delayed search
reduces network traffic and provides a smoother search in a client-server environment.
EntryLocatorClass Concepts
The EntryLocatorClass lets you specify a locator control and a sort field on which to search (the
free key element) for a BrowseClass object. The BrowseClass object uses the EntryLocatorClass
to locate and scroll to the nearest matching item.
When the end user places one or more characters in the locator control, then accepts the control
by pressing TAB, pressing a locator button, or selecting another control on the screen, the
EntryLocatorClass object advances the BrowseClass object's LIST to the nearest matching
record.
The BrowseClass uses the EntryLocatorClass to locate and scroll to the nearest matching item.
Therefore, if your program's BrowseClass objects use an Entry Locator, your program must
instantiate the EntryLocatorClass for each use. Once you register the EntryLocatorClass object
with the BrowseClass object (see BrowseClass.AddLocator), the BrowseClass object uses the
EntryLocatorClass object as needed, with no other code required. See the Conceptual Example.
The ABC BrowseBox template generates code to instantiate the EntryLocatorClass for your
BrowseBoxes. The EntryLocatorClass objects are called BRWn::Sort#:Locator, where n is the
template instance number and # is the sort sequence (id) number. As this implies, you can have a
different locator for each BrowseClass object sort order.
You can use the BrowseBox's Locator Behavior dialog (the Locator Class button) to derive
from the EntryLocatorClass. The templates provide the derived class so you can modify the
locator's behavior on an instance-by-instance basis.
478 ABC Library Reference
The EntryLocatorClass source code is installed by default to the Clarion \LIBSRC folder. The
specific EntryLocatorClass source code and their respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a BrowseClass object and related objects, including an EntryLocatorClass
object. The example initializes and page-loads a LIST, then handles a number of associated
events, including scrolling, updating, and locating records.
Note that the WindowManager and BrowseClass objects internally handle the normal events
surrounding the locator.
PROGRAM
INCLUDE('ABWINDOW.INC') !declare WindowManager class
INCLUDE('ABBROWSE.INC') !declare BrowseClass and Locator
MAP
END
State FILE,DRIVER('TOPSPEED'),PRE(ST),THREAD
StateCodeKey KEY(ST:STATECODE),NOCASE,OPT
Record RECORD,PRE()
STATECODE STRING(2)
STATENAME STRING(20)
END
END
StView VIEW(State) !declare VIEW to process
END
StateQ QUEUE !declare Q for LIST
ST:STATECODE LIKE(ST:STATECODE)
ST:STATENAME LIKE(ST:STATENAME)
ViewPosition STRING(512)
END
Access:State CLASS(FileManager) !declare Access:State object
Init PROCEDURE
END
Relate:State CLASS(RelationManager) !declare Relate:State object
Init PROCEDURE
END
VCRRequest LONG(0),THREAD
EntryLocatorClass 479
CODE
ThisWindow.Run() !run the window procedure
CODE
ReturnValue = PARENT.Kill() !call base class shut down
IF ReturnValue THEN RETURN ReturnValue.
Relate:State.Close !close State and related files
Relate:State.Kill !shut down Relate:State object
GlobalErrors.Kill !shut down GlobalErrors object
RETURN ReturnValue
EntryLocatorClass 481
EntryLocatorClass Properties
EntryLocatorClass Properties
The EntryLocatorClass inherits all the properties of the LocatorClass from which it is derived. See
LocatorClass Properties and LocatorClass Concepts for more information.
In addition to the inherited properties, the EntryLocatorClass also contains the following property:
Shadow CSTRING(40)
The Shadow property contains the search value for the entry locator.
The TakeKey method adds to the search value based on the end user's keyboard input. The
BrowseClass.TakeAcceptedLocator method implements the search for the specified value.
EntryLocatorClass Methods
The EntryLocatorClass inherits all the methods of the LocatorClass from which it is derived. See
LocatorClass Methods and LocatorClass Concepts for more information.
GetShadow, DERIVED
The GetShadow method returns the value of the Shadow property. The Shadow property is set
based on the users keyboard input into the entry locator field.
Implementation: The Init method sets the values of the Control, FreeElement, NoCase, and
ViewManager properties. The Shadow property is the control's USE variable.
Example:
BRW1::Sort1:Locator.Init(,CUST:StateCode,1) !without locator control
BRW1::Sort2:Locator.Init(?CUST:CustMo,CUST:CustNo,1) !with locator control
Set, DERIVED
The Set method prepares the locator for a new search.
Implementation: The Set method clears the FreeElement property and the Shadow property.
Example:
MyBrowseClass.TakeScroll PROCEDURE(SIGNED Event) !process a scroll event
CODE
!handle the scroll
SELF.PostNewSelection !post EVENT:NewSelection to list
IF ~SELF.Sort.Locator &= NULL !if locator is present
SELF.Sort.Locator.Set ! clear it
END
IF SELF.Sort.Thumb &= NULL !if thumb is present
SELF.UpdateThumbFixed ! reposition it
END
SetShadow(shadow), DERIVED
A locator value is accepted when the end user changes the locator value, then TABS off the
locator control or otherwise switches focus to another control on the same window.
Implementation: The TakeAccepted method primes the FreeElement property with the entered
search value, then returns one (1 or True) if a new search is required or returns
zero (0 or False) if no new search is required.
Example:
MyBrowseClass.TakeAcceptedLocator PROCEDURE
CODE
IF ~SELF.Sort.Locator &= NULL !if locator is present
IF SELF.Sort.Locator.TakeAccepted() !if locator value requires a search
SELF.Reset(1) !reposition the view
SELECT(SELF.ListControl) !focus on the list control
SELF.ResetQueue( Reset:Done ) !reset the browse queue
SELF.Sort.Locator.Reset !reset the locator USE variable
END
END
Implementation: The BrowseClass.TakeKey method calls the locator TakeKey method. The
TakeKey method stuffs the keystroke detected by the LIST into the locator's input
control and returns zero (0 or False).
Example:
MyBrowseClass.TakeKey PROCEDURE
CODE
IF RECORDS(SELF.ListQueue)
CASE KEYCODE()
OF InsertKey OROF DeleteKey OROF CtrlEnter OROF MouseLeft2 ;!handle keys
ELSE
DO CheckLocator !handle all other keystrokes
END
END
RETURN 0
CheckLocator ROUTINE
IF ~(SELF.Sort.Locator &= NULL)
IF SELF.Sort.Locator.TakeKey() !add keystroke to locator input control
SELF.Reset(SELF.GetFreeElementPosition()) !and refresh browse if necessary
SELF.ResetQueue(Reset:Done)
DO HandledOut
ELSE
IF RECORDS(SELF.ListQueue)
DO HandledOut
END
END
END
HandledOut ROUTINE
SELF.UpdateWindow
SELF.PostNewSelection
RETURN 1
Implementation: The Update method primes the FreeElement property with the current search
value (the Shadow property), then calls the UpdateWindow method to redraw the
locator control.
Example:
MyBrowseClass.UpdateWindow PROCEDURE !update browse related controls
CODE
IF ~(SELF.Sort.Locator &= NULL) !if locator is present
SELF.Sort.Locator.UpdateWindow !redraw locator control
END
UpdateWindow, DERIVED
The UpdateWindow method redraws the locator control with the current locator value.
Implementation: The Update method calls the UpdateWindow method to redraw the locator
control with the current locator contents.
Example:
MyBrowseClass.UpdateWindow PROCEDURE !update browse related controls
CODE
IF ~(SELF.Sort.Locator &= NULL) !if locator is present
SELF.Sort.Locator.UpdateWindow ! redraw locator control
END
ErrorClass
ErrorClass Overview
The ErrorClass declares an error manager which consistently and flexibly handles any errors.
That is, for a given program scope, you define all possible errors by ID number, severity, and
message text, then when an error or other notable condition occurs, you simply pass the
appropriate ID to the error manager which processes it appropriately based on its severity level.
The defined "errors" may actually include questions, warnings, notifications, messages, benign
tracing calls, as well as true errors. The ErrorClass comes with about forty general purpose
database errors already defined. You can expand this list to include additional general purpose
errors, your own application-specific errors, or even field specific data validation errors. Your
expansion of the errors list may be "permanent" or may be done dynamically at runtime.
By default, the error manager recognizes six different levels of error severity. The default actions
for these levels range from no action for benign errors to halting the program for fatal errors. The
error manager also supports the intermediate actions of simply notifying the user, or of notifying
the user and letting the user decide whether to continue or abort.
Customizable Treatments
These various levels of treatment are implemented with virtual methods so they are easy to
customize. The error manager calls a different virtual method for each severity level, so you can
override the default error actions with your own application specific error actions. See the various
Take methods for examples.
The recognized severity EQUATEs are declared in ABERROR.INC. These severity levels and
their default actions are:
You may define your own additional severity levels and their associated actions.
ErrorClass 491
You may edit these error definitions to suit your own requirements. That is, you may add new
error definitions, change the wording of the error message text, or even translate the English text
to another language.
Note: If you use the ABC Templates you should not remove any of the default error
definitions or change their ID numbers.
Each error has associated message text. The error message text may contain macro symbols
recognized by the ErrorClass object. The ErrorClass object expands these macro symbols to their
current runtime values before displaying the message. Supported macros and their runtime
substitution values are:
The %ErrorText macro uses %FileError(%FileErrorCode)--the more specific backend server error
information--when it is available, otherwise it uses %Error(%ErrorCode).
This macro expansion capability is a feature of the ErrorClass and is not a feature of the Clarion
language in general.
Tip: You do not need to specify two percent signs (%%) to display a percent sign (%) in
your message text.
ErrorClass 493
Then at runtime, initialize the error manager with the appropriate error definition block. For
example, you could override the Init method (defined in ABERROR.CLW) with something like
this:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
Init PROCEDURE(BYTE PreferredLanguage)
END
CODE
Language = GETINI('Preferences','Language',0) !get language preference
GlobalErrors.Init(Language) !GlobalErrors initialization
!with preferred language
Alternatively, you could call the AddErrors method to define additional errors for the selected
language as shown in the following example.
494 ABC Library Reference
PROGRAM
INCLUDE('ABERROR.INC') !include ErrorClass declarations
CODE
GlobalErrors.Init !initialize (add default errors)
GlobalErrors.AddErrors(AppErrors) !add app specific errors
GlobalErrors.SetFatality(Msg:DuplicateKey,Level:Fatal) !modify severity of an error
!
!program code
!
!user attempts to enter invalid month value...
GlobalErrors.SetField('Month') !set %Field for macro expansion
GlobalErrors.ThrowMessage(Msg:FieldOutOfRange,'1 and 12')!pass error to errormanager
!
!user attempts to insert a duplicate key...
GlobalErrors.SetFile('Customer') !set %File for macro expansion
GlobalErrors.Throw(Msg:DuplicateKey) !pass error to errormanager
!program code
!
GlobalErrors.Kill !shut down GlobalErrors object
ErrorClass 495
ErrorClass Properties
ErrorClass Properties
There are two types of ErrorClass properties, the Errors list and the macro substitution values.
The most important property is the Errors list--the list of errors recognized by ErrorClass. The
defined "errors" may actually include questions, warnings, notifications, benign tracing calls, as
well as true errors. This list is established by the ErrorClass initialization method, ErrorClass.Init.
The list may be modified thereafter by methods provided for this purpose, allowing application
specific errors (such as field specific invalid data messages).
The other three ErrorClass properties support the error text "macros" recognized by the error
manager. The error manager expands these macro symbols to their current runtime values
before displaying the message.
The DefaultCategory is a string that is a classification of the type of error. This property is set by
the SetCategory. The Init method sets the DefaultCategory to 'ABC'. When the category is
changed by SetCategory, the new category becomes the default category.
See Also:
ErrorClass.Init, ErrorClass.SetCategory, ErrorClass.GetCategory
The default errors are defined in ABERROR.TRN. You may edit ABERROR.TRN to customize
the default error list. The Init method adds these default error definitions to the Errors property at
runtime. You may also use the SetFatality method, the AddErrors method, and the RemoveErrors
method to customize the Errors property at runtime.
The AddErrors method lets you add more error definitions, override existing error definitions, or
both. The Errors property may have more than one error with the same ID. Error definitions
added later "override" any earlier definitions with the same IDs. The "overridden" definitions are
preserved for substitution into the %Previous macro symbol.
The RemoveErrors method lets you remove error definitions, restore previously overridden errors,
or both.
The error message text may contain "macros" recognized by the error manager. The error
manager expands these macro symbols to their current runtime values before displaying the
message. See Macro Expansion for more information.
The Silent property determines whether an error will be displayed to the screen. If Silent is set to
one (1 or True), the error message box will not be displayed to the screen; however it will be
added to the error log file. If Silent is set to zero, (0 or False) the error is displayed to the screen
as well as added to the error log file.
500 ABC Library Reference
ErrorClass Methods
ErrorClass Functional Organization--Expected Use
As an aid to understanding the ErrorClass, it is useful to organize the various ErrorClass methods
into two large categories according to their expected use--the Non-Virtual and the virtual
methods. This organization reflects what we believe is typical use of the ErrorClass methods.
Non-Virtual Methods
The Non-Virtual methods, which you are likely to call fairly routinely from your program, can be
further divided into three categories:
Mainstream Use:
Throw process an error
ThrowFile set substitution value of %File then process an error
ThrowMessage set substitution value of %Message then process an error
Message display an error message from the Errors list
Occasional Use:
SetField set the substitution value of the %Field macro
SetFile set the substitution value of the %File macro
SetErrors save the current error state
SetId make a selected error the current one
RemoveErrors remove (and/or restore) error definitions
TakeError process an error, assuming SetErrors has been called
ErrorClass 501
Virtual Methods
Typically, you will not call these methods directly--the Non-Virtual methods call them. We
anticipate you will want to override these methods, and because they are virtual, they are very
easy to override. However they do provide reasonable default behavior in case you do not want
to override them. These methods are listed functionally rather than alphabetically.
AddErrors Adds entries to the Errors property from the error block passed to it.
error block A GROUP whose first component field is a USHORT containing the number of
error entries in the GROUP. Subsequent component fields define the error
entries.
The AddErrors method receives error entries and adds them to the existing Errors property.
These later added Error definitions "override" any earlier definitions with the same IDs. The
"overridden" definitions are preserved for substitution into the %Previous macro symbol, and may
be fully restored by removing the overriding error entries with the RemoveErrors method.
Implementation: AddErrors assumes the Errors property has already been created by Init or by
some other method.
Each error block entry consists of a USHORT containing the error ID, a BYTE containing the
severity level, a PSTRING containing the title to display on the error message window, and
another PSTRING containing the error message text.
Example:
AppErrors GROUP
Number USHORT(2) !number of errors in the group
USHORT(Msg:RebuildKey) !first error ID
BYTE(Level:Notify) !severity level
PSTRING('Invalid Key') !window title
PSTRING('%File key is invalid.') !message text
USHORT(Msg:RebuildFailed) !second error ID
BYTE(Level:Fatal) !severity level
PSTRING('Key was not built') !window title
PSTRING('Repairing key for %File.')!message text
END
GlobalErrors ErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
GlobalErrors.AddErrors(AppErrors) !add some app specific errors
Main !call main procedure
GlobalErrors.Kill !GlobalErrors termination
AddHistory, VIRTUAL
The AddHistory method adds an entry to the History structure. This structure is used to display
the message to the screen.
GetCategory([Id] )
GetProcedureName
The GetProcedureName method returns the name of the procedure in which it has been called.
Implementation: Returns the name of the procedure as established in t he .APP file providing that
the procedure name has been added to a PRIVATE queue by the
SetProcedureName method. The GetProcedureName method is not called by
any other methods or templates.
caption A string constant, variable, EQUATE, or expression that specifies the message
box window caption.
icon An integer constant, variable, EQUATE, or expression that indicates the icon to
display on the message box.
buttons An integer constant, variable, EQUATE, or expression that indicates which
Windows standard buttons to place on the message box. This may indicate
multiple buttons.
default button An integer constant, variable, EQUATE, or expression that indicates the default
button on the message box.
The HistoryMsg method initializes the error message dialog.
Implementation: Creates the Errors property and calls the AddErrors method to initialize it with the
default errors defined in ABERROR.TRN. Default error ID EQUATEs are defined
in ABERROR.INC.
The standard templates instantiate a single global ErrorClass object and make a single global call
to Init. However, you may wish to instantiate an ErrorClass object with a separate set of errors for
each base class, or for any other logical entity (for example a PayrollErrors object for the Payroll
segment of your program).
Example:
GlobalErrors ErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
Main !call main procedure
GlobalErrors.Kill !GlobalErrors termination
Kill
The Kill method disposes any memory allocated during the object's lifetime and performs any
other necessary termination code.
Example:
GlobalErrors ErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
Main !call main procedure
GlobalErrors.Kill !GlobalErrors termination
Message Displays an error message dialog box and returns the button the user pressed.
error id An integer constant, variable, EQUATE, or expression that indicates which
ErrorClass.Errors message to show in the dialog box.
buttons An integer constant, variable, EQUATE, or expression that indicates which
Windows standard buttons to place on the dialog box. This may indicate multiple
buttons.
default button An integer constant, variable, EQUATE, or expression t