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 that indicates the default
button on the dialog box.
The Message method displays a Windows-standard message box containing the error message
text from the Errors property, and returns the number of the button the user presses to exit the
dialog box. This method provides a simple, centrally maintainable, consistent way to display
messages.
Implementation: Uses the MESSAGE statement to display an application modal window with a
question icon, the caption defined in the Errors property, and the message text
defined in the Errors property.
The ABERROR.INC file contains a list of default symbolic constants for the error id parameter.
The EQUATES.CLW file contains symbolic constants for the buttons and default button
parameters. The EQUATEs are:
BUTTON:OK
BUTTON:YES
BUTTON:NO
BUTTON:ABORT
BUTTON:RETRY
BUTTON:IGNORE
BUTTON:CANCEL
BUTTON:HELP
Example:
!attempted auto increment of key has failed,
!show Message box with Yes and No buttons, the default is No
GlobalErrors.SetErrors !Set value of %ErrorText macro
IF GlobalErrors.Message(Msg:RetryAutoInc,BUTTON:Yes+BUTTON:No,BUTTON:No) = BUTTON:Yes
CYCLE
END
ErrorClass 509
Msg( txt, [caption], [icon], [buttons], [default button] , [style]), PROC, VIRTUAL, PROTECTED
txt A string constant, variable, EQUATE, or expression that contains the error
message text to display in the message box.
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. If omitted this is equivalent to Button:OK.
default button An integer constant, variable, EQUATE, or expression that indicates the default
button on the message box.
style An integer constant, variable, EQUATE, or expression that indicates the font
style to use withing the lixt control on the message box dialog.
The Msg method initiates the error destination. If the error is to be written to the error log file, the
AddHistory method is called. The MessageBox method is called to display the error message to
the window.
MessageBox([Level], txt, [caption], [icon], buttons, default button, style), VIRTUAL, PROTECTED
txt A string constant, variable, EQUATE, or expression that contains the error
message text to display in the message box.
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. If omitted this is equivalent to Button:OK.
default button An integer constant, variable, EQUATE, or expression that indicates the default
button on the message box.
style An integer constant, variable, EQUATE, or expression that indicates the font
style to use withing the lixt control on the message box dialog.buttons
The MessageBox method implements a simple MESSAGE() dialog to display the error message
to the window. This can be called independantly. It is also used is the ErrorClass is configured to
not have a HistoryThreshold.
RemoveErrors Removes the entries specified in the error block from the Errors property.
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 RemoveErrors method receives error entries and deletes them from the existing Errors
property.
The Errors property may contain more than one error with the same ID. Errors added later
override earlier added errors with the same IDs. If you remove an overriding error definition, the
"overridden" error is fully restored.
Implementation: RemoveErrors 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. However, RemoveErrors only considers the
error ID when removing errors.
Example:
GlobalErrors ErrorClass !declare GlobalErrors object
Payroll PROCEDURE
PayErrors GROUP,STATIC
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
CODE
GlobalErrors.AddErrors(PayErrors) !add Payroll specific errors
!process payroll
GlobalErrors.RemoveErrors(PayErrors) !remove Payroll specific errors
ResetHistory
The ResetHistory method resets the error History structure. This can be done after the view of
each error message if the ResetHistoryOnView property is set.
SetCategory([id], category)
The SetCateogry method sets the error category in the ErrorEntry structure. If the id is omitted
the DefaultCategory is used.
ErrorClass 513
SetErrors
The SetErrors method saves the current error state for use by the ErrorClass.
Implementation: The SetErrors method saves the return values from ERROR(), ERRORCODE(),
FILEERROR(), and FILERERRORCODE(). The saved values are used for
expansion of any %Error, %ErrorCode, %FileError, or %FileErrorCode macro
symbols within the error message text.
The Throw method calls SetErrors prior to handling the specified error, therefore
you only need to call the SetErrors method when you do not use the Throw
method.
Example:
!an error occurs
GlobalErrors.SetErrors !save the error state
OPEN(LogFile) !open log (changes the error state)
Log:Text = FORMAT(TODAY(),@D1)&' '&FORMAT(CLOCK(),@T1)
ADD(LogFile) !write log (changes the error state)
RETURN GlobalErrors.TakeError(Msg:AddFailed)!process error with saved error state
Implementation: The SetFatality method calls the SetId method to locate the specified error.
The ABERROR.INC file contains a list of default symbolic constants for the error
id parameter. It also contains symbolic constants for the severity parameter. The
severity EQUATEs and their default actions are:
You may define your own additional severity levels and their associated actions.
Example:
GlobalErrors ErrorClass
CODE
GlobalErrors.Init
GlobalErrors.SetFatality(Msg:CreateFailed,Level:Fatal) !change severity to fatal
CREATE(MyFile)
IF ERRORCODE()
GlobalErrors.SetFile('MyFile') !specify file that failed
GlobalErrors.Throw(Msg:CreateFailed) !issue fatal error message
END
SetField( fieldname )
Example:
!Lookup on State Code failed
GlobalErrors.SetField('State') !set field that failed
GlobalErrors.ThrowMessage(Msg:FieldNotInFile,'State File') !process the error
SetFile( filename )
The ThrowFile method sets the %File macro before processing the specified error. That is,
ThrowFile combines the functionality of SetFile and Throw into a single method.
Example:
CREATE(MyFile)
IF ERRORCODE() !if error occurred
GlobalErrors.SetFile(NAME(MyFile)) !set file that failed
GlobalErrors.Throw(Msg:CreateFailed) !process the error
END
SetKey( keyname )
Example:
CASE ERRORCODE()
OF NoError
SELF.AutoIncDone = 0
RETURN Level:Benign
OF DupKeyErr
IF HandleError
IF ~SELF.HasAutoInc
GET(SELF.File,0) ! Flag for DUPLICATE function
END
LOOP I = 1 TO RECORDS(SELF.Keys)
GET(SELF.Keys,I)
IF DUPLICATE(SELF.Keys.Key)
SELF.Errors.SetKey(CHOOSE(CLIP(SELF.Keys.Description)<>'',|
CLIP(SELF.Keys.Description),SELF.Keys.Key{PROP:NAME}))
SELF.ThrowMessage(Msg:DuplicateKey,SELF.Keys.Description)
RETURN Level:Notify
END
END
ELSE
SELF.SetError(Msg:DuplicateKey)
END
ELSE
SELF.SetError(Msg:AddFailed)
IF HandleError
RETURN SELF.Throw()
END
END
RETURN Level:Notify
This method is PROTECTED, therefore, it can only be called from an ErrorClass method, or a
method in a class derived from ErrorClass.
Implementation: The ABERROR.INC file contains a list of default EQUATEs for the error id
parameter.
Example:
ErrorClass.TakeError PROCEDURE(SHORT Id)
CODE
SELF.SetId(Id)
CASE SELF.Errors.Fatality
OF Level:Benign
RETURN SELF.TakeBenign()
OF Level:User
OROF Level:Cancel
RETURN SELF.TakeUser()
OF Level:Program
RETURN SELF.TakeProgram()
OF Level:Fatal
RETURN SELF.TakeFatal()
OF Level:Notify
SELF.TakeNotify()
RETURN Level:Notify
ELSE
RETURN SELF.TakeOther()
END
SetProcedureName
The SetProcedureName method stores the name ofthe procedure, as defined in
the .APP file, in a PRIVATE queue.
name A string constant, variable or EQUATE containing the name of the procedure to
add to ProcName queue. If omitted, the current procedure name is deleted from
the ProcName queue.
Implementation: SetProcedureName is called by the ABWindow.tpw so that every template
generated procedure utilizing a window will have an entry in the ProcName
queue. SetProcedureName is inserted into the Init method of the window using
the %Procedure macro as the passed parameter. It is called again in the Kill
method of the window, and the name parameter is omitted.
Example:
GlobalErrors.SetProcedureName('%Procedure')
SubsString, PROTECTED
The SubsString method returns the current error message text with all runtime macros resolved.
Implementation: The TakeFatal, TakeNotify, TakeUser, and Message methods call the SubsString
method to resolve macros.
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeBenign FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
.
.
.
GlobalErrors.Throw(Msg:NoError) !Throw method calls SELF.TakeBenign to
!automatically call the derived class method
!rather than the base class method
.
.
.
TakeError Locates the specified error, calls the appropriate method to handle it, then
returns the severity level.
error id An integer constant, variable, EQUATE, or expression that indicates which error
to process.
The TakeError method locates the specified error, then based on its severity level calls the
appropriate (TakeLevel) method to process the error, then returns the severity level.
TakeError assumes SetErrors has already been called to save the current error state.
Implementation: The ABERROR.INC file contains a list of default symbolic constants for the error
id parameter.
By default, the error manager recognizes six different levels of error severity. The TakeError
method calls a different virtual method (TakeLevel) for each severity level, which makes it easy to
override the default error actions with your own application-specific error actions. The recognized
severity EQUATEs are declared in ABERROR.INC. These severity levels and their default
actions are:
TakeFatal must return a severity level (if the program is not HALTed).
Implementation: The base class method (ErrorClass.TakeFatal) displays the error message and
HALTs the program. Although this method does not actually return, the RETURN
statement is required to avoid compile errors.
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeFatal FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw method calls SELF.TakeFatal to
!automatically call the derived class method
!rather than the base class method
!program code
Implementation: The base class method (ErrorClass.TakeNotify) displays the error message and
returns nothing. Note however, that the various "Throw" methods return
Level:Benign (via the TakeError method) when a Level:Notify error is "Thrown."
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeNotify PROCEDURE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw method calls SELF.TakeNotify to
!automatically call the derived class method
!rather than the base class method
!program code
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeOther FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw calls SELF.TakeOther to
!automatically call the derived class method
!rather than the base class method
!program code
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeProgram FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw calls SELF.TakeProgram to
!automatically call the derived class method
!rather than the base class method
!program code
Implementation: The base class method (ErrorClass.TakeUser) displays the error message and
returns either Level:Benign or Level:Cancel depending on the end user's
response.
Example:
INCLUDE('ABERROR.INC') !declare ErrorClass
MyErrorClass CLASS(ErrorClass) !declare derived class
TakeUser FUNCTION,BYTE,VIRTUAL !prototype corresponding virtual
END
GlobalErrors MyErrorClass !declare GlobalErrors object
CODE
GlobalErrors.Init !GlobalErrors initialization
!program code
GlobalErrors.Throw(Msg:CreateFailed) !Throw method calls SELF.TakeUser to
!automatically call the derived class method
. !rather than the base class method
!program code
Throw Processes the specified error then returns its severity level.
error id An integer constant, variable, EQUATE, or expression that indicates which error
to process.
The Throw method processes the specified error by calling other ErrorClass methods, then
returns its severity level.
Typically, Throw is the method your program calls when it encounters a known error. That is, as
your program encounters errors or other notable conditions, it simply calls the Throw method or
one of its variations (ThrowFile or ThrowMessage), passing it the appropriate error id. Throw then
calls any other ErrorClass methods required to handle the specified error.
Implementation: The Throw method saves the error state (ERROR, ERRORCODE, FILEERROR,
and FILEERRORCODE), locates the specified error, calls the appropriate
method to handle the error according to its severity level, then returns the
severity level.
The ABERROR.INC file contains a list of default symbolic constants for the error
id parameter.
Note: The Throw method may or may not RETURN to your calling program, depending
on the severity of the error.
Example:
!user level error occurred. ask user to confirm
Severity = GlobalErrors.Throw(Msg:ConfirmCancel) !handle the error condition
IF Severity = Level:Cancel
LocalResponse = RequestCancelled
DO ProcedureReturn
END
ThrowFile Sets the substitution value of %File, then processes the error.
error id An integer constant, variable, EQUATE, or expression that indicates which error
to process.
filename A string constant, variable, EQUATE, or expression that indicates which file
produced the error.
The ThrowFile method sets the substitution value of %File, then processes the error, and finally
returns the severity level of the error.
ThrowFile combines the functionality of SetFile and Throw into a single method.
Implementation: The ABERROR.INC file contains a list of default symbolic constants for the error
id parameter. The value of the ErrorClass.FileName property is substituted for
any %File symbols in the error message text.
Note: The ThrowFile method may or may not RETURN to your calling program,
depending on the severity of the error.
Example:
OPEN(MyFile)
IF ERRORCODE()
Severity = GlobalErrors.ThrowFile(Msg:OpenFailed, NAME(MyFile))
END
ThrowMessage
Sets the substitution value of the %Message macro, then processes the error.
error id An integer constant, variable, EQUATE, or expression that indicates which error
to process.
messagetext A string constant, variable, EQUATE, or expression to replace any %Message
symbols in the message text.
The ThrowMessage method sets the substitution value of the %Message macro, then processes
the error, and finally returns the severity level of the error.
Implementation: The ABERROR.INC file contains a list of default symbolic constants for the error
id parameter. The value of the ErrorClass.MessageText property is substituted
for any %Message symbols in the error message text.
Note: The ThrowMessage method may or may not RETURN to your calling program,
depending on the severity of the error.
Example:
OPEN(MyFile)
IF ERRORCODE()
Severity = GlobalErrors.ThrowMessage(Msg:OpenFailed, NAME(MyFile))
END
ViewHistory
The ViewHistory method initiates the viewing of the current error History structure. This structure
may contain more than one error.
ErrorLogInterface 531
ErrorLogInterface
ErrorLogInterface Concepts
The ErrorLogInterface is used to manage the update of the StdErrorFile.
ErrorLogInterface Methods
ErrorLogInterface Methods
The ErrorLogInterface defines the following methods.
Take(errtext), PROC
FieldPairsClass
FieldPairsClass Overview
In database oriented programs there are some fundamental operations that occur over and over
again. Among these repetitive operations is the saving and restoring of field values, and
comparing current field values against previous values.
The ABC Library provides two classes (FieldPairsClass and BufferedPairsClass) that supply this
basic buffer management. These classes are completely generic so that they may apply to any
pairs of fields, regardless of the fields' origins.
Tip: The fundamental benefit of these classes is their generality; that is, they let you
move data between pairs of structures such as FILE or QUEUE buffers, and
compare the data, without knowing in advance what the buffer structures look like
or, for that matter, without requiring that the fields even reside in conventional
buffer structures.
In some ways the FieldPairsClass is similar to Clarion's deep assignment operator (:=: see the
Language Reference for a description of this operator). However, the FieldPairsClass has the
following advantages over deep assignment:
The FieldPairsClass has the disadvantage of not handling arrays (because the FieldPairsClass
relies on the ANY datatype which only accepts references to simple datatypes). See the
Language Reference for more information on the ANY datatype.
FieldPairsClass Concepts
The FieldPairsClass 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.
Once the field pairs are identified, you call a single method to move all the fields in one direction
(left to right), and another method to move all the fields in the other direction (right to left). You
simply have to remember which entity (set of fields) you described as "left" and which entity you
described as "right." A third method compares the two sets of fields and returns a value to
indicate whether or not they are equivalent.
536 ABC Library Reference
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 FieldPairs object. The other FieldPairs methods
then operate on this virtual structure.
The ViewManager and the BrowseClass use the FieldPairsClass and BufferedPairsClass to
accomplish various tasks.
The BufferedPairsClass is derived from the FieldPairs class, so it provides all the functionality of
the FieldPairsClass; however, this class also provides a third buffer area (a "save" area), plus the
ability to compare the save area with the primary buffers, and the ability to restore data from the
save area to the primary buffers (to implement a standard "cancel" operation).
Various ABC Library objects instantiate the FieldPairsClass as needed; therefore, the template
generated code does not directly reference the FieldPairsClass (or BufferedPairsClass).
The FieldPairsClass source code is installed by default in the Clarion \LIBSRC folder. The
specific files and their respective components are:
The FieldPairs classes are very abstract, so here is a concrete example to help your
understanding. The following example shows a typical sequence of statements to declare,
instantiate, initialize, use, and terminate a FieldPairsClass object.
And you want to move data between the file buffer and the queue buffer.
INCLUDE('ABUTIL.INC') !declare FieldPairs Class
Fields FieldPairsClass !declare Fields object
CODE
Fields.Init !initialize FieldPairs 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
FieldPairsClass Properties
The FieldPairsClass contains the following properties.
List &FieldPairsQueue
The List property is a reference to the structure that holds all the field pairs recognized by the
FieldPairsClass object. Use the AddPair or AddItem methods to add field pairs to the List
property. For each field pair, the List property includes a "Left" field and a "Right" field.
The "Left" and "Right" designations are reflected in other method names (for example, field
assignments methods--AssignLeftToRight and AssignRightToLeft) so you can easily and
accurately control the movement of data between the two sets of fields.
The Init method creates an empty List, and the Kill method disposes of the List. AddPair and
AddItem add field pairs to the List.
FieldPairsClass Methods
FieldPairsClass Functional Organization--Expected Use
As an aid to understanding the FieldPairsClass, it is useful to organize its various 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 FieldPairsClass 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:
AssignLeftToRight assign each "left" field to its "right" counterpart
AssignRightToLeft assign each "right" field to its "left" counterpart
Equal return 1 if all pairs are equal, 0 if any pair is not equal
Occasional Use:
ClearLeft CLEAR each "left" field
ClearRight CLEAR each "right" field
EqualLeftRight return 1 if all pairs are equal, 0 if any pair is not equal
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.
AddItem Adds a field pair to the List property from one source field.
left The address of the "left" field of the pair. The field may be any data type, but may
not be an array.
The AddItem method adds a field pair to the List property from one source field. The "right" field
is supplied for you, and initially contains a copy of the data in the "left" field.
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 FieldPairs object. The other FieldPairs methods then operate on this virtual structure.
Implementation: AddItem assumes the List property has already been created by Init or by some
other method.
By calling AddItem for a series of fields, you effectively build two virtual structures containing the
fields--the "Left" is the original fields and the "Right" contains a copy of the data in the original
fields at the time you call AddItem.
Example:
INCLUDE('ABUTIL.INC') !declare FieldPairs Class
DKeyPair FieldPairsClass !declare FieldPairs reference
Org FILE !declare a file
DptKey KEY(Dept,Grade) !declare a multicomponent key
RECORD
Dept SHORT
Mgr SHORT
Grade SHORT
END
END
CODE
DKeyPair.Init !initialize FieldPairs object
DKeyPair.AddItem(Org:Dept) !add Dept (left) and a copy of Dept (right)
DKeyPair.AddItem(Org:Grade !add Grade (left) and a copy of Grade (right)
!some code
DKeyPair.AssignLeftToRight !Save the current key fields' values
SET(Org:DptKey,Org:DptKey) !position the file
NEXT(Org) !retrieve (hopefully) a specific record
IF ERRORCODE() OR | !confirm retrieval of matching record by
~DKeyPair.Equal() !comparing retrieved key values with saved values
MESSAGE('Record not found!')
END
Implementation: AddPair assumes the List 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
structure and a QUEUE structure), you effectively build two virtual structures containing the fields
and a (one-to-one) relationship between the two structures.
Example:
INCLUDE('ABUTIL.INC') !declare FieldPairs Class
Fields FieldPairsClass !declare FieldPairs object
Customer FILE,DRIVER('TOPSPEED'),PRE(CUST)
ByNumber KEY(CUST:CustNo),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CustNo LONG
Name STRING(30)
Phone STRING(20)
ZIP DECIMAL(5)
END
END
CustQ QUEUE
CustNo LONG
Name STRING(30)
Phone STRING(20)
ZIP DECIMAL(5)
END
542 ABC Library Reference
CODE
Fields.Init !initialize FieldPairs 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
AssignLeftToRight
The AssignLeftToRight method copies the contents of each "left" field to its corresponding
"right" field in the List property.
Implementation: For AddPair pairs, the "left" field is the first (left) parameter of the AddPair
method; the "right" field is the second (right) parameter of the AddPair method.
For AddItem pairs, the "left" field is the only parameter of the AddItem method.
The "right" field is the FieldPairs supplied copy of the "left" 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.Equal !compare field pairs
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignLeftToRight !restore original to CustQ (display) buffer
END
END
AssignRightToLeft
The AssignRightToLeft method copies the contents of each "right" field to its corresponding
"left" field in the List property.
Implementation: For AddPair pairs, the "left" field is the first (left) parameter of the AddPair
method; the "right" field is the second (right) parameter of the AddPair method.
For AddItem pairs, the "left" field is the only parameter of the AddItem method.
The "right" field is the FieldPairs supplied copy of the "left" 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.Equal !compare field pairs
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignLeftToRight !restore original to CustQ (display) buffer
END
END
ClearLeft
The ClearLeft method clears the contents of each "left" field in the List property.
Implementation: For AddPair pairs, the "left" field is the field whose label is the first (left)
parameter of the AddPair method; the "right" field is the field whose label is the
second (right) parameter of the AddPair method. For AddItem pairs, the "left"
field is the field whose label is the only parameter of the AddItem method. The
"right" field is the FieldPairs supplied copy of the "left" field.
The ClearLeft method CLEARs the field. See the Language Reference for more
information on CLEAR.
Example:
Fields &= NEW FieldPairsClass !instantiate FieldPairs object
Fields.Init !initialize FieldPairs 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
!some code
IF LocalRequest = InsertRecord
Fields.ClearRight !clear the CustQ fields to blank or zero
END
AddItem
546 ABC Library Reference
ClearRight
The ClearRight method clears the contents of each "right" field in the List property.
Implementation: For AddPair pairs, the "left" field is the field whose label is the first (left)
parameter of the AddPair method; the "right" field is the field whose label is the
second (right) parameter of the AddPair method. For AddItem pairs, the "left"
field is the field whose label is the only parameter of the AddItem method. The
"right" field is the FieldPairs supplied copy of the "left" field.
The ClearRight method CLEARs the field. See the Language Reference for
more information on CLEAR.
Example:
Fields &= NEW FieldPairsClass !instantiate FieldPairs object
Fields.Init !initialize FieldPairs 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
!some code
IF LocalRequest = InsertRecord
Fields.ClearRight !clear the CustQ fields to blank or zero
END
Equal
The Equal method returns one (1) if all pairs are equal and returns zero (0) if any pairs are not
equal.
Implementation: The Equal method simply calls the EqualLeftRight method which does all the
comparison work. Therefore, there are two different methods (Equal and
EqualLeftRight) that produce exactly the same result.
This provides an alternative calling convention for the FieldPairsClass and the
BufferedPairsClass. The EqualLeftRight method name is consistent with the
other comparison methods in the BufferedPairsClass and is provided for that
purpose. See BufferedPairsClass Methods for more information.
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.Equal !compare field pairs
CASE MESSAGE('Abandon Changes?',,,BUTTON:Yes+BUTTON:No)
OF BUTTON:No
Fields.AssignRightToLeft !copy changes to CUST (write) buffer
OF BUTTON:Yes
Fields.AssignLeftToRight !restore original to CustQ (display) buffer
END
END
EqualLeftRight
The EqualLeftRight method returns one (1) if all pairs are equal and returns zero (0) if any pairs
are not equal.
Implementation: The Equal method simply calls the EqualLeftRight method which does all the
comparison work. Therefore, there are two different methods (Equal and
EqualLeftRight) that produce exactly the same result.
This provides an alternative calling convention for the FieldPairsClass and the
BufferedPairsClass. The EqualLeftRight method name is consistent and
compatible with the other comparison methods in the BufferedPairsClass and is
provided for that purpose. See BufferedPairsClass Methods for more information.
Init
The Init method initializes the FieldPairsClass object.
Example:
INCLUDE('ABUTIL.INC') !declare FieldPairs Class
Fields &FieldPairsClass !declare FieldPairs reference
CODE
Fields &= NEW FieldPairsClass !instantiate FieldPairs object
Fields.Init !initialize FieldPairs object
.
.
.
Fields.Kill !terminate FieldPairs object
DISPOSE(Fields) !release memory allocated for FieldPairs 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 property created by the Init method.
Example:
INCLUDE('ABUTIL.INC') !declare FieldPairs Class
Fields &FieldPairsClass !declare FieldPairs reference
CODE
Fields &= NEW FieldPairsClass !instantiate FieldPairs object
Fields.Init !initialize FieldPairs object
.
.
.
Fields.Kill !terminate FieldPairs object
DISPOSE(Fields) !release memory allocated for FieldPairs object
FileDropComboClass
Overview:FileDropComboClass
The FileDropComboClass is a FileDropClass based on a COMBO control rather than a LIST
control. Therefore it supports not only the selection of existing list items but also the selection of
values not in the list, and optionally the addition of new values to the list. See Control Templates--
FileDropCombo for information on the template implementation of the FileDropCombo control.
FileDropComboClass Concepts
Based on the end user selection, you can assign one or more values from the selected item to
one or more target fields. You may display one field (e.g., a description field) but assign another
field (e.g., a code field) from the selected list item.
The FileDropClass also supports filters, range limits, colors, icons, sorting, and multiple item
selection (marking). See Control Templates--FileDropCombo for information on the template
implementation of these features.
The FileDropComboClass is closely integrated with the WindowManager. These objects register
their presence with each other, set each other's properties, and call each other's methods as
needed to accomplish their respective tasks.
The FileDropComboClass is derived from the FileDropClass, plus it relies on several of the other
Application Builder Classes to accomplish its tasks. Therefore, if your program instantiates the
FileDropClass, it must also instantiate these other classes. Much of this is automatic when you
INCLUDE the FileDropClass header (ABDROPS.INC) in your program's data section. See the
Conceptual Example.
552 ABC Library Reference
The ABC Templates automatically include all the classes and generate all the code necessary to
support the functionality specified in your application's FileDropCombo control templates.
The templates derive a class from the FileDropComboClass and instantiate an object for each
FileDropComboControl template in the application. The derived class and obect is called FDCB#
where # is the FileDropCombo Control template instance number. The templates provide the
derived class so you can use the FileDropComboControl template Classes tab to modify the
FileDropCombo's behavior on an instance-by-instance basis.
The FileDropComboClass source code is installed by default to the Clarion \LIBSRC folder. The
FileDropComboClass 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 FileDropComboClass object and related objects.
This example uses the FileDropComboClass object to let the end user select or enter a valid
state code for a given client. The state code comes from the state file.
PROGRAM
INCLUDE('ABWINDOW.INC')
INCLUDE('ABDROPS.INC')
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
FileDropComboClass 553
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
GlobalErrors ErrorClass
VCRRequest LONG(0),THREAD
Access:State CLASS(FileManager)
Init PROCEDURE
END
Relate:State CLASS(RelationManager)
Init PROCEDURE
END
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
END
StateQ QUEUE
ST:STATECODE LIKE(ST:STATECODE)
ViewPosition STRING(512)
END
StateView VIEW(State)
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
StateDrop CLASS(FileDropClass)
Q &StateQ
END
CODE
ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
GlobalErrors.Init
Relate:State.Init
Relate:Customer.Init
SELF.Request = InsertRecord
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CUS:NAME
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddUpdateFile(Access:Customer)
SELF.AddItem(?Cancel,RequestCancelled)
SELF.OkControl = ?OK
Relate:Customer.Open
Relate:State.Open
SELF.Primary &= Relate:Customer
SELF.InsertAction = Insert:Batch
IF SELF.PrimeUpdate() THEN RETURN Level:Notify.
OPEN(CusWindow)
SELF.Opened=True
!initialize the FileDropCombo Class with:
! the combo's USE variable, COMBO control, view POSITION, VIEW, combo's FROM QUEUE,
! primary file RelationManager object, WindowManager object, ErrorClass object,
! add records flag, hot fields flag, case sensitive flag
StateDrop.Init(?CUS:State,StateQ.ViewPosition,|
StateView,StateQ,Relate:State,ThisWindow,GlobalErrors,1,0,0)
StateDrop.Q &= StateQ
StateDrop.AddSortOrder()
StateDrop.AddField(ST:STATECODE,StateDrop.Q.ST:STATECODE)
StateDrop.AddUpdateField(ST:STATECODE,CUS:State)
ThisWindow.AddItem(StateDrop)
SELF.SetAlerts()
RETURN ReturnValue
FileDropComboClass 555
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
Relate:State.Close
Relate:State.Kill
Relate:Customer.Kill
GlobalErrors.Kill
RETURN ReturnValue
Access:State.Init PROCEDURE
CODE
PARENT.Init(State,GlobalErrors)
SELF.FileNameValue = 'State'
SELF.Buffer &= ST:Record
SELF.LazyOpen = False
SELF.AddKey(ST:StateCodeKey,'ST:StateCodeKey',0)
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = True
SELF.LazyOpen = False
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)
Relate:State.Init PROCEDURE
CODE
Access:State.Init
PARENT.Init(Access:State,1)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
556 ABC Library Reference
FileDropComboClass Properties
FileDropComboClass Properties
The FileDropComboClass inherits all the properties of the FileDropClass from which it is derived.
See FileDropClass Properties and ViewManager Properties for more information.
AskProcedure USHORT
The AskProcedure property is used to determine which Update Procedure to call if the
FileDropCombo control allows updates.
Implementation: The FileDropCombo control template allows the filedrop queue to be updated if
the entry does not exist in the queue. This property identifies the procedure to
call to update the queue. The template generates the code that initiates the value
of this property.
EntryCompletion BYTE
The EntryCompletion property indicates whether FileDropComboClass tries to automatically
complete the end user selection. A value of one (1) or True enables the automatic completion; a
value of zero (0) or False disables automatic completion.
When EntryCompletion is enabled, the FileDropComboClass object displays the list item that is
nearest the value entered by the end user. The FileDropComboClass object reevaluates the
display immediately after each end user keystroke.
Implementation: The Init method sets the EntryCompletion property to True. The TakeEvent and
TakeNewSelection methods implement the behavior specified by
EntryCompletion.
RemoveDuplicatesFlag BYTE
The RemoveDuplicatesFlag property is a flag used to determine if duplicates are not allowed in
the filedrop queue. A value of one (1 or True) does not allow duplicates in the filedrop queue; a
value of zero (0 or False) allows duplicates into the filedrop queue.
FileDropComboClass Methods
FileDropComboClass Methods
The FileDropComboClass inherits all the methods of the FileDropClass from which it is derived.
See FileDropClass Methods and 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:
Mainstream Use:
ResetQueue refresh filedrop queue
GetQueueMatch locate a list item
AskV add a record to the lookup file
TakeEventV process the current ACCEPT loop event
TakeNewSelectionV process the EVENT:Selected events
Occasional Use:
OpenII open the filedrop view
PrimeRecordII prepare an item for adding
SetFilterII specify a filter for the active sort order
ApplyFilterII range limit and filter the result set
ApplyOrderII sort the result set
GetFreeElementNameII return the free element field name
SetOrderII replace the active sort order
CloseII close the filedrop view
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 TakeEvent method calls the Ask method. Return value EQUATEs are
declared in ABERROR.INC (see Error Class for more information):
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:
MyFileDropComboClass.TakeEvent PROCEDURE
UserStr CSTRING(256),AUTO
CODE
!procedure code
IF SELF.Ask() = Level:Benign !update lookup file
SELF.UpdateFields.AssignLeftToRight
SELF.Close
SELF.ResetQueue
SELF.ListField{PROP:Selected} = SELF.GetQueueMatch(UserStr)
DISPLAY(SELF.ListField)
END
!procedure code
SeeAlso:
TakeEvent
562 ABC Library Reference
GetQueueMatch Locates the search value within the first field of the display queue.
search value A string constant, variable, EQUATE, or expression containing the value to
locate.
The GetQueueMatch method locates a value within the first field of the display queue and
returns the position of the matching item. A return value of zero (0) indicates no matching items.
The Init method case parameter determines the type of search (case sensitive or insensitive)
performed.
Example:
MyFileDropComboClass.TakeEvent PROCEDURE
UserStr CSTRING(256),AUTO
CODE
CASE EVENT()
OF EVENT:Accepted
UserStr=CLIP(SELF.UseField)
IF SELF.GetQueueMatch(UserStr) = 0 !if entered value not in
SELF.Reset ! lookup file / queue
IF SELF.Ask()=Level:Benign !update the lookup file
SELF.UpdateFields.AssignLeftToRight
SELF.Close
SELF.ResetQueue
SELF.ListField{PROP:Selected}=SELF.GetQueueMatch(UserStr)!position to new item
DISPLAY(SELF.ListField)
END
!procedure code
Init( use, combo, position, view, queue, relationmgr, windowmgr, errormgr [,add] [,sync] [,case] )
Implementation: Among other things, the Init method calls the PARENT.Init (FileDropClass.Init)
method. See FileDropClass for more information.
564 ABC Library Reference
Example:
ThisWindow.Init PROCEDURE
CODE
!procedure code !init filedropcombo object
FDBC4.Init( CLI:StateCode, | ! USE variable
?CLI:StateCode, | ! COMBO control
Queue:FileDropCombo.ViewPosition, | ! VIEW POSITION variable
FDCB4::View:FileDropCombo, | ! VIEW
Queue:FileDropCombo, | ! QUEUE
Relate:States, | ! RelationManager object
ThisWindow, | ! WindowManager object
GlobalErrors, | ! ErrorClass object
1, | ! allow adds
0, | ! refresh hot fields on new selection
0) ! case insensitive searches
FDBC4.Q &= Queue:FileDropCombo
FDBC4.AddSortOrder()
FDBC4.AddField(ST:StateCode,FDBC4.Q.ST:StateCode)
FDBC4.AddField(ST:State,FDBC4.Q.ST:State)
FDBC4.AddUpdateField(ST:StateCode,CLI:StateCode)
KeyValid, VIRTUAL
The KeyValid method determines if a valid keystroke is in the keyboard buffer. If LeftKey (cursor
left), RightKey (cursor right), ShiftLeft (Shift-cursor left), ShiftRight (Shift-cursor right) are in the
buffer a False value is returned from this method. A True value is returned if any other keystroke
is pressed.
ReturnDataType: BYTE
See Also:
FileDropComboClass.TakeNewSelection
Implementation: Among other things, the Kill method calls the PARENT.Kill (FileDropClass.Kill)
method to shut down the FileDropClass object.
ResetQueue Refills the filedrop queue and the COMBO's USE variable.
force A numeric constant, variable, EQUATE, or expression that indicates whether to
refill the queue even if the sort order did not change. A value of one (1 or True)
unconditionally refills the queue; a value of zero (0 or False) only refills the queue
if circumstances require it. If omitted, force defaults to zero.
The ResetQueue method refills the filedrop's display queue and the COMBO's USE variable,
applying the applicable sort order, range limits, and filters, then returns a value indicating which
item, if any, in the displayed lookup file already matches the target fields' values specified by the
AddUpdateField method. A return value of zero (0) indicates no matching items; any other value
indicates the position of the matching item.
For example, if the filedrop "looks up" the state code for a customer, and the current customer's
state code field already contains a valid value, then the ResetQueue method positions the
filedrop list to the current customer's state code value.
Implementation: The TakeEvent method calls the ResetQueue method. The ResetQueue calls the
PARENT.ResetQueue method, then enables or disables the drop button
depending on the presence or absence of pick list items.
Example:
MyFileDropComboClass.TakeEvent PROCEDURE
UserStr CSTRING(256),AUTO
CODE
CASE EVENT()
OF EVENT:Accepted
UserStr=CLIP(SELF.UseField)
IF SELF.GetQueueMatch(UserStr) = 0 !if entered value not in
SELF.Reset ! lookup file / queue
IF SELF.Ask()=Level:Benign !update the lookup file
SELF.UpdateFields.AssignLeftToRight
SELF.Close
SELF.ResetQueue(1) !refill the updated queue
SELF.ListField{PROP:Selected}=SELF.GetQueueMatch(UserStr)!position to new item
DISPLAY(SELF.ListField)
END
!procedure code
TakeAccepted, VIRTUAL
The TakeAccepted method processes the accepted event of the entry portion of the
FileDropCombo control.
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the FileDropComboClass
object.
On EVENT:Accepted for the entry portion of the COMBO, the TakeEvent method
calls the GetQueueMatch method to locate the list item nearest to the entered
value. If the entered value is not in the lookup file, the TakeEvent method calls
the Ask method to add the new value to the lookup file. If the add is successful,
TakeEvent calls the ResetQueue method to refill the display queue.
Example:
MyWindowManager.TakeEvent PROCEDURE
Rval BYTE(Level:Benign)
I USHORT,AUTO
CODE
!procedure code
LOOP I = 1 TO RECORDS(SELF.Browses)
GET(SELF.Browses,I)
SELF.Browses.Browse.TakeEvent
END
LOOP i=1 TO RECORDS(SELF.FileDrops)
GET(SELF.FileDrops,i)
ASSERT(~ERRORCODE())
SELF.FileDrops.FileDrop.TakeEvent
END
RETURN RVal
Implementation: The ResetQueue method and the TakeEvent method call the TakeNewSelection
method. If the FileDropComboClass object's LIST generated the new selection
event, then the TakeNewSelection method does the field assignments specified
by the AddUpdateField method or clears the target fields if there is no valid
selection.
Example:
FileDropComboClass.TakeEvent PROCEDURE
CODE
CASE EVENT()
OF EVENT:NewSelection
SELF.TakeNewSelection(FIELD())
SELF.WindowManager.Reset
END
UniquePosition, Protected
The UniquePosition method checks the FileDropComboClass's queue for a duplciate record by
checking for duplicate key values. A return value of zero (0 or False) means there was a
matching value already in the queue. Any other return value indicates no match was found.
FileDropClass
FileDropClass Overview
Future FileDropClasses
FileDropClass Concepts
Based on the end user selection, you can assign one or more values from the selected item to
one or more target fields. You may display one field (e.g., a description field) but assign another
field (e.g., a code field) from the selected list item.
The FileDropClass also supports filters, range limits, colors, icons, sorting, and multiple item
selection (marking). See Control Templates--FileDrop for information on the template
implementation of these features.
The FileDropClasss is closely integrated with the WindowManager. These objects register their
presence with each other, set each other's properties, and call each other's methods as needed
to accomplish their respective tasks.
The FileDropComboClass is derived from the FileDropClass, and the FileDropClass is derived
from the ViewManager. The FileDropClass relies on several of the other Application Builder
Classes to accomplish its tasks. Therefore, if your program instantiates the FileDropClass, it must
also instantiate these other classes. Much of this is automatic when you INCLUDE the
FileDropClass header (ABDROPS.INC) in your program's data section. See the Conceptual
Example.
572 ABC Library Reference
The ABC Templates automatically include all the classes and generate all the code necessary to
support the functionality specified in your application's FileDrop control templates.
The templates derive a class from the FileDropClass and instantiate an object for each
FileDropControl template in the application. The derived class and object is called FDB# where #
is the FileDrop Control template instance number. The templates provide the derived class so you
can use the FileDropControl template Classes tab to modify the FileDrop's behavior on an
instance-by-instance basis.
The derived FileDropClass is local to the procedure, is specific to a single FileDropCombo and
relies on the global file-specific RelationManager and FileManager objects for the displayed
lookup file.
The FileDropClass source code is installed by default to the Clarion \LIBSRC folder. The
FileDropClass 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 FileDropClass object and related objects.
This example uses the FileDropClass object to let the end user select a valid state code for a
given client. The state code comes from the State file. When they are initialized properly, the
FileDropClass and WindowManager objects do most of the work (event handling and field
assignments) internally.
PROGRAM
INCLUDE('ABWINDOW.INC')
INCLUDE('ABDROPS.INC')
MAP
END
State FILE,DRIVER('TOPSPEED'),PRE(ST),THREAD
StateCodeKey KEY(ST:STATECODE),NOCASE,OPT
Record RECORD,PRE()
StateCode STRING(2)
FileDropClass 573
StateName STRING(20)
END
END
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
GlobalErrors ErrorClass
VCRRequest LONG(0),THREAD
Access:State CLASS(FileManager)
Init PROCEDURE
END
Relate:State CLASS(RelationManager)
Init PROCEDURE
END
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
END
StateQ QUEUE
ST:STATECODE LIKE(ST:STATECODE)
ViewPosition STRING(512)
END
StateView VIEW(State)
END
CusWindow WINDOW('Add Customer'),AT(,,157,58),IMM,SYSTEM,GRAY
PROMPT('Customer:'),AT(5,7),USE(?NamePrompt)
ENTRY(@s20),AT(61,5,88,11),USE(CUS:NAME)
PROMPT('State:'),AT(5,22),USE(?StatePrompt)
LIST,AT(61,20,65,11),USE(CUS:State),FROM(StateQ),|
FORMAT('8L~STATECODE~@s2@'),DROP(5)
BUTTON('OK'),AT(60,39),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(104,39),USE(?Cancel)
END
ThisWindow CLASS(WindowManager)
574 ABC Library Reference
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
StateDrop CLASS(FileDropClass)
Q &StateQ
END
CODE
ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
GlobalErrors.Init
Relate:State.Init
Relate:Customer.Init
SELF.Request = InsertRecord
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CUS:NAME
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddUpdateFile(Access:Customer)
SELF.AddItem(?Cancel,RequestCancelled)
SELF.OkControl = ?OK
Relate:Customer.Open
Relate:State.Open
SELF.Primary &= Relate:Customer
SELF.InsertAction = Insert:Batch
IF SELF.PrimeUpdate() THEN RETURN Level:Notify.
OPEN(CusWindow)
SELF.Opened=True
!initialize the FileDrop Class with:
! the LISTS's USE variable, LIST control, view POSITION, VIEW, LISTS's FROM QUEUE,
! primary file RelationManager object, WindowManager object
StateDrop.Init(?CUS:State,StateQ.ViewPosition,StateView,StateQ,Relate:State,ThisWindow)
StateDrop.Q &= StateQ
StateDrop.AddSortOrder()
StateDrop.AddField(ST:STATECODE,StateDrop.Q.ST:STATECODE)
StateDrop.AddUpdateField(ST:STATECODE,CUS:State)
ThisWindow.AddItem(StateDrop)
SELF.SetAlerts()
RETURN ReturnValue
FileDropClass 575
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
Relate:State.Close
Relate:State.Kill
Relate:Customer.Kill
GlobalErrors.Kill
RETURN ReturnValue
Access:State.Init PROCEDURE
CODE
PARENT.Init(State,GlobalErrors)
SELF.FileNameValue = 'State'
SELF.Buffer &= ST:Record
SELF.LazyOpen = False
SELF.AddKey(ST:StateCodeKey,'ST:StateCodeKey',0)
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = True
SELF.LazyOpen = False
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)
Relate:State.Init PROCEDURE
CODE
Access:State.Init
PARENT.Init(Access:State,1)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
576 ABC Library Reference
FileDropClass Properties
FileDropClass Properties
The FileDropClass 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 FileDropClass contains the properties listed below.
AllowReset BYTE
The AllowReset property indicates that a reset of the object's data can occur.
Implementation: The Init method sets the DefaultFill property to one (1). The ResetQueue method
implements the behavior specified by DefaultFill.
Implementation: The Init method sets the InitSyncPair property to one (1). The ResetQueue
method implements the behavior specified by the InitSyncPair property.
FileDropClass Methods
FileDropClass Methods
The FileDropClass 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:
Mainstream Use:
ResetQueue fill or refill filedrop queue
TakeEventV process the current ACCEPT loop event
TakeNewSelectionV processes EVENT:Selected events
Occasional Use:
OpenI open the filedrop view
PrimeRecordI prepare an item for adding
SetFilterI specify a filter for the active sort order
ApplyFilterI range limit and filter the result set
ApplyOrder sort the result set
GetFreeElementNameI return the free element field name
SetOrderI replace the active sort order
CloseI close the filedrop view
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.
AddField Identifies the corresponding FILE and QUEUE fields for a filedrop list column.
filefield The fully qualified label of the FILE field. The filefield is the original source of the
filedrop 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 filedrop LIST's data.
The AddField method identifies the corresponding FILE and QUEUE fields for a filedrop list
column. You must call AddField for each column displayed in the filedrop list.
You may also use the AddField method to display memory variables by specifying a variable label
as the filefield parameter.
Implementation: The AddField method uses the FieldPairsClass to manage the specified field
pairs.
Example:
CODE
StFD.Init(?CLI:StCode,StateQ.Pos,StateView,StateQ,Relate:States,ThisWindow)
StFD.Q &= StateQ
StFD.AddSortOrder(StCodeKey)
StFD.AddField(STFile:StCode,StFD.Q.StCode)
StFD.AddField(STFile:StName,StFD.Q.StName)
StFD.AddUpdateField(STFile:StCode,CLI:StCode)
580 ABC Library Reference
Implemenation: The ResetQueue method calls the AddRecord method to build the queue.
See Also: ResetQueue
AddUpdateField Identifies a source field and its corresponding target or destination field.
source The fully qualified label of the field to copy from when the end user selects a
filedrop list item.
target The fully qualified label of the field to copy to when the end user selects a filedrop
list item.
The AddUpdateField method identifies a source field and its corresponding target or destination
field that receives the source field's contents when the end user selects a filedrop list item.
You may call the AddUpdateField multiple times to accomplish multiple field assignments on end
user selection.
Implementation: The AddUpdateField method uses the FieldPairsClass to manage the specified
field pairs.
Example:
CODE
StFD.Init(?CLI:StCode,StateQ.Pos,StateView,StateQ,Relate:States,ThisWindow)
StFD.Q &= StateQ
StFD.AddSortOrder(StCodeKey)
StFD.AddField(STFile:StCode,StFD.Q.StCode)
StFD.AddField(STFile:StName,StFD.Q.StName)
StFD.AddUpdateField(STFile:StCode,CLI:StCode)
Implementation: Among other things, the Init method calls the PARENT.Init (ViewManager.Init)
method to initialize the view related parts of the FileDropClass object. See View
Manager for more information.
Example:
CODE
StFD.Init(?CLI:StCode,StateQ.Pos,StateView,StateQ,Relate:States,ThisWindow)
StFD.Q &= StateQ
StFD.AddSortOrder(StCodeKey)
StFD.AddField(STFile:StCode,StFD.Q.StCode)
StFD.AddField(STFile:StName,StFD.Q.StName)
StFD.AddUpdateField(STFile:StCode,CLI:StCode)
Kill, VIRTUAL
The Kill method releases any memory allocated during the life of the FileDropClass object and
performs any other required termination code.
Implementation: Among other things, the Kill method calls the PARENT.Kill (ViewManager.Kill)
method to shut down the initialize the view related parts of the FileDropClass
object. See View Manager for more information.
Example:
CODE
StFD.Init(?CLI:StCode,StateQ.Pos,StateView,StateQ,Relate:States,ThisWindow)
StFD.Q &= StateQ
StFD.AddSortOrder(StCodeKey)
StFD.AddField(STFile:StCode,StFD.Q.StCode)
StFD.AddField(STFile:StName,StFD.Q.StName)
StFD.AddUpdateField(STFile:StCode,CLI:StCode)
!procedure code
StFD.Kill
For example, if the filedrop "looks up" the state code for a customer, and the current customer's
state code field already contains a valid value, then the ResetQueue method conditionally (based
on the InitSyncPair property) positions the filedrop list to the current customer's state code value.
Example:
ACCEPT
IF EVENT() = EVENT:OpenWindow
StateFileDrop.ResetQueue
END
!program code
END
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 filedrop list's queue buffer fields so that the queue buffer matches the file buffers.
Example:
MyFileDropClass.SetQueueRecord PROCEDURE
CODE
SELF.ViewPosition=POSITION(SELF.View)
SELF.DisplayFields.AssignLeftToRight
!Custom code here
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the FileDropClass object.
Example:
MyWindowManager.TakeEvent PROCEDURE
Rval BYTE(Level:Benign)
I USHORT,AUTO
CODE
!procedure code
LOOP I = 1 TO RECORDS(SELF.Browses)
GET(SELF.Browses,I)
SELF.Browses.Browse.TakeEvent
END
LOOP i=1 TO RECORDS(SELF.FileDrops)
GET(SELF.FileDrops,i)
ASSERT(~ERRORCODE())
SELF.FileDrops.FileDrop.TakeEvent
END
RETURN RVal
Implementation: The ResetQueue method and the TakeEvent method call the TakeNewSelection
method. If the FileDropClass object's LIST generated the new selection event,
then the TakeNewSelection method does the field assignments specified by the
AddUpdateField method or clears the target fields if there is no valid selection.
Example:
FileDropClass.TakeEvent PROCEDURE
CODE
CASE EVENT()
OF EVENT:NewSelection
SELF.TakeNewSelection(FIELD())
END
ValidateRecord, VIRTUAL
The ValidateRecord method is a virtual called when the FileDropClass object fills its display
QUEUE. ValidateRecord returns a value indicating whether to include the current record in the
displayed list. Thus ValidateRecord provides a filtering mechanism in addition to the
ViewManager.SetFilter method. Valid return values include:
Implementation: The ResetQueue method calls the ValidateRecord method. The ValidateRecord
method calls the PARENT.ValidateRecord method
(ViewManager.ValidateRecord).
Example:
MyFileDropClass.ResetQueue PROCEDURE
i LONG
CODE
SETCURSOR(CURSOR:Wait)
FREE(SELF.ListQueue)
SELF.ApplyRange
SELF.Reset
LOOP UNTIL SELF.Next()
IF SELF.ValidateRecord()=Record:OK !Validate Records
SELF.SetQueueRecord
ADD(SELF.ListQueue)
ASSERT(~ERRORCODE())
IF SELF.UpdateFields.Equal()
i=RECORDS(SELF.ListQueue)
END
END
END
!procedure code
FileManager
FileManager Overview
The FileManager class declares a file manager that consistently and flexibly handles all the
routine database operations for a given file. The file manager provides "setup" methods that let
you describe the file and it's keys, as well as other methods to open, read, write, and close the
file.
The file manager automatically handles autoincrementing keys, and, as implemented by the ABC
Templates, handles some of the validity checks specified in the Clarion data dictionary, and some
of the file handling settings specified in the data dictionary or application generator. However,
even if you don't use the data dictionary, the application generator, or if you don't specify validity
checks in your dictionary, the file manager can still competently and efficiently handle routine
database operations for your files.
Note: The FileManager class handles individual files; it does not handle referential
integrity (RI) between related files. The RelationManager class enforces RI between
related files.
The FileManager methods that do standard database operations come in two versions--the plain
(or interactive) version and the "Try" (or silent) version.
When any of these methods are called (Open, Fetch, Next, Previous, Insert, and Update), they
may take several approaches and several attempts to complete the requested operation--
including issuing error messages where appropriate. They may solicit information from the end
user in order to proceed with the requested task. They may even terminate the application under
sufficient provocation. This means the programmer can rely on the fact that if the method
returned, it worked.
When any of these methods are prepended with "Try" (TryOpen, TryFetch, TryNext, TryPrevious,
TryInsert, and TryUpdate), the method makes a single attempt to complete the requested
operation, then returns a success or failure indicator to the calling procedure for it to handle
accordingly.
590 ABC Library Reference
The FileManager relies on the ErrorClass for most of its error handling. Therefore, if your program
instantiates the FileManager it must also instantiate the ErrorClass. See Error Class for more
information.
Perhaps more significantly, the FileManager serves as the foundation or "errand boy" of the
RelationManager. If your program instantiates the RelationManager it must also instantiate the
FileManager. See Relation Manager Class for more information.
FileManager objects are designed to support multiple execution threads in a way that Clarion
developers will recognize. That is, several MDI procedures may access the same file at the same
time, with each procedure maintaining its own file buffer and file positioning information, so there
is no conflict or confusion between the procedures.
To accomplish this desirable state of independence among several MDI procedures, you only
need to add the THREAD attribute to your file declaration (see the Language Reference for more
information), then instantiate a single global FileManager object for each file. This global object
automatically handles multiple execution threads, so you can use it within each procedure that
accesses the file. The ABC Templates generate exactly this type of code for files with the
THREAD attribute.
When you want to access a file with a single shared buffer from multiple execution threads, you
simply omit the THREAD attribute from the file declaration and, again, instantiate a global file-
specific FileManager object within the program. This lets all your program's procedures access
the file with a single shared record buffer and a single set of positioning information.
There are several important points to note regarding the ABC Template implementation of the
FileManager class.
First, the ABC Templates derive a class from the FileManager class for each file the application
processes. The derived classes are called Hide:Access:filename, but may be referenced as
Access:filename. These derived classes and their methods are declared in the generated
appnaBC0.CLW through appnaBC9.CLW files (depending on how many files your application
uses). The derived class methods are specific to the file being managed, and they implement
many of the file properties specified in the data dictionary such as access modes, keys, field
validation and initialization, etc.
Second, the ABC Templates generate housekeeping procedures to initialize and shut down the
FileManager objects. The procedures are DctInit and DctKill. These are generated into the
appnaBC.CLW file.
FileManager 591
Third, the derived FileManager classes are configurable with the Global Properties dialog. See
Template Overview--File Control Options and Classes Options for more information.
Finally, the ABC Templates also derive a RelationManager for each file. These objects are called
Hide:Relate:filename, but may be referenced as Relate:filename. The template generated code
seldom calls the derived FileManager methods directly. Instead, it calls a RelationManager
method that echoes the command to the appropriate (related files') FileManager methods. See
Relation Manager for more information on the RelationManager class.
The FileManager source code is installed by default to the Clarion \LIBSRC folder. The specific
FileManager 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 FileManager object.
This example uses the FileManager to insert a valid record with an auto-incrementing key.
PROGRAM
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CLI:Name),DUP,NOCASE
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
592 ABC Library Reference
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initial Access:Client object
Access:Client.Open !open the Client file
OPEN(InsertWindow)
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Insert() = Level:Benign !add the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
SELECT(?CLI:Name:Prompt) !select client name field
CYCLE !and start over
END
END
OF ?CLI:StateCode !on StateCode field
IF EVENT() = EVENT:Accepted
IF Access:Client.ValidateField(3) !validate the StateCode (3rd) field
SELECT(?CLI:StateCode) !if invalid, select StateCode field
CYCLE !and start over
END
END
END
END
Access:Client.Close !close the Client file
Access:Client.Kill !shut down the Access:Client object
GlobalErrors.Kill !shut down the GlobalErrors object
RETURN
Access:Client.Init PROCEDURE
CODE
PARENT.Init(Client, GlobalErrors) !call the base class Init method
SELF.FileNameValue = 'Client' !set the file name
FileManager 593
FileManager Properties
The FileManager properties include references to the specific file being managed, as well as
several flags or switches that tell the FileManager how to manage the referenced file.
The references are to the file, the file name, and the file's record buffer. These references allow
the otherwise generic FileManager object to process a specific file.
The processing switches include file access (sharing) mode, a create/nocreate switch, a held
records mode, and a LOCK wait time parameter.
AliasedFile &FileManager
The AliasedFile property is a reference to the actual file's FileManager. A nonnull value for this
property indicates the managed file is an alias of another file. The FileManager uses this property
to synchronize commands, buffers, etc. between the alias file and its actual file.
Tip: This property should be null (uninitialized) for the actual file and initialized for any
aliases.
Implementation: If the managed file is an alias, you should initialize the AliasedFile property after
the Init method is called, or within a derived Init method specific to the managed
file. See the Conceptual Example. The ABC Templates generate code to set this
property for alias files in the appnaBC0.CLW file.
FileManager 595
Implementation: The SaveBuffer method stores a copy of the current Buffer contents into the
Buffers property for subsequent retrieval by the RestoreBuffer method.
You should initialize the Buffer property after the Init method is called, or within a
derived Init method specific to the managed file. See the Conceptual Example.
Implementation: The SaveBuffer method stores a copy of the current Buffer contents into the
Buffers property and returns an ID which may subsequently be used by the
RestoreBuffer method to retrieve the buffer contents.
A value of one (1) creates the file; a value of zero (0) does not create the file.
Implementation: The Init method sets the Create property to a value of one (1), which invokes
automatic file creation. The ABC Templates override this default with the
appropriate setting from the data dictionary or application generator. See
Template Overview--File Handling for more information.
The Open method creates the file when an attempt to open the file fails because
there is no file.
The SetName method sets the contents of the filename variable. The GetName method returns
the filename.
Implementation: You must initialize either the FileName property or the FileNameValue property
(but not both) after the Init method is called, or within a derived Init method
specific to the managed file. See the Conceptual Example.
Example:
Access:Client CLASS(FileManager) !derive Access:Client object
Init PROCEDURE !prototype Access:Client init
END
ClientFileName STRING('Client01.tps')!variable for filename
Implementation: You must initialize either the FileNameValue property or the FileName property
(but not both) after the Init method is called, or within a derived Init method
specific to the managed file. See the Conceptual Example.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
LazyOpen BYTE
The LazyOpen property indicates whether to open the managed file immediately when a related
file is opened, or to delay opening the file until it is actually accessed. A value of one (1 or True)
delays the opening; a value of zero (0 or False) immediately opens the file.
Delaying the open can improve performance when accessing only one of a series of related files.
Implementation: The Init method sets the LazyOpen property to True. The ABC Templates
override this default if instructed. See Template Overview--File Handling for more
information.
The various file access methods (Open, TryOpen, Fetch, TryFetch, Next,
TryNext, Insert, TryInsert, etc.) use the UseFile method to implement the action
specified by the LazyOpen property
See Also: Init, Open, TryOpen, Fetch, TryFetch, Next, TryNext, Insert, TryInsert, UseFile
LockRecover SHORT
The LockRecover property contains the wait time parameter for the
/RECOVER driver string used by the Clarion database driver. See Database Drivers--Clarion for
more information on the /RECOVER driver string.
Implementation: The Init method sets the LockRecover property to a value of ten (10) seconds.
The ABC Templates override this default with the appropriate value from the
application generator. See Template Overview--File Handling for more
information.
The Open method implements the recovery when an attempt to open the file fails
because the file is LOCKed. See the Language Reference for more information
on LOCK.
OpenMode BYTE
The OpenMode property contains a value that determines the level of access granted to both the
user opening the file and other users in a multi-user system.
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. See Template Overview--File
Handling for more information.
The Open method uses the OpenMode property when it OPENs the file for
processing. See the Language Reference for more information on OPEN and
access modes.
SkipHeldRecords BYTE
The SkipHeldRecords property contains a value that tells the file manager how to react when it
encounters held records. See the Language Reference for more information on HOLD.
A value of one (1) skips or omits the held record and continues processing; a value of zero (0)
aborts the current operation.
Implementation: The Init method sets the SkipHeldRecords property to a value of zero (0).
The Next, TryNext, Previous, and TryPrevious methods implement the action
specified by the SkipHeldRecords property when an attempt to read a record fails
because the record is held.
FileManager Methods
Naming Conventions and Dual Approach to Database Operations
As you study the functional organization of the FileManager methods, please keep this in mind:
most of the common database operations (Open, Next, Previous, Fetch, Insert, and Update)
come in two versions. The versions are easily identifiable based on their naming conventions:
When any of these methods are called (Open, Fetch, Next, Previous, Insert, and Update), they
may take several approaches and several attempts to complete the requested operation,
including issuing error messages where appropriate. These methods provide automatic error
handling. They may solicit information from the end user in order to proceed with the requested
task. They may even terminate the application under sufficient provocation. This means the
programmer can rely on the fact that if the method returned, it worked.
When any of these methods prepend "Try" (TryOpen, TryFetch, TryNext, TryPrevious, TryInsert,
and TryUpdate), the method makes a single attempt to complete the requested operation, then
returns a success or failure indicator to the calling procedure for it to handle accordingly. These
methods require manual error handling.
602 ABC Library Reference
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:
OpenV open the file
TryOpen open the file
Next get the next record in sequence
TryNext get the next record in sequence
Previous get the previous record in sequence
TryPrevious get the previous record in sequence
Fetch get a specific record by key value
TryFetch get a specific record by key value
Position return the unique position of the current record
TryReget get a specific record by unique position
PrimeAutoIncV prepare an autoincremented record for adding
Insert add a new record
TryInsert add a new record
CancelAutoIncV restore file to its pre-PrimeAutoInc state
Update change the current record
TryUpdate change the current record
CloseV close the file
Occasional Use:
ClearKey clear a range of key component fields
SetKey make a specific key current for other methods
KeyToOrder return ORDER expression equal to specified key
GetComponents return the number of components of a key
GetField return a reference to a key component
GetFieldName return the field name of a key component
GetEOF return current end of file status
GetError return the current error ID
SetError save the current error state
FileManager 603
Virtual Methods
Typically, with the possible exception of Open and Close, 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 AddField method returns Level:Benign if no error occurs when the field
information is added to the internal tracking queue, otherwise Level:Notify is
returned.
Implementation: The description appears at runtime on certain key related error messages.
Example:
Access:Client.Init PROCEDURE
CODE
PARENT.Init(Client, GlobalErrors) !call the base class Init method
SELF.FileNameValue = 'Client' !set the file name
SELF.Buffer &= CLI:Record !point Access:Client to Client buffer
SELF.AddKey(CLI:IDKey,'Client ID',1) !describe the primary key
SELF.AddKey(CLI:NameKey,'Client Name') !describe another key
BindFields, VIRTUAL
The BindFields method BINDs the fields when the file is opened. See the Language Reference
for more information on BIND.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
CODE
!program code
Implementation: The PrimeAutoInc method adds a "dummy" record when inserting records with
autoincrementing keys. CancelAutoInc deletes this "dummy" record, and, if the
relation manager parameter is present, CancelAutoInc deletes any children of the
"dummy" record as well.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
608 ABC Library Reference
END
END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(82,53,45,14),USE(?Cancel)
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
IF Access:Client.PrimeRecord() !prime Client record (autoinc)
POST(Event:CloseWindow) !if prime fails, close down
END
OPEN(InsertWindow)
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Insert() = Level:Benign!finish adding the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
SELECT(?CLI:Name:Prompt) !select client name field
CYCLE !and start over
END
END
OF ?Cancel
IF EVENT() = EVENT:Accepted !on Cancel button
Access:Client.CancelAutoInc !restore Client to pre-PrimeRecord
POST(Event:CloseWindow) !close down
END
EMD
END
FileManager 609
Implementation: ClearKey is useful for range limiting to the first instance of the first "free" key
component. By retaining higher order key component values and clearing lower
order key component values, you can fetch the first (or last) record that matches
the retained higher order component values; for example, the first order (lower
order key component) for a customer (higher order key component).
The value ClearKey assigns depends on three things: the data type of the component field
(numeric or string), the sort direction of the component (ascending or descending), and the value
of the highvalue parameter (True or False). The following table shows the values ClearKey
assigns for each combination of data type, sort direction, and highvalue.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Order CLASS(FileManager) !derive Access:Order object
END
FileManager 611
Order FILE,DRIVER('TOPSPEED'),PRE(ORD),CREATE,BINDABLE,THREAD
IDKey KEY(Ord:Cust,Ord:ID,Ord:Date),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
Cust LONG
ID LONG
Date LONG
END
END
CODE
!program code
!find first order for current customer by clearing all components except Ord:Cust
Access:Order.ClearKey( ORD:IDKey, 2 ) !clear Ord:ID and Ord:Date
Access:Order.Fetch !get the next record by key
612 ABC Library Reference
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
!file declaration
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
!program code
Deleted,VIRTUAL
The Deleted method returns Level:Benign (declared in ABERROR.INC) if the current record is
active, i.e., if the record has not been identified in some way as deleted. In cases where the
DeleteRecord method has been derived to say, flag deleted records rather than physically delete
them, deriving a corresponding Deleted method allows these records to be identified.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP . !program map
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) . !derive Access:Client object
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
END
CODE
!program code
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Deleted() = Level:Benign !if the record is not already deleted
IF Access;Client.DeleteRecord = Level:Benign !delete it
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
Access:Client.CancelPrimeAutoInc !restore the file
CYCLE !and start over
END
END
END
!more code
The standard DeleteRecord method physically deletes the record and always returns
Level:Benign.
Return Data Type: BYTE
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
END
CODE
!program code
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.DeleteRedord() = Level:Benign !delete the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
FileManager 615
Destruct, VIRTUAL
The Destruct method is an automatic destructor that is called when the object is removed from
memory. This ensures that all data allocated by the object is removed from memory.
616 ABC Library Reference
EqualBuffer Compares the managed file's record buffer with the specified buffer and returns a
value indicating whether the buffers are equal.
buffer id An integer constant, variable, EQUATE, or expression that identifies the buffer
contents to compare--typically a value returned by the SaveBuffer method.
The EqualBuffer method compares the managed file's record buffer, including any MEMOs or
BLOBs, with the specified buffer and returns a value indicating whether the buffers are equal. A
return value of one (1 or True) indicates the buffers are equal; a return value of zero (0 or False)
indicates the buffers are not equal. Assigning PROP:Handle on a BLOB field constitutes a
change to the BLOB and will cause EqualBuffer() to return False.
Example:
MyWindowManager.TakeCloseEvent PROCEDURE
CODE
IF SELF.Response = RequestCancelled !if end user cancelled the form
IF ~SELF.Primary.Me.EqualBuffer(SELF.Saved) !check for any pending changes
!handle cancel of pending changes
END
END
Fetch Gets a specific record by its key value and handles any errors.
key The label of the primed KEY.
The Fetch method gets a specific record by its key value and handles any errors. You must prime
the key before calling Fetch. If the key is not unique, Fetch gets the first record with the specified
key value.
The TryFetch method provides a slightly different (manual) alternative for fetching specific
records.
Implementation: Fetch tries to get the specified record. If it succeeds, it returns Level:Benign
(declared in ABERROR.INC). If it fails, it returns Level:Notify (also declared in
ABERROR.INC) and clears the record buffer. See Error Class for more
information on severity levels.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:States CLASS(FileManager) !declare Access:States object
END
States FILE,DRIVER('TOPSPEED'),PRE(ST),CREATE,BINDABLE,THREAD
StateCodeKey KEY(ST:StateCode),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
StateCode STRING(2)
State STRING(20)
END
END
CODE
!program code
!get the state record for Florida
ST:StateCode = 'FL' !prime the state key for the fetch
Access:States.Fetch(ST:StateCodeKey)!fetch the record and handle any errors
GetComponents( key )
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors objec
Access:Order CLASS(FileManager) !derive Access:Order object
END
I BYTE
Order FILE,DRIVER('TOPSPEED'),PRE(ORD),THREAD !declare order file
IDKey KEY(Ord:Cust,Ord:ID,Ord:Date),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
Cust LONG
ID LONG
Date LONG
END
END
KeyQueue QUEUE,PRE(KeyQ) !a list of key components
Field ANY !component field reference
FieldName STRING(12) !component field name
END
CODE
!program code
LOOP Access:Order.GetComponents( ORD:IDKey ) TIMES !step thru key components
I += 1 !increment counter
KeyQ.Field = Access:Order.GetField(ORD:IDKey,I)!get component reference
KeyQ.FieldName = Access:Order.GetFieldName(ORD:IDKey,I)!get component name
END
FileManager 619
GetEOF
The GetEOF method returns the current end of file status for the managed file.
Tip: GetEOF is designed to be used after a call to the Next or Previous method. The
GetEOF return value is undefined prior to the call to Next or Previous.
Implementation: GetEOF returns one (1 or True) if the last record in a Next/Previous series was
read; otherwise it returns zero (0 or False).
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
END
CODE
!program code
LOOP !loop through client file
CASE Access:Client.Next() !get next record in sequence
OF Level:Notify OROF Level:Fatal!if error occurred
POST(Event:CloseWindow) !shut down
BREAK
ELSE !otherwise
PRINT(Rpt:Detail) !print the record
END
UNTIL Access:Client.GetEOF() !stop looping at end of file
GetError
The GetError method returns the current error ID for the managed file. See Error Class for more
information on error IDs.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
LogError(STRING filename, SHORT error) !prototype LogError procedure
END
CODE
!program code
IF Access:Client.Open() !if error occurs
LogError(Access:Client.GetName(),Access:Client.GetError())!log name and error id
END
!program code
|field tag |
GetField(key, component)
Returns a reference to the specified key component.
GetField(field tag)
Returns a reference to the field based on the specified field tag.
GetField(index, field tag, field)
Returns Level:Notifiy if no field exists at the specified index position.
Returns Level:Benign if a field is successfully retrieved at the specified
index position.
BYTE
where prototype is GetField(index, field tag, field)
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors objec
622 ABC Library Reference
CODE
!program code
LOOP Access:Order.GetComponents( ORD:IDKey ) TIMES !step thru key components
I += 1 !increment counter
KeyQ.Field = Access:Order.GetField(ORD:IDKey,I) !get component reference
KeyQ.FieldName = Access:Order.GetFieldName(ORD:IDKey,I)!get component name
END
FileManager 623
|field number |
GetFieldName Returns the field name of the specified key component or field number in the
record buffer.
key The label of the key.
component A numeric constant, variable, EQUATE, or expression that indicates the key
component number. A value of one (1) specifies the first component; two (2)
specifies the second component, etc.
field number A variable name that represents the field number in the record buffer. A value of
one (1) specifies the first field in the record buffer; two (2) specifies the second
field in the record buffer, etc.
The GetFieldName method returns a field name from the record structure.
GetFieldName(key, component)
Returns the field name based on the specified key and component. This
form of the GetFieldName method returns a STRING data type.
GetFieldName(field number)
Returns the field name based on the specified field number from the
record buffer. See WHO.
Return Data Type: STRING
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors objec
Access:Order CLASS(FileManager) !derive Access:Order object
END
I BYTE
Order FILE,DRIVER('TOPSPEED'),PRE(ORD),THREAD !declare order file
IDKey KEY(Ord:Cust,Ord:ID,Ord:Date),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
Cust LONG
ID LONG
Date LONG
. .
KeyQueue QUEUE,PRE(KeyQ) !a list of key components
Field ANY !component field reference
624 ABC Library Reference
GetFieldPicture(field tag)
GetFieldType(field)
GetName
The GetName method returns the filename of the managed file for display in error messages, etc.
The SetName method sets the (variable) filename of the managed file.
Implementation: GetName returns the value of the FileNameValue property if it has a value;
otherwise, it returns the value of the FileName property.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
LogError (STRING filename, SHORT error)!prototype LogError procedure
END
Implementation: The Init method does not initialize some file specific properties (Buffer, FileName,
and FileNameValue). You should explicitly initialize these properties after the Init
method is called (or within your derived Init method). See the Conceptual
Example.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
CODE
GlobalErrors.Init !initialize the GlobalErrors object
Access:Client.Init !initialize Access:Client object
!program code
Access:Client.Kill !shut down the Access:Client object
GlobalErrors.Kill !shut down the GlobalErrors object
628 ABC Library Reference
Access:Client.Init PROCEDURE
CODE
PARENT.Init(Client, GlobalErrors)!call the base class Init method
SELF.FileNameValue = 'Client' !set the file name
SELF.Buffer &= CLI:Record !point Access:Client to Client buffer
SELF.AddKey(CLI:IDKey,'Client ID',1) !describe the primary key
Insert, PROC
The Insert method adds a new record to the file, making sure the record is valid, and
automatically incrementing key values as required. The Insert method handles any errors that
occur while adding the record.
The TryInsert method provides a slightly different (manual) alternative for adding new records.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP . !program map
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
END CODE
!program code
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Insert() = Level:Benign !add the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
Access:Client.CancelPrimeAutoInc !restore the file
CYCLE !and start over
. .
!more code
KeyToOrder Returns an ORDER attribute expression list (for a VIEW) that mimics the
specified key components.
key The label of the KEY.
component A numeric constant, variable, EQUATE, or expression that indicates the first
component field to include in the expression. A value of one (1) specifies the first
component; two (2) specifies the second component, etc.
The KeyToOrder method returns an ORDER attribute expression list (for a VIEW) that mimics
the specified key components. The expression list includes the specified component field plus all
the subsequent component fields in the key.
Implementation: The component defaults to one (1). The maximum length of the returned
expression is 512 characters.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager
MAP !program map
END
Kill, VIRTUAL
The Kill method disposes any memory allocated during the object's lifetime and performs any
other necessary termination code.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
CODE
GlobalErrors.Init !initialize the GlobalErrors object
Access:Client.Init !initialize Access:Client object
!program code
Access:Client.Kill !shut down the Access:Client object
GlobalErrors.Kill
FileManager 633
Next, PROC
The Next method gets the next record in sequence. The Next method handles any errors, except
end of file, that occur while getting the record.
The TryNext method provides slightly different (manual) alternative for getting records in
sequence.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
The TryOpen method provides slightly different (manual) alternative for opening files.
Implementation: If the file does not exist and the Create property is not zero, Open tries to create
the file. If Open succeeds, it returns Level:Benign (declared in ABERROR.INC). If
it ultimately fails, it returns the severity level of the last error it encountered while
trying to open the file. See Error Class for more information on severity levels.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
!file declaration
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
!program code
Position
The Position method returns the unique position of the current record.
The TryReget method retrieves a record based on the value returned by Position.
Implementation: Position returns the POSITION of the primary key if there is one; otherwise it
returns the file POSITION. See the Language Reference for more information on
POSITION.
Example:
Hold = SELF.Position()
PUT( SELF.File )
CASE ERRORCODE()
OF NoError
OF RecordChangedErr
SELF.SetError(Msg:ConcurrencyFailedFromForm)
SELF.Throw
WATCH( SELF.File )
SELF.TryReget(Hold)
ELSE
SELF.SetError(Msg:PutFailed)
RETURN SELF.Throw()
END
PostDelete Returns confirmation that valid dictionary trigger activity has occurred after delete
action, and optionally sets an error code and message to be processed.
ErrCode A string constant, variable, EQUATE, or expression that represents an error
code.
ErrMsg A string constant, variable, EQUATE, or expression that represents an error
message.
returncode Indicates if an error occurs.
The PostDelete method is a virtual method that returns a TRUE value by default if post delete
trigger activity was processed normally. The developer must set the return level to FALSE if any
problem occurred in the post delete trigger activity code. When PostDelete returns FALSE, an
ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set
to the contents of ErrCode when the error is processed by the ErrorClass object for the
associated file (table). Similarly, FILEERROR will be set to ErrMsg.
The PostDelete method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PostDelete is implemented using the file driver callback mechanism, therefore,
this method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed after a DELETE action for a
file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PostDelete(ErrCode,ErrMsg) !returns TRUE by default
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PostInsert
PostUpdate
FileManager 637
PostInsert Returns confirmation that valid dictionary trigger activity has occurred after an
insert action, and optionally sets an error code and message to be processed.
ErrCode A string constant, variable, EQUATE, or expression that represents an error
code.
ErrMsg A string constant, variable, EQUATE, or expression that represents an error
message.
returncode Indicates if an error occurs.
The PostInsert method is a virtual method that returns a TRUE value by default if post insert
trigger activity was processed normally. The developer must set the return level to FALSE if any
problems occurred in the post insert trigger activity code. When PostInsert returns FALSE, an
ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set
to the contents of ErrCode when the error is processed by the ErrorClass object for the
associated file (table). Similarly, FILEERROR will be set to ErrMsg.
The PostInsert method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PostInsert is implemented using the file driver callback mechanism, therefore,
this method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed after an INSERT action for a
file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PostInsert(ErrCode,ErrMsg) !returns TRUE by default
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PostDelete
PostUpdate
638 ABC Library Reference
PostUpdate Returns confirmation that valid dictionary trigger activity has occurred after an
insert action, and optionally sets an error code and message to be processed.
ErrCode A string constant, variable, EQUATE, or expression that represents an error
code.
ErrMsg A string constant, variable, EQUATE, or expression that represents an error
message.
returncode Indicates if an error occurs.
The PostUpdate method is a virtual method that returns a TRUE value by default if post update
trigger activity was processed normally. The developer must set the return level to FALSE if any
problems occurred in the post update trigger activity code. When PostUpdate returns FALSE, an
ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set
to the contents of ErrCode when the error is processed by the ErrorClass object for the
associated file (table). Similarly, FILEERROR will be set to ErrMsg.
The PostUpdate method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PostUpdate is implemented using the file driver callback mechanism, therefore,
this method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed after a CHANGE action for a
file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PostUpdate(ErrCode,ErrMsg) !returns TRUE by default
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PostDelete
PostInsert
FileManager 639
PreDelete Returns confirmation that valid dictionary trigger activity has occurred before a
delete action is executed, and optionally sets an error code and message to be
processed.
ErrCode A string constant, variable, EQUATE, or expression that represents an error
code.
ErrMsg A string constant, variable, EQUATE, or expression that represents an error
message.
returncode Indicates if an error occurs.
The PreDelete method is a virtual method that returns a TRUE value by default if pre-delete
trigger activity was processed normally. The developer must set the return level to FALSE if any
problems occurred in the pre-delete trigger activity code. When PreDelete returns FALSE, an
ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set
to the contents of ErrCode when the error is processed by the ErrorClass object for the
associated file (table). Similarly, FILEERROR will be set to ErrMsg.
The PreDelete method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PreDelete is implemented using the file driver callback mechanism, therefore,
this method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed after a CHANGE action for a
file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PreDelete(ErrCode,ErrMsg) !returns TRUE by default
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PreInsert
PreUpdate
640 ABC Library Reference
PreInsert Returns confirmation that valid dictionary trigger activity has occurred before an
insert action, and optionally sets an error code and message to be processed.
OpCode A SIGNED integer that indicates the type of ADD that will be attempted.
AddLength An UNSIGNED integer that indicates the record length about to be added when
the ADD ( File, Length) mode is active.
ErrCode A string constant, variable, EQUATE, or expression that represents an error
code.
ErrMsg A string constant, variable, EQUATE, or expression that represents an error
message.
returncode Indicates if an error occurs.
The PreInsert method is a virtual method that returns a TRUE value by default if pre-insert trigger
activity was processed normally. The developer must set the return level to FALSE if any
problems occurred in the pre-insert trigger activity code. When PreInsert returns FALSE, an
ERRORCODE 100 (trigger error) is posted. If ErrCode is set, then FILEERRORCODE will be set
to the contents of ErrCode when the error is processed by the ErrorClass object for the
associated file (table). Similarly, FILEERROR will be set to ErrMsg.
The OpCode and AddLength parameters can be used in your pre-processing trigger code.
DriverOp:ADD ADD(FILE)
DriverOp:Append APPEND(FILE)
DriverOP:AddLen ADD(FILE,LENGTH)
DriverOp:AppendLen APPEND(FILE,LENGTH)
Use the Equates provided in EQUATES.CLW (shown above) to test the OpCode. AddLength is
used to return the value of the length parameter if used with ADD.
The PreInsert method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PreInsert is implemented using the file driver callback mechanism, therefore, this
method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed before an INSERT action for a
file.
Example:
CODE
PUSHERRORS()
ReturnValue = PARENT.PreInsert(OpCode,AddLen,ErrCode,ErrMsg)
MESSAGE('Trigger Test Before Insert')
!Trigger code entered here
POPERRORS()
RETURN ReturnValue
PreUpdate Returns confirmation that valid dictionary trigger activity has occurred before an
attempted action, and optionally sets an error code and message to be
processed.
Pointer A LONG that represents the file pointer to be written if PUT ( File, Pointer)
or PUT (File, Pointer, Length) is used.
The PreUpdate method is accessible from a table’s trigger properties located in the Dictionary
Editor, or, in the Global Embeds of a target application
Implementation: PreUpdate is implemented using the file driver callback mechanism, therefore,
this method will have access to all variables that the File Manager has access to.
These variables and the ones added in the Data section of the method will allow
the developer to insert code that will be executed after a CHANGE action for a
file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PreUpdate(ErrCode,ErrMsg) !returns TRUE by default
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PostDelete
PostInsert
644 ABC Library Reference
Previous, PROC
The Previous method gets the previous record in sequence. The Previous method handles any
errors that occur while getting the record.
The TryPrevious method provides a slightly different (manual) alternative for getting records in
sequence.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
The TryPrimeAutoInc method provides a slightly different (manual) alternative for preparing
autoincremented records.
The CancelAutoInc method restores the managed file to its pre-PrimeAutoInc state.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
Init PROCEDURE !initialize Access:File object
PrimeAutoInc PROCEDURE,VIRTUAL !prepare new record for adding
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
646 ABC Library Reference
ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(82,53,45,14),USE(?Cancel)
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
IF Access:Client.PrimeAutoInc() !prime Client record
POST(Event:CloseWindow) !if prime fails, close down
END
OPEN(InsertWindow)
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Insert() = Level:Benign !finish adding the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
SELECT(?CLI:Name:Prompt) !select client name field
CYCLE !and start over
END
END
OF ?Cancel
IF EVENT() = EVENT:Accepted !on Cancel button
Access:Client.CancelAutoInc !restore Client to pre-PrimeRecord
POST(Event:CloseWindow) !close down
END
EMD
END
Access:Client.PrimeAutoInc PROCEDURE
CODE
!your custom code here
PARENT.PrimeAutoInc !call the base class method
!your custom code here
PrimeFields, VIRTUAL
The PrimeFields method is a virtual placeholder method to prime fields before adding a record.
Implementation: The ABC Templates use the PrimeFields method to implement field priming
specified in the Data Dictionary.
The PrimeRecord method calls the PrimeFields method before calling the
PrimeAutoInc method. You can use the PrimeRecord method to prime the
nonincrementing components of an autoincrementing key.
Example:
Access:Customer.PrimeFields PROCEDURE
CODE
CLI:StateCode = 'FL'
648 ABC Library Reference
Implementation: PrimeRecord prepares the record by optionally clearing the record buffer, then
calling the PrimeFields method to prime field values, and the PrimeAutoInc
method to increment autoincrementing key values. If it succeeds, it returns
Level:Benign (declared in ABERROR.INC), otherwise it returns the severity level
of the last error it encountered. See Error Class for more information on severity
levels. The suppress clear parameter lets you clear or retain any other values in
the record buffer.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
FileManager 649
Access:Client.PrimeAutoInc PROCEDURE
CODE
!your custom code here
PARENT.PrimeAutoInc !call the base class method
!your custom code here
Example:
FileManager.RestoreFile PROCEDURE(*USHORT Id)
CODE
IF ~SELF.UseFile()
SELF.Saved.Id = Id
GET(SELF.Saved,SELF.Saved.Id)
ASSERT(~ERRORCODE())
IF SELF.Saved.Key &= NULL
RESET(SELF.File,SELF.Saved.Pos)
ELSE
RESET(SELF.Saved.Key,SELF.Saved.Pos)
END
IF SELF.Saved.WHeld
HOLD(SELF.File)
END
IF SELF.Saved.WWatch
WATCH(SELF.File)
END
NEXT(SELF.File)
SELF.RestoreBuffer(SELF.Saved.Buffer)
DELETE(SELF.Saved)
Id = 0
END
RestoreFile( filestateid,dorestore )
Implementation: The RestoreFile method restores file position, as well as any active HOLD or
WATCH. RestoreFile calls the RestoreBuffer method to restore the managed
file's record buffer contents.
Example:
SaveState USHORT !must be a USHORT
CODE
SaveState = Access:MyFile.SaveFile() !save the file state
SET(MyKey,MyKey) !access the file (change the file state)
LOOP UNTIL Access:MyFile.Next()
!Check range limits here
!Process the record here
END
Access:MyFile.RestoreFile(SaveState) !restore the previously saved file state
SaveBuffer
The SaveBuffer method saves a copy of the managed file's record buffer contents (the Buffer
property) and returns a number that uniquely identifies the saved record. SaveBuffer stores buffer
contents for subsequent retrieval by the RestoreBuffer method.
Example:
FileManager.SaveFile PROCEDURE
Id LONG,AUTO
I SHORT,AUTO
CODE
Id = RECORDS(SELF.Saved)
IF Id
GET(SELF.Saved,Id)
ASSERT(~ERRORCODE())
Id = SELF.Saved.Id + 1
ELSE
Id = 1
END
SELF.Saved.Id = Id
SELF.Saved.Buffer = SELF.SaveBuffer()
SELF.Saved.Key &= SELF.File{PROP:CurrentKey}
SELF.Saved.WHeld = SELF.File{PROP:Held}
SELF.Saved.WWatch = SELF.File{PROP:Watched}
IF SELF.Saved.Key &= NULL
SELF.Saved.Pos = POSITION(SELF.File)
ELSE
SELF.Saved.Pos = POSITION(SELF.Saved.Key)
END
ADD(SELF.Saved)
RETURN Id
SaveFile
The SaveFile method saves the managed file's current state and returns a number that uniquely
identifies the saved state. SaveFile saves the managed file's state for subsequent restoration by
the RestoreFile method.
Implementation: The SaveFile method saves file position, as well as any active HOLD or WATCH.
SaveFile calls the SaveBuffer method to save a copy of the managed file's record
buffer contents.
Example:
SaveState USHORT !must be a USHORT
CODE
SaveState = Access:MyFile.SaveFile() !save the file state
SET(MyKey,MyKey) !access the file (change the file state)
LOOP UNTIL Access:MyFile.Next()
!Check range limits here
!Process the record here
END
Access:MyFile.RestoreFile(SaveState) !restore the previously saved file state
SetError( error id )
SetError Saves the specified error and the underlying error state for use by the Throw
method, etc.
error id A numeric constant, variable, EQUATE, or expression that identifies the error.
See Error Class for more information on error id.
The SetError method saves the specified error and underlying error state for use by the Throw
method, etc.
Example:
Access:Client.Next FUNCTION(BYTE HandleError) !Next function
CODE !with alternative error handling
LOOP
NEXT( SELF.File ) !get the next record
CASE ERRORCODE() !check for error conditions
OF BadRecErr OROF NoError
RETURN Level:Benign
OF IsHeldErr !if record is HELD by another
SELF.SetError(Msg:RecordHeld) !make RecordHeld the current error
IF HandleError !if interactive error handling
RETURN SELF.Throw() !pass current error to error handler
ELSE !otherwise (silent error handling)
RETURN Level:Notify !return error code to caller
END
END
END
SetErrors Sets the Error Class that the file manager uses.
ErrorClass The label of the ErrorClass object.
The new SetErrors() method of the file manager allows you to set the error class that the file
manager uses after it has been initialized.
Example:
DLLInitializer.Construct PROCEDURE
CODE
!Initialize the local INI manager to use windows INI file
LocalINIMgr.Init('allfiles.INI', NVD_INI)
CODE
IF ~curGlobalErrors &= NULL
GlobalErrors &= curGlobalErrors
END
IF ~curINIMgr &= NULL
INIMgr &= curINIMgr
END
Access:Customer.SetErrors(GlobalErrors)
Access:Orders.SetErrors(GlobalErrors)
Access:Detail.SetErrors(GlobalErrors)
Access:Products.SetErrors(GlobalErrors)
Access:Phones.SetErrors(GlobalErrors)
656 ABC Library Reference
SetKey Makes the specified key current for use by other FileManager methods.
key The label of the KEY.
The SetKey method makes the specified key the current one for use by other FileManager
methods.
Example:
FileManager.GetComponents FUNCTION(KEY K) !returns the number of key components
CODE
SELF.SetKey(K) !locate the specified key
RETURN RECORDS( SELF.Keys.Fields ) !count the components
FileManager 657
SetName( filename )
Implementation: SetName assumes the FileName property is a reference to the file's NAME
attribute variable.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP . !program map
ClientFile STRING(8) !client filename variable
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager)!derive Access:Client object
Init PROCEDURE !initialize Access:File object
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),THREAD,NAME(CLientFile)
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
CODE
GlobalErrors.Init !initialize the GlobalErrors object
Access:Client.Init !initialize the Access:Client object
LOOP I# = 1 TO 12 !step through 12 monthly files
Access:Client.SetName('Client'&I#) !set the filename variable
Access:Client.Open !open the monthly file
!process the file
Access:Client.Close !close the monthly file
END
658 ABC Library Reference
Access:Client.Init PROCEDURE
CODE
PARENT.Init(GlobalErrors) !call the base class Init method
SELF.File &= Client !point Access:Client to Client file
SELF.Buffer &= CLI:Record !point Access:Client to Client buffer
SELF.FileName &= ClientFile !point Access:Client to the filename variable
Throw Passes the specified error to the error handler object for processing.
error id A numeric constant, variable, EQUATE, or expression that indicates the error to
process. If omitted, Throw processes the current error--that is , the error
identified by the previous call to SetError or Throw.
The Throw method passes the current (last encountered) error to the nominated error handler for
processing, including FILEERROR() and FILEERRORCODE() values, then returns the severity
level of the error.
Implementation: The SetError method saves the specified error and underlying error state for use
by the Throw method. See Error Class for more information on error ids and
severity levels.
The Init method receives and sets the error handler object.
Example:
Access:Client.Next FUNCTION(BYTE HandleError)!Next function
CODE !with alternative error handling
LOOP
NEXT( SELF.File ) !get the next record
CASE ERRORCOD() !check for error conditions
OF BadRecErr OROF NoError
RETURN Level:Benign
OF IsHeldErr !if record is HELD by another
SELF.SetError(Msg:RecordHeld) !make RecordHeld the current error
IF HandleError !if interactive error handling
RETURN SELF.Throw() !pass current error to error handler
ELSE !otherwise (silent error handling)
RETURN Level:Notify !return error code to caller
END
END
END
ThrowMessage
Passes the specified error and text to the error handler object for processing.
error id A numeric constant, variable, EQUATE, or expression that indicates the error to
process.
text A string constant, variable, EQUATE, or expression to include in the error
message.
The ThrowMessage method passes the specified error, including FILEERROR() and
FILEERRORCODE() values, and text to the error handler object for processing, then returns the
severity level of the error. See Error Class for more about error ids and severity levels.
Implementation: The Init method receives and sets the error handler. The incorporation of the text
into the error message depends on the error handler. See Error Class.
Example:
GlobalErrors ErrorClass !declare GlobalErrors object
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
FileManager 661
CODE
!program code
The Fetch method provides a slightly different (automatic) alternative for fetching specific records.
Implementation: Fetch tries to get the specified record. If it succeeds, it returns Level:Benign. If it
fails, it returns Level:Notify and does not clear the record buffer. See Error Class
for more information on Level:Benign and Level:Notify.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
GlobalErrors ErrorClass !declare GlobalErrors object
Access:States CLASS(FileManager) !declare Access:States object
END
States FILE,DRIVER('TOPSPEED'),PRE(ST),CREATE,BINDABLE,TREAD
StateCodeKey KEY(ST:StateCode),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
StateCode STRING(2)
State STRING(20)
END
END
CODE
!program code
!get the state record for Florida
ST:StateCode = 'FL' !prime the state key for the fetch
IF Access:States.TryFetch(ST:StateCodeKey)!fetch the record
GlobalErrors.Throw(Msg:FieldNotInFile) !handle any errors yourself
END
The Insert method provides a slightly different (automatic) alternative for adding records.
Implementation: TryInsert tries to add the record. If it succeeds, it returns Level:Benign (declared
in ABERROR.INC). If it fails, it returns the severity level of the error it
encountered while trying to add the record. See Error Class for more information
on severity levels.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP . !program map
GlobalErrors ErrorClass !declare GlobalErrors object
Access:Client CLASS(FileManager) !derive Access:Client object
END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
PROMPT('&Name:'),AT(8,20),USE(?CLI:Name:Prompt)
ENTRY(@s0),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
END
CODE
!program code
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.TryInsert() = Level:Benign !add the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
Access:Client.Throw(Msg:InsertFailed) !handle the error
Access:Client.CancelPrimeAutoInc !restore the file
CYCLE !and start over
END
END
!more code
TryNext, PROC
The TryNext method gets the next record in sequence. The TryNext method does not attempt to
handle errors that occur while getting the next record.
The Next method provides a slightly different (automatic) alternative for getting records in
sequence.
Implementation: TryNext tries to get the next record. If it succeeds, it returns Level:Benign
(declared in ABERROR.INC). If it fails, it returns the severity level of the error it
encountered while trying to get the record. See Error Class for more information
on severity levels.
Example:
PROGRAM BatchReport !batch process--don't display errors
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
TryOpen, PROC
The TryOpen method tells the FileManager the calling procedure is using the file, then OPENs
the file if it is not already open. The TryOpen method does not attempt to handle errors that occur
while opening the file.
The Open method provides a slightly different (automatic) alternative for opening files.
Implementation: TryOpen tries to open the file. If it succeeds, it returns Level:Benign (declared in
ABERROR.INC). If it fails, it returns the severity level of the error it encountered
while trying to open the file. See Error Class for more information on severity
levels.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
IF Access:Client.TryOpen !try to open the Client file
MESSAGE('Could not open the Client file') !handle the error yourself
RETURN
END
!program code
TryPrevious, PROC
The TryPrevious method gets the previous record in sequence. The TryPrevious method does
not attempt to handle errors that occur while getting the previous record.
The Previous method provides a slightly different (automatic) alternative for getting records in
sequence.
Example:
PROGRAM BatchReport !batch report--don't display errors
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
The PrimeAutoInc method provides a slightly different (automatic) alternative for preparing
autoincremented records.
The CancelAutoInc method restores the managed file to its pre-TryPrimeAutoInc state.
Example:
PROGRAM
INCLUDE('ABFILE.INC') !declare FileManager class
MAP !program map
END
Client FILE,DRIVER('TOPSPEED'),PRE(CLI),CREATE,BINDABLE,THREAD
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
END
ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(82,53,45,14),USE(?Cancel)
END
CODE
GlobalErrors.Init !initialize GlobalErrors object
Access:Client.Init !initialize Access:Client object
Access:Client.Open !open the Client file
IF Access:Client.TryPrimeAutoInc() !prime Client record
POST(Event:CloseWindow) !if prime fails, close down
END
OPEN(InsertWindow)
ACCEPT
CASE FIELD()
OF ?OK
IF EVENT() = Event:Accepted !on OK button
IF Access:Client.Insert() = Level:Benign
!finish adding the new Client record
POST(Event:CloseWindow) !if add succeeds, close down
ELSE !if add fails
SELECT(?CLI:Name:Prompt) !select client name field
CYCLE !and start over
END
END
OF ?Cancel
IF EVENT() = EVENT:Accepted !on Cancel button
Access:Client.CancelAutoInc !restore Client to pre-PrimeRecord
POST(Event:CloseWindow) !close down
END
EMD
END
Access:Client.PrimeAutoInc PROCEDURE
CODE
!your custom code here
PARENT.PrimeAutoInc !call the base class method
!your custom code here
Implementation: The TryReget method tries to retrieve the specified record. If it succeeds, it
returns Level:Benign; otherwise it returns the severity level of the last error
encountered. See Error Class for more information on severity levels.
TryUpdate, PROC
The TryUpdate method changes (rewrites) the current record. The TryUpdate method does not
attempt to handle errors that occur while changing the record.
The Update method provides a slightly different (auomatic) alternative for changing records.
Note: This method does not handle referential integrity (RI) between related files. The
RelationManager class enforces RI between related files.
TryValidateField Validates the current record buffer value of the specified field and returns
a success or failure indicator.
fieldid A numeric constant, variable, EQUATE, or expression that identifies the field to
validate. The field is identified by its position in the FILE declaration. A value of
one (1) indicates the first field, two (2) indicates the second field, etc.
The TryValidateField method initiates the validation of the field's buffer and requests that no
errors be reported to the user. Level:Benign is returned if no errors occur.
Implementation: The TryValidateField method calls the ValidateFieldServer method to validate the
field's contents.
Update, PROC
The Update method changes (rewrites) the current record. The Update method handles any
errors that occur while changing the record.
The TryUpdate method provides a slightly different (manual) alternative for changing records.
Note: This method does not handle referential integrity (RI) between related files. The
RelationManager class enforces RI between related files.
UseFile, PROC
UseFile The UseFile method notifies ABC Library objects that the managed file whose
opening was delayed by the LazyOpen property is about to be used. UseFile
returns a value indicating whether the file is ready for use. A return value of
Level:Benign indicates the file is ready; any other return value indicates a
problem.
usetype A numeric constant, variable, EQUATE, or expression that determines how
UseFile handles the file buffer.
A value of UseType:Corrupts changes the value in the file buffer but does not
rely on the new value.
A value of UseType:Uses changes the value of the file buffer and then uses that
value.
A value of UseType:Returns holds a value from the file buffer to return it to the
parent. This mode is useful if you have a form record split between two windows
and need to preserve the values from one to the next.
Example:
FileManager.TryFetch PROCEDURE(KEY Key)
CODE
IF SELF.UseFile() THEN RETURN Level:Fatal. !really open the file
GET(SELF.File,Key)
IF ERRORCODE()
RETURN Level:Notify
ELSE
RETURN Level:Benign
END
ValidateField Validates the current record buffer value of the specified field and returns a
success or failure indicator.
field id A numeric constant, variable, EQUATE, or expression that identifies the field to
validate. The field is ientified by its position in the FILE declaration. A value of
one (1) indicates the first field, two (2) indicates the second field, etc.
The ValidateField method initiates the validation of the field’s buffer and requests that any errors
be reported to the user. Level:Benign is returned if no errors occur.
Implementation: The ValidateField method calls the ValidateFieldServer method to validate the
field’s contents.
Example:
MyFile FILE,DRIVER('TOPSPEED'),THREAD
Record RECORD,PRE()
TGroup GROUP !field id 1
Name STRING(20) !field id 2
Name2 STRING(20) !field id 3
FirstName STRING(10),OVER(Name2) !field id 4
END
Another STRING(10) !field id 5
END
END
CODE
!program code
Access:MyFile.ValidateField(4) !validate FirstName
ValidateField Validates the specified range of fields in the current record buffer and returns a
success or failure indicator.
firstfield A numeric constant, variable, EQUATE, or expression that identifies the first field
to validate by its position in the FILE declaration. A value of one (1) indicates the
first field, two (2) indicates the second field, etc.
lastfield A numeric constant, variable, EQUATE, or expression that identifies the last field
to validate by its position in the FILE declaration. A value of one (1) indicates the
first field, two (2) indicates the second field, etc.
failed A signed numeric variable that receives the identifier of the field that failed the
validation process. A value of one (1) indicates the first field, two (2) indicates the
second field, etc. If omitted, the calling procedure gets no indication of which field
failed the validation process.
The ValidateField method validates the specified range of fields in the current record buffer and
returns a success or failure indicator, and otionally identifies the field that failed the validation
process.
Implementation: The ValidateFields method invokes the ValidateField method for each field in the
range firstfield to lastfield.
ValidateFieldServer
Validates the current record buffer value of the specified field and returns a
success or failure indicator.
field id A numeric constant, variable, EQUATE, or expression that identifies the field to
validate. The field is identified by its position in the FILE declaration. A value of
one (1) indicates the first field, two (2) indicates the second field, etc.
handle errors An integer constant, variable, EQUATE, or expression that indicates an error has
occurred when validating the field id.
The ValidateFieldServer method validates the specified field in the current record buffer and
returns a success or failure indicator. If an error occurs when the field's buffer is validated an
error message (Msg:FieldNotInFile) is indicated to the user.
Implementation: The ValidateFieldServer method simply returns a zero (0). By convention a return
value of zero (0) indicates a valid field and any other value indicates a problem.
The ABC Templates derive a file-specific ValidateFieldServer method for each
file that implements Validity Checks specified in the Clarion data dictionary.
ValidateRecord
Validates all the fields in the current record buffer and returns a success or failure
indicator.
failed A signed numeric variable that receives the identifier of the field that failed the
validation process. A value of one (1) indicates the first field, two (2) indicates the
second field, etc. If omitted, the calling procedure gets no indication of which field
failed the validation process.
The ValidateRecord method validates all the fields in the current record buffer and returns a
success or failure indicator, and optionally identifies the field that failed the validation process.
Implementation: The ValidateRecord method invokes the ValidateField method for each field in
the record.
FilterLocatorClass
FilterLocatorClass Overview
The FilterLocatorClass is an IncrementalLocatorClass that filters or limits the result set of the
BrowseClass object's underlying view. That is, it not only locates matching items in the result set,
but it limits the result set to only those items.
Use a Filter Locator when you want a multi-character search on alphanumeric keys and you want
to minimize network traffic.
FilterLocatorClass Concepts
A Filter Locator is a multi-character locator, with no locator control required (but strongly
recommended). The FilterLocatorClass lets you specify a locator control and a field on which to
search for a BrowseClass object. The locator control accepts a search value which the
FilterLocatorClass applies to the search field. The search can match the search value beginning
with the first position of the search field ("begins with" search), or it can match the search value
anywhere within the search field ("contains" search).
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
FilterLocatorClass creates a filter expression based on the input search value and applies the
filter. Each additional (incremental) search character supplied results in a smaller, more refined
result set. For example, a search value of 'A' returns all records from 'AA' to 'Az'; a search value
of 'AB' returns all records from 'ABA' to 'ABz', and so on.
The Filter Locator determines the boundaries for the search based on the user specified search
value. The implementation of the boundaries depends on the database--for SQL databases, the
Filter Locator uses a LIKE; for ISAM databases it supplies upper and lower bounds.
Tip: The Filter Locator performs very well on SQL databases and on high order key
component fields; however, performance may suffer if applied to non-key fields or
low order key fields of non-SQL databases.
The BrowseClass optionally uses the FilterLocatorClass. Therefore, if your BrowseClass objects
use a FilterLocator, then your program must instantiate the FilterLocatorClass for each use. Once
you register the FilterLocatorClass object with the BrowseClass object (see
BrowseClass.AddLocator), the BrowseClass object uses the FilterLocatorClass object as needed,
with no other code required. See the Conceptual Example.
680 ABC Library Reference
The ABC BrowseBox template generates code to instantiate the FilterLocatorClass for your
BrowseBoxes. The FilterLocatorClass 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.
The FilterLocatorClass source code is installed by default to the Clarion \LIBSRC folder. The
specific FilterLocatorClass source code and its 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 a Locator 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)
FilterLocatorClass 681
ST:STATENAME LIKE(ST:STATENAME)
ViewPosition STRING(512)
END
CODE
ThisWindow.Run() !run the window procedure
FilterLocatorClass Properties
FilterLocatorClass Properties
The FilterLocatorClass inherits all the properties of the IncrementalLocatorClass from which it is
derived. See IncrementalLocatorClass Properties and LocatorClass Concepts for more
information.
In addition to the inherited properties, the FilterLocatorClass also contains the following property:
FloatRight BYTE
The FloatRight property determines whether the FilterLocator applies the search value to the
entire field (field contains search value) or only to the leftmost field positions (field begins with
search value). A value of one (1 or True) applies the "contains" test; a value of zero (0 or False)
applies the "begins with" test.
The FilterLocatorClass does not initialize the FloatRight property, therefore FloatRight defaults to
zero.
Implementation: The UpdateWindow method implements the action specified by the FloatRight
property.
FloatRight=False FloatRight=True
Bain Bain
Barber Barber
Bayert Bayert
Dunbar
Suba
FilterLocatorClass Methods
FilterLocatorClass Methods
The FilterLocatorClass inherits all the methods of the IncrementalLocatorClass from which it is
derived. See IncrementalLocatorClass Methods and LocatorClass Concepts for more information.
This method is only appropriate for LocatorClass objects with locator controls that accept user
input; for example, entry controls, combo controls, or spin controls.
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 appropriate
search value. If there is a search value, TakeAccepted calls the UpdateWindow
method to apply the search value.
Example:
BrowseClass.TakeAcceptedLocator PROCEDURE !process an accepted locator entry
CODE
IF ~SELF.Sort.Locator &= NULL AND ACCEPTED() = SELF.Sort.Locator.Control
IF SELF.Sort.Locator.TakeAccepted() !call locator take accepted method
SELF.Reset(1) !if search needed, reset the view
SELECT(SELF.ListControl) !focus on the browse list control
SELF.ResetQueue( Reset:Done ) !reload the browse queue
IF ~SELF.Sort.Locator &= NULL !if locator is present
SELF.Sort.Locator.Reset ! match search value to actual record
END
END
END
UpdateWindow, VIRTUAL
The UpdateWindow method applies the search criteria and redraws the locator control with its
current value.
Implementation: The UpdateWindow method refilters the underlying view, primes the
FreeElement property with the current search value (the Shadow property), then
redraws 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
686 ABC Library Reference
FuzzyClass 687
FuzzyClass
FuzzyClass Overview
The FuzzyClass supports the BrowseFuzzyMatching control template. These classes provide the
searching and weighting algorithms.
FuzzyMatching provides a way to search for a value and get all records that have that value
somewhere in the record's columns. The data returned is weighted based on where in the record
the value exists.
Lets see this in an example. Using a database of Books, we might have some fields such as Title,
Author, and ISBN. If we choose to search for the value of 'Potter', we will get all records which
have 'Potter' in the Title (Harry Potter and the Goblet of Fire) or in the Author (Beatrix Potter).
To use FuzzyMatching within a procedure, add the control template to the window. This will add a
GROUP control that contains an ENTRY control and 2 BUTTON controls.
FuzzyClass Properties
The FuzzyClass contains no public properties.
FuzzyClass Methods
Construct
The Construct method performs the necessary code to initialize the FuzzyClass object.
Implementation: The Construct method is automatically called when the object is instantiated.
Init
The Init method performs the necessary code to initialize the FuzzyClass object and its default
settings.
Kill
The Kill method performs the necessary code to initialize the FuzzyClass object and its default
settings.
Implementation: The Kill method is called globally at the end of the application.
FuzzyClass 689
Match(document, query)
SetOption(whichoption, value)
Example:
FuzzyMatcher.SetOption(MatchOption:NoCase, 1) !set for case insensitive search
FuzzyMatcher.SetOption(MatchOption:WordOnly, 0) !turn off word only search
FormVCRClass 691
FormVCRClass
FormVCRClass Overview
The FormVCRClass is a special class that uses a group control populated with scrolling and
update buttons. It is designed as an accessory to a Form procedure that is designed to function
independently from a standard Browse procedure.
Use the FormVCRClass template when you want to call a form directly from a menu item or
button and use the FormVCRClass to navigate through a primary file and perform standard
update actions.
FormVCRClass Concepts
The FormVCRClass lets you specify a group control with navigation and standard update buttons.
As the form is first opened, internal properties are set that control what buttons are disabled and
what database operations are allowed.
The FormVCRClass is derived from the ViewManager, plus it relies on many of the other
Application Builder Classes (RelationManager, ToolbarClass, etc.) to accomplish its tasks.
Therefore, if your program instantiates the FormVCRClass, it must also instantiate these other
classes. Much of this is automatic when you INCLUDE the FormVCRClass header
(ABVCRFRM.INC) in your program's data section.
The ABC Templates declare a local FormVCR class and object for each instance of the
FormVCRControl template. The ABC Templates automatically include all the classes necessary
to support the functionality specified in the FormVCRControl template.
The FormVCR Control Template requires the use of the SaveButton Control Template, which is
the framework of the Form template.
692 ABC Library Reference
The FormVCRClass source code is installed by default to the Clarion \LIBSRC folder. The
specific FormVCRClass source code and their respective components are contained in:
FormVCRClass Properties
QuickScan BYTE
The QuickScan property contains a value that tells the FormVCRClass whether or not to
quickscan when paging up or down within the form. Quick scanning only affects file systems that
use multi-record buffers. See Database Drivers for more information.
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: The QuickScan property sets SetQuickScan method, which SENDs the
QUICKSCAN driver string to the file driver for each specified file. The QUICKSCAN driver string
is supported by the ASCII, BASIC, and DOS drivers.
FormVCRClass 693
Toolbar &ToolbarClass
The Toolbar property is a reference to the ToolbarClass for this FormVCRClass 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 FormVCR controls 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 FormVCRClass
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 the Form VCR controls 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.
ViewPosition STRING(1024)
The ViewPosition property stores the unique position of the current record.
Implementation: Position returns the POSITION of the primary key if there is one; otherwise it
returns the file POSITION. See the Language Reference for more information on
POSITION.
Example:
FormVCRClass.TakeEvent PROCEDURE
VSP BYTE,AUTO
CODE
SELF.Window.Update()
IF EVENT()=EVENT:Accepted THEN
CASE ACCEPTED()
OF SELF.Window.OkControl
OROF SELF.Window.SaveControl
SELF.ViewPosition=POSITION(SELF.View)
SELF.SaveRequired = True
IF SELF.OnFirstRecord THEN
SELF.MoveDirection = Event:ScrollDown
END
ELSE
IF NOT 0{PROP:AcceptAll} THEN
SELF.TakeAcceptedLocator()
END
END
FormVCRClass 695
FormVCRClass Methods:
AddToolbarTarget (set the FormVCR toolbar)
AddToolbarTarget( toolbar )
Implementation: The Toolbar object for a FormVCR 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:
OPEN(QuickWindow) ! Open window
SELF.Opened=True
FormVCR6.Init|
(?FormVCRControls,10,FormVCR6::View,Relate:people,SELF) ! Init FormVCR manager
FormVCR6.InsertWhenNoRecords = True
FormVCR6.SetVCRControls|
(?FormVCR:Top,?FormVCR:PageUp,?FormVCR:Up,?FormVCR:Down,?FormVCR:PageDown,|
?FormVCR:Bottom)
FormVCR6.SetRequestControl|
(?FormVCR:Request,?FormVCR:Request:View,?FormVCR:Request:Insert,?FormVCR:Request:Change,|
?FormVCR:Request:Delete)
Do DefineListboxStyle
FormVCR6.AddSortOrder() !Add the sort order for sort order 1
! Controls like list boxes will resize, whilst controls like buttons will move
Resizer.Init(AppStrategy:Surface,Resize:SetMinSize)
SELF.AddItem(Resizer) ! Add resizer to window manager
SELF.AddItem(ToolbarForm)
FormVCR6.AddToolbarTarget(Toolbar) ! Browse accepts toolbar control
FormVCR6.Reset
SELF.SetAlerts()
RETURN ReturnValue
Implementation: In addition to other things (like initialization of properties), the Init method
calls the PARENT.Init method to initialize the FormVCR ViewManager object.
Example:
OPEN(QuickWindow) ! Open window
SELF.Opened=True
! Initialize the FormVCR manager
FormVCR6.Init(?FormVCRControls,10,FormVCR6::View,Relate:people,SELF)
Kill, VIRTUAL
The Kill method shuts down the FormVCR object.
Implementation: Among other things, the ForVCR.Kill method calls the PARENT.Kill
(ViewManager.Kill) method to shut down the browse's ViewManager object. See
View Manager for more information.
CheckBorders( ), VIRTUAL
Example:
FormVCRClass.UpdateWindow PROCEDURE
CODE
IF ~(SELF.Sort.Locator &= NULL)
SELF.Sort.Locator.UpdateWindow
END
SELF.CheckBorders
SELF.UpdateButtons
IF ~SELF.Toolbar &= NULL
SELF.Toolbar.DisplayButtons
END
698 ABC Library Reference
Example:
ToolbarFormVCRClass.DisplayButtons PROCEDURE
CODE
IF SELF.FormVCR.GetAction()=InsertRecord THEN
ENABLE(Toolbar:History)
ELSE
DISABLE(Toolbar:History)
END
Toolbar:Bottom{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:ScrollBottom,0),False,True)
Toolbar:Top{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:ScrollTop,0),False,True)
Toolbar:PageDown{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:PageDown,0),False,True)
Toolbar:PageUp{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:PageUp,0),False,True)
Toolbar:Down{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:ScrollDown,0),False,True)
Toolbar:Up{PROP:DISABLE} =|
CHOOSE(SELF.FormVCR.GetActionAllowed(EVENT:ScrollUp,0),False,True)
DISABLE(Toolbar:Locate)
PARENT.DisplayButtons
FormVCRClass 699
Implementation: The GetActionAllowed method is called by the TakeEvent method and is used to
synchronize toolbar buttons with the appropriate FormVCR action..
Example:
CASE ACCEPTED()
OF SELF.VCRRequest
IF SELF.GetActionAllowed(EVENT:Accepted,SELF.Window.Request) THEN
CHANGE(SELF.VCRRequest,SELF.Window.Request)
SELF.Window.OriginalRequest = SELF.Window.Request
SELF.TakeRequestChanged(SELF.VCRPrevRequest,SELF.Window.Request)
SELF.VCRPrevRequest = SELF.Window.Request
ELSE
IF SELF.NoRecords THEN
SELF.NoRecords = RECORDS(SELF.View)
IF NOT SELF.GetActionAllowed(EVENT:Accepted,SELF.Window.Request) THEN
SELF.Window.Request = SELF.VCRPrevRequest
CHANGE(SELF.VCRRequest,SELF.Window.Request)
SELF.UpdateWindow
ELSE
CHANGE(SELF.VCRRequest,SELF.Window.Request)
SELF.Window.OriginalRequest = SELF.Window.Request
SELF.TakeRequestChanged(SELF.VCRPrevRequest,SELF.Window.Request)
SELF.VCRPrevRequest = SELF.Window.Request
END
END
END
END
700 ABC Library Reference
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)
The Next method is called by the Fetch method. Among other things, Next calls
the PARENT.Next (ViewManager.Next) method. See ViewManager for more
information.
Example:
FormVCRClass 701
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)
The Previous method is called by the Fetch method. Among other things,
Previous calls the PARENT.Previous (ViewManager.Previous) method. See
ViewManager for more information.
Implementation: The ResetSort method calls the SetSort method to apply the current sort order.
Implementation:
The SetRequestControl method is used to map an appropriate control to a particular database
action. If the parameter is not set by the SetRequestControl method, than the action is not
supported.
Example:
Implementation:
The SetVCRControls method is used to map an appropriate control to a particular scrolling
action. If the parameter is not set by the SetVCRControls method, than the action is not
supported.
Example:
The order value is typically a value returned by the ViewManager’s 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.
TakeAcceptedLocator, VIRTUAL
The TakeAcceptedLocator method applies an accepted locator value to the FormVCR group--
the FormVCR object loads 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
when the end user TABS off or otherwise switches focus away from the locator's entry control.
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the FormVCR object. The
TakeEvent method handles all events associated with the FormVCR group.
The TakeLocate method is a virtual method that sets the active sort and filter criteria,
and enables any necessary toolbar activity.
Implementation: The FormVCR.TakeEvent method calls the TakeLocate method for each Locate
event.
UpdateWindow, VIRTUAL
The UpdateWindow method updates display variables to match the current state of the
FormVCR group.
GraphClass
GraphClass Overview
The GraphClass is used to manage and control the SVgraph group control available on
windows and reports. This control is created and initialize by the SVGraph control template. At
runtime, the group control reads from initial settings of the GraphClass, and arranges the data
points into a default graph type format. The data included in this graph includes grouping of
data, legends, labels, popup menus, and default print capabilities.
The SVGraph template is most useful for displaying graphical representation of data for nearly
every type of business application.
The GraphClass is the only class that will be visible to the developer. All other classes are used
internally by the Graph Class and are not documented.
GraphClass Properties
eShowSBonFirstThread is a Boolean value that determines if status bar information from the
graph object needs to be redirected to the application’s first thread.
If the current WINDOW that populated the graph control does not have a Status bar attribute,
then eShowSBonFirstThread set to TRUE will show graph control information in the status bar
of the APPLICATION (first thread). Set this property to FALSE to suppress (hide) this information.
eSumYMax is a property that is used to calculate the maximum sum of node values for the
accumulation graph types (Bar and Column). This property is used for drawing the diagram (e.g.,
It is necessary for calculating the height of the highest column).
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
gShowDiagramNameV is used to determine where the diagram name text information will be
displayed in the graph control. Diagram name text (series name) is the label of each set of data
points that you have defined for the graph control, without an added ‘Diagram:’ prompt.
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
DiagramNameText, ShowOnField
GraphClass 713
gShowMouse is used to determine where mouse X and Y coordinates will be displayed in the
graph control.
gShowMouse uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
ToShowValues, ToolTip
714 ABC Library Reference
gShowMouseX uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
ToShowValues, ToolTip
GraphClass 715
gShowMouseY uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
ToShowValues, ToolTip
716 ABC Library Reference
gShowNodeName is used to determine if and where the node name information will be
displayed in the graph control. Node name is the full text of the active X and Y Node name, less
the "Node:" prompt and values. The text is formed by the NodeText method. Node Text is
returned as the full form as follows:
gShowNodeName determines if and where the name part of the above node text will be
displayed.
gShowNodeName uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
NodeText
GraphClass 717
gShowNodeNameV is used to determine where the node name value information will be
displayed in the graph control. Node name value is the actual node Name identifier.
gShowNodeNameV uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
NodeNameText
718 ABC Library Reference
gShowNodeValue is used to determine where the node value information will be displayed in the
graph control. Node name value is part of the full text of the active X and Y Node name and
values the label of each set of data points that you have defined for the graph control, without an
added ‘Node:’ prompt. The text is formed by the NodeText method. Node Text is returned as the
full form as follows:
gShowNodeValue determines if and where the (X, Y) part of the above node text will be
displayed
gShowNodeValue uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
NodeValueText
GraphClass 719
gShowNodeValueX is used to determine where the node X value information will be displayed in
the graph control. The Node X value is the full text of the active X Node.
gShowNodeValueX uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
NodeXText
720 ABC Library Reference
gShowNodeValueY is used to determine where the node Y value information will be displayed in
the graph control. The Node Y value is the full text of the active Y Node.
gShowNodeValueY uses the gShowToType GROUP. Each group element is defined as follows:
eOnT A BYTE value, when set to TRUE, shows information on graph object’s
ToolTip
eOnW A BYTE value, when set to TRUE, shows target information on the
WINDOW title
eOnF A LONG integer that identifies the field equate to show the target
information. The target field can be any field capable of displaying the
designated information.
See Also:
NodeYText
GraphClass 721
GraphClass Methods
AllText (return full graph text information)
AllText
The AllText method reads Mouse, Diagram and Node text information from the MouseText,
DiagramText and NodeText methods respectively, and returns a formatted string to use in the
graph object’s tool tip.
Implementation: The AllText method can be called to query the graph object’s tool tip text as
needed.
The default return value is FALSE. If the method returns TRUE, the graph object is not redrawn.
Implementation: The BeginRefresh method is called from the graph object’s Refresh method
The CalcCurrentGraph method is used to set the parameters for a designated graph type. In the
Graph Control template, a user can dynamically switch graph types at runtime. This method
determines which graph type was specified and instantiates a new object used to set parameters
specific to that graph type.
Implementation: The method is called from the CalcGraph method each time a graph type
changes or the window is initially loaded.
The CalcCurrentNode method calculates all attributes of a current node, including fill color,
shape, hide property, value, background, min/max values, radius, etc.
Implementation: The method is called from the CalcGraph method., for each node in the
current graph type.
The CalcGraph method is used to calculate positions and values for a graph’s title, legend, axis,
and nodes for a specified graph control.
Implementation: The CalcPopup method is called from the GraphClass Popup method,
initializing standard menu items for use with all graph types.
Implementation: The CalcPopupAdd2 method is called from the CalcPopup method. A set of
properties and equates (see GRAPH.EQU in the \LIBSRC folder) determine
the availability of menu items and their initial state.
The showtext parameter defaults to returning the diagram name text. If the showtext Boolean
value is set to FALSE, an empty string value is returned.
Implementation: The DiagramNameText method is called from any method that needs to
update or refresh a graph control’s textual elements.
The showtext parameter defaults to returning the diagram name text. If the showtext Boolean
value is set to FALSE, an empty string value is returned.
Implementation: The DiagramText method is called from any method that needs to update or
refresh a graph control’s textual elements.
The showtext parameter defaults to returning the diagram name text. If the showtext Boolean
value is set to FALSE, an empty string value is returned.
Implementation: The DiagramNameText method is called from any method that needs to
update or refresh a graph control’s textual elements.
The showtext parameter defaults to returning the diagram name text. If the showtext Boolean
value is set to FALSE, an empty string value is returned.
Implementation: The DiagramText method is called from any method that needs to update or
refresh a graph control’s textual elements.
Implementation: The Draw method is called from the Resize method which is called from the
Refresh method
Refresh
CalcGraph
DrawGraph
Implementation: The DrawGraph method is called after the CalcGraph method has set the
appropriate graph control’s values.
The DrawReport method draws a copy of the graph object into a REPORT structure and
prepares WMF-files for subsequent viewing and printing.
Implementation: The DrawReport method is called from the PrintGraph method, prior to the
Previewer object is initialized.
See Also: PrintGraph
NodeID The positional node value of the active graph control that
is passed to the drilldown graph control.
Optional parameters can be processed by the target drilldown graph control. This allows the
target control to be related to the original graph object.
Implementation: The Drilldown method is called from the TakeEventOfParent method, when
a Drilldown event is posted.
ReturnFromDrillDown
GraphClass 731
The GetMouse method is used to retrieve mouse coordinates each time a mouse event has
occurred on the graph control.
Implementation: The GetMouse method is called from the TakeEventOfParent method, and
sets the following properties:
The GetValueFromField method is used to return the contents of a specified field for use in
other areas of the graph control (i.e., tool tips).
The ImagetoWMF method is used to transfer a graph object’s current state to a WMF file. This
file can be used later for printing or additional processing. ImagetoWMF returns the name of the
WMF file that the graph image is transferred to.
The Init method is used to initialize the graph object prior to display. It calls all of the necessary
methods used to set default values and position the graph object.
Implementation: Typically, the Init method is paired with the Kill method, performing the
converse of the Kill method tasks.
The Interactivity method processes the mouse coordinates of a graph control, and finds
corresponding nodes of diagrams and displays it on a ToolTip or other appropriate target. It is
used to keep the mouse and node data in sync.
The IsOverNode method is used to detect a node location to pass to the drilldown procedure. A
drilldown graph control is normally selected by doubleclicking on a selected node, but the
IsOverNode method allows node data to be passed when selecting a drilldown graph from the
popup menu.
IsOverNode returns TRUE when a valid node was in range when the mouse right-click was
pressed. If the user right-clicks over an area where no node is present, the "Drilldown" or
"Return from DrillDown" menu options will be disabled.
The Kill method frees any memory allocated during the life of the GraphClass object and
performs any other required termination code.
The MouseText method returns the text of the active X and Y mouse coordinates. If parShow is
set to FALSE, the text is suppressed, and an empty string is returned.
Return Data Type: STRING
Implementation: The MouseText method is called from the ToShowValues and AllText
method. It is also used to form the text for the ToolTip method.
The MouseXText method returns the text of the active X mouse coordinate. If parShow is set to
FALSE, the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
The MouseYText method returns the text of the active Y mouse coordinate. If parShow is set to
FALSE, the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
The NodeNameText method returns the text of the active X and Y Node names. If parShow is
set to FALSE, the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
The NodeText method returns the full text of the active X and Y Node name and values. If
parShow is set to FALSE, the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
Implementation: The NodeText method is called from the ToShowValues and AllText
methods.
NodeTipText Returns text of the active node for the tool tip.
The NodeTipText method returns the tool tip text of the active X and Y Node values. If parShow
is set to FALSE, the return text is suppressed, and an empty string is returned.
Return Data Type: STRING
Implementation: The NodeTipText method is called from the graph object’s ToolTip method.
The NodeValueText method returns the text of the active X and Y Node values. If parShow is
set to FALSE, the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
The NodeXText method returns the text of the active X Node value. If parShow is set to FALSE,
the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
The NodeYText method returns the text of the active Y Node value. If parShow is set to FALSE,
the node text is suppressed, and an empty string is returned.
Return Data Type: STRING
Popup Creates, displays, and processes the graph object popup menu
The Popup method is used to create, display and process the graph object’s popup
menu (when enabled).
Implementation: The Popup method is called if the user right-clicks on a graph control, and
the self.ePopUp property is set to TRUE.
The PopupAsk method is used to display and return the graph object popup menu item
selected.
Implementation: The PopupAsk method is called from the Popup method, and invokes the
Ask method refernces by the Popup Class.
The PostEvent method posts an event to the graph object. The graph object event is processed
by the appropriate TakeEvent method.
Graph Events are template-defined events, and listed in the SVGRAPH.EQU source file:
event:Zoom100 equate
event:Zoom50 equate
event:Zoom25 equate
event:GraphTypeLine equate
event:GraphTypeScatterGraph equate
event:GraphTypeAreaGraph equate
event:GraphTypeFloatingArea equate
event:GraphTypeColumnChart equate
event:GraphTypeColumnWithAccumulation equate
event:GraphTypeBarChart equate
event:GraphTypeBarWithAccumulation equate
event:GraphTypeFloatingColumn equate
event:GraphTypeFloatingBar equate
event:GraphTypePieChart equate
event:GraphSubTypeSimple equate
event:GraphSubTypeNormalized equate
event:FigureTypeBar equate
event:FigureTypeCylinder equate
event:LegendPosition:None equate ! To not show legend
event:LegendPosition:Left equate
event:LegendPosition:Right equate
event:LegendPosition:Top equate
event:LegendPosition:Bottom equate
event:AxisStyle:None equate ! To not show Axis
event:AxisStyle:Standard equate
event:AxisStyle:Long equate
event:AxisScale equate
event:AxisScale:Linear equate
event:AxisScale:AsMSWord equate
event:NodeType:None equate ! To not show nodes
event:NodeType:Square equate ! To set a type of node as a square
event:NodeType:Triangle equate ! To set a type of node as a triangle
event:NodeType:Circle equate ! To set a type of node as a circle
event:Refresh equate ! To refresh object
event:Draw equate ! To draw object
event:Hide equate ! To hide object
event:UnHide equate ! To unhide object
event:Print equate ! To print diagram
event:PrintBestFit equate
event:Save equate ! To save diagram
event:SaveAs equate ! To save the diagram under a new name
event:DrillDown equate
event:ReturnFromDrillDown equate
end
The method allows to choose the printer, draw the graph object (using the DrawReport method),
Preview the report,and send pages to the printer.
If the bestfit flag is set to FALSE (default), the graph object will print "as is", anchoring the object
at the top left corner of the paper.
If the bestfit flag is set to TRUE, the graph object will resize to a best fit within the band that it is
populated.
TakeEventOfParent
GraphClass 745
The Refresh method is used to redraw and resize the graph object. This method is called
throughout the graph control template when any element of the graph has changed. You can
also use the Refresh method when data has changed, or initialization of a drilldown graph
object is needed.
If the parRefresh flag is FALSE (default), the graph object will not be refresh. The BeginRefresh
method is used to pre-process the Refresh method, and set the parRefresh flag to TRUE if a
refresh is ready to execute.
Implementation: The Refresh method is called when a graph event (Event:Refresh) is posted.
Resize
The Resize method is used to reposition and redraw the graph object.
If the redraw flag is FALSE (default), the graph object will only redraw if the size of the parent
field has changed. If the redraw flag is set to TRUE, a redraw is always executed.
Implementation: The Resize method is called from the Refresh method when the parRefresh
property is set to TRUE.
Draw
746 ABC Library Reference
ReturnFromDrilldown
Unhides, calculates and draws the original graph object
The ReturnFromDrilldown method is used to "drill back" to the original graph object. It is
designed to restore the original graph object’s state prior to calling the Drilldown method.
Optional parameters can be processed by the target "drill back" graph control. This allows the
target control to be related to the drilldown graph object.
Implementation: The ReturnFromDrilldown method is called from the TakeEventOfParent
method when the graph event Event:ReturnFromDrillDown is posted. This
event is triggered when the user double-clicks on a valid graph node, or
selects the "Return from DrillDown" popup menu item.
TakeEventOfParent
GraphClass 747
The SaveAsGraph method writes the current state of the graph object to a WMF file. The
user is prompted to enter a valid WMF file name.
Implementation: The SaveAsGraph method calls the SaveGraph method, forcing the
askSave property to TRUE. The SaveAsGraph method is called when a
graph event (Event:SaveAs) is posted.
The SaveGraph method writes the current state of the graph object to a WMF file. If the
askSave parameter is set to TRUE, the user is first prompted to enter a valid WMF file
name.
Implementation: The SaveGraph method is called when a graph event (Event:Save) is
posted.
The SetDefault method initializes critical properties of the graph object prior to its data point
calculations and display. Most of these properties are found in the Initial Settings section of the
Graph Control template.
Implementation: The SetDefault method is called from the graph object’s Init method.
eShowSBonFirstThread
The TakeEvent method is used to process events returned by the graph object. These events
are returned by the parent control of the graph object (by default, a GROUP) and to other
support controls of the object. In general, all events should be posted to the parent field of the
graph object.
Implementation: The TakeEvent method is called within the graph object procedure’s
ACCEPT event handler. It provides a virtual method in which the developer
can use to trap and process all graph control events.
By default, all graph events are processed by the graph object’s parent control (by default, a
GROUP). This method is the control center from which other methods are executed and
properties are set.
Implementation: The TakeEventOfParent method is called from the TakeEvent method.
The ToolTip method displays all text that is directed to the graph object’s tool tip box.
Implementation: The ToolTip method is called from the Interactivity method.
AllText
Interactivity
GraphClass 751
The ToShowValues method checks a variety of properties that are set by the graph control
template and popup menu, and filter what specific text should be displayed on which target. For
example, you may have omitted mouse text from the graph control’s tool tip, or limit a control to
only displaying the X node values.
Implementation: The ToShowValues method is called from the Interactivity method.
GridClass
GridClass Overview
The GridClass is used to manage and control BrowseGrid controls. These combined controls
make up the BrowseGrid control template. At runtime, the BrowseGrid replaces the underlying
BrowseBox and arranges the data in as groupds within a matrix format. The data included in this
matrix includes all controls populated within the BrowseGrid GROUP control.
The BrowseGrid template is most useful for displaying product lists on a web page, but it may
be used on desktop applications as well.
GridClass Properties
GridClass Properties
The GridClass inherits all the properties of the BrowseClass from which it is derived.
Implementation: The BrowseGrid template assigns the ClickPress control based on the
control supplied to the template. The ClickPress action occurs in the
GridClass.TakeEvent method.
Implementation: The ABC Templates automatically assigns this property its value. If the
template is not being used this value should be initializes in the Init method.
Implementation: The ABC Templates automatically assigns this property its value. If the
template is not being used this value should be initializes in the Init method.
GridClass 757
Implementation: The ABC Templates automatically assigns this property its value. If the
template is not being used this value should be initializes in the Init method.
Selectable BYTE
The Selectable property indicates that an element (group) in the grid is selectable. Clicking on
any elemen in the group will make it the currently selected element of the queue.
Implementation: The ABC Templates automatically assigns this property its value. If the
template is not being used this value should be initializes in the Init method.
UpdateControl SIGNED
The UpdateControl property specifies a contol that when accepted will trigger a file update.
Implementation: The ABC Templates automatically assigns this property its value. If the
template is not being used this value should be initializes in the Init method.
UpdateControlEvent
UpdateControlEvent SIGNED
The UpdateControlEvent property is not currently implemented.
758 ABC Library Reference
GridClass Methods
The GridClass inherits all the methods of the BrowseClass from which it is derived.
AddLocator(locator)
Implementation: The specified locator is sort order specific. It is enabled only when the
associated sort order is active.
FetchRecord(record)
GetAcross
The GetAcross method returns the number of GROUPs that fit into the designed listbox.
GetClickPress
The GetClickPress method returns the control number of the control to be accepted. This control
is specified in the BrowseGrid template by the Forward other control clicks to: prompt.
GetDown( )
The GetDown method returns the number of GROUPs that fit into the designed listbox.
IfGroupField(field)
Implementation: In addition to other things, the Init method calls the PARENT.Init method to
initialize the browse's ViewManager object.
IsSkelActive
IsSkelActive, VIRTUAL
The IsSkelActive method is not implemented at this time.
Kill, DERIVED
The Kill method shuts down the GridClass object. It frees any memory allocated during the life
of the objects and performs any other necessary cleanup code.
SetAlerts, DERIVED
The SetAlerts method initiates the managing and storage of child controls to the BrowseGrid.
SyncGroup(record)
TakeEvent, DERIVED
The TakeEvent method processes the current ACCEPT loop for the GridClass object. The
method handles all events associated with the Grid controls including the parent GROUP control
and all of its children.
HistHandlerClass
HistHandlerClass Source Files
The HistHandlerClass source code is installed by default to the Clarion \LIBSRC. The specific
ErrorClass source code and their respective components are contained in:
HistHandlerClass Properties
The HistHandlerClass contains the following properties:
History &ErrorHistoryList,PROTECTED
The History property is a reference to the ErrorHistoryList structure that holds the history for
errors that have previously occurred. The error History is determined based on the
HistoryThreshold and HistoryResetOnView properties.
766 ABC Library Reference
HistHandlerClass Methods
The HistHandlerClass contains the following methods:
TakeEvent, VIRTUAL
The TakeEvent method processes the MsgBox window events. In particular the OpenWindow
event is processed. Upon the EVENT:OpenWindow, the LIST control is interrogated. A
Level:Benign is returned.
Implementation: If passed a rowindex of -1, the VLBProc returns the number of history error
records that are contained in the error history queue. If passed a rowindex of
-2, the method returns the number of listbox columns.
Any positive integer passed as the rowindex will cause the VLBProc to
lookup the error history record at the relative rowindex position. The colindex
parameter is used in association with a positive integer rowindex. A colindex
value of 1 will return the error text. A colindex of 2 will return the error
category.
IDbChangeAudit Interface
IDbChangeAudit Concepts
The IDbChangeAudit interface defines a set of common methods the DbAuditManager object
must implement in order for the object to handle additions, updates and deletions to the audit
files.
IDbChangeAudit Methods
The IDbChangeAudit interface defines the following methods.
BeforeChange
filename A string constant, variable, EQUATE, or expression
containing the label of the file that is to be audited.
BFP The label of aBufferedPairsClass object. See
BufferedPairsClass for more information.
Implementation: BeforeChange is a VIRTUAL method that lets you easily implement your own
custom version of this method. This method can be called to process code
before the record buffer is saved. This method calls the
DbAuditManager.BeforeChange method.
Implementation: ChangeField 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 OnChange method is a VIRTUAL method so that other base class
methods can directly call the OnChange virtual method in a derived class.
This lets you easily implement your own custom version of this method.
IListControl Interface
IListControl Concepts
The IListControl interface is a defined set of behaviors that relate to a LIST control.
IListControl Methods
The IListControl interface defines the following methods.
Choice
The Choice method returns the entry number of the highlighted record in a LIST control.
Example:
Self.CurrentChoice = SELF.ILC.Choice()
!Returns 2 if second record in LIST is highlighted
774 ABC Library Reference
GetControl
The GetControl method returns the control number (field equate) for a LIST control.
Example:
SELF.ListControl = Li.GetControl()
GetItems
The GetItems method returns the number of entries visible in a LIST control.
Example:
LI = SELF.ILC.GetItems()
GetVisible
The GetVisible method returns a value indicating whether the control is currently visible on the
window. An empty string is returned if the control is not showing.
Example:
IF ~SELF.ILC.GetVisible() !If control is not visible
MESSAGE('Control is not visible')
END
IListControl Interface 775
SetChoice(newchoice)
Example:
SELF.ILC.SetChoice(SELF.CurrentChoice) !Set new selected entry to
Self.CurrentChoice
SetControl(newccontrol)
IncrementalLocatorClass
IncrementalLocatorClass Overview
The IncrementalLocatorClass is an EntryLocatorClass that activates on each additional search
character added to the search value (not when the locator control is accepted).
Use an Incremental locator when you want a multi-character search on numeric or alphanumeric
keys and you want the search to take place immediately upon the end user's keystroke.
IncrementalLocatorClass Concepts
The locator control may be a STRING, ENTRY, COMBO, or SPIN, however, any control other
than a STRING causes the Incremental locator to behave like an Entry locator--the search is
delayed until the control is accepted.
With a STRING control (or no control), when the BrowseClass LIST has focus, keyboard input
characters are automatically added to the locator's search value string for each keystroke, and
the BrowseClass immediately advances to the nearest matching record. The Backspace key
removes characters from the locator's search value string.
We strongly recommend using a STRING control as the Incremental Locator control for the
following reasons:
The BrowseClass uses the IncrementalLocatorClass to locate and scroll to the nearest matching
item. Therefore, if your program's BrowseClass objects use an Incremental Locator, your
program must instantiate the IncrementalLocatorClass for each use. Once you register the
IncrementalLocatorClass object with the BrowseClass object (see BrowseClass.AddLocator), the
BrowseClass object uses the IncrementalLocatorClass object as needed, with no other code
required. See the Conceptual Example.
778 ABC Library Reference
The ABC BrowseBox template generates code to instantiate the IncrementalLocatorClass for
your BrowseBoxes. The IncrementalLocatorClass 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.
The IncrementalLocatorClass source code is installed by default to the Clarion \LIBSRC folder.
The IncrementalLocatorClass source code and its respective components are contained in:
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
IncrementalLocator Class 779
CODE
ThisWindow.Run() !run the window procedure
IncrementalLocatorClass Properties
IncrementalLocatorClass Properties
The IncrementalLocatorClass inherits all the properties of the EntryLocatorClass from which it is
derived. See EntryLocatorClass Properties and LocatorClass Properties for more information.
782 ABC Library Reference
IncrementalLocatorClass Methods
IncrementalLocatorClass Methods
The IncrementalLocatorClass inherits all the methods of the EntryLocatorClass from which it is
derived. See EntryLocatorClass Methods and LocatorClass Methods for more information.
Implementation: The SetAlerts method alerts the backspace key and the space key.
Example:
MyBrowseClass.SetAlerts PROCEDURE !alert keys for browse object
I BYTE,AUTO
CODE
LOOP I = 1 TO RECORDS( SELF.Sort ) !for each sort order
GET( SELF.Sort, I )
IF ~ ( SELF.Sort.Locator &= NULL ) !if locator is present
SELF.Sort.Locator.SetAlerts( SELF.ListControl )! call Locator.SetAlerts method
END
END
IncrementalLocator Class 783
TakeKey, VIRTUAL
The TakeKey method processes an alerted locator keystroke for the LIST control that displays
the data to be searched, and returns a value indicating whether the browse display should
change.
Tip: By default, all alphanumeric keys are alerted for LIST controls.
Implementation: The TakeKey method adds to or subtracts from the search value (the Shadow
property) based on the end user's keystrokes, then returns one (1) if a new
search is required or returns zero (0) if no new search is required. A search is
required only if the keystroke is a valid search character.
Example:
CheckLocator ROUTINE
IF SELF.Sort.Locator.TakeKey() !handle locator alerted keys
SELF.Reset(1) !if search needed, reset view
SELF.ResetQueue(Reset:Done) ! and relead queue
ELSE !if no search needed
SELF.ListControl{PROP:Selected}=SELF.CurrentChoice !highlight selected list item
END
INIClass
INIClass Overview
The INIClass provides a simple interface to different methods of non-volatile storage (e.g.,
storage that is persistent beyond the life cycle of your programs). By default, the INIClass object
centrally handles reads and writes for a given configuration (.INI) file. It also supports other
methods of non-volatile storage by allowing read and write access to the Windows system
registry or a local table. The INIClass Init method controls which access method is used.
INIClass Concepts
By convention an INI file is an ASCII text file that stores information between computing sessions
and contains entries of the form:
[SECTION1]
ENTRY1=value
ENTRYn=value
[SECTIONn]
ENTRY1=value
ENTRYn=value
The INIClass automatically creates INI files and the sections and entries within them. The INI
class also updates and deletes sections and entries. In particular, the INIClass makes it very easy
to save and restore Window sizes and positions between sessions; plus it provides a single
repository for INI file code, so you only need to specify the INI file name in one place.
The PopupClass and the PrintPreviewClass optionally use the INIClass; otherwise, it is
completely independent of other Application Builder Classes.
The INIClass source code is installed by default to the Clarion \LIBSRC folder. The INIClass
source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate an INIClass object.
PROGRAM
PWindow WINDOW('Preferences'),AT(,,89,34),MAX,RESIZE
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
PROMPT('&Volume'),AT(31,19),USE(?VolumePrompt)
SPIN(@s20),AT(8,20,21,7),USE(Volume),HVSCROLL,RANGE(0,9),STEP(1)
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
INIMgr.Init('.\MyApp.INI') !initialize the INIMgr object
INIMgr.Fetch('Preferences','Sound',Sound) !get sound, default 'ON'
Volume=INIMgr.TryFetch('Preferences','Volume') !get volume, no default
IF Volume
Sound=INIMgr.FetchField('Preferences','Sound&Vol',1) !get comma delimited sound
Volume=INIMgr.FetchField('Preferences','Sound&Vol',2) !get comma delimited volume
END
OPEN(PWindow)
INIMgr.Fetch('Preferences',PWindow) !restore window size & pos
ACCEPT
IF EVENT() = EVENT:Accepted
IF FIELD() = ?OK
INIMgr.Update('Preferences','Sound',Sound) !store sound
INIMgr.Update('Preferences','Volume',Volume) !store volume
INIMgr.Update('Preferences','Sound&Vol',| !store comma delimited values
CLIP(Sound)&','&Volume) !e.g., Sound&Vol=ON,3
POST(EVENT:CloseWindow)
END
END
END
INIMgr.Update('Preferences',PWindow) !store window size & pos
788 ABC Library Reference
INIClass Properties
INIClass Properties
The INIClass contains the following properties.
FileName
FileName CSTRING(File:MaxFilePath)
The FileName property contains the name of the managed storage medium (INI file or system
registry key). The INIClass methods use the FileName property to identify the storage medium.
If a full path is specified, and the INIClass Init Method has specified INI file storage, the INIClass
looks for the file in the specified path. If no path is specified, the INIClass looks for the file in the
Windows directory. If no name is specified (''), the INIClass uses the WIN.INI file. For example:
If the INIClass Init Method has specified system registry storage, the INIClass looks for the
specified registry key.
Implementation: The INIClass methods use the FileName property as the file parameter in
GETINI and PUTINI statements. See the Language Reference for more
information.
INIClass Methods
The INIClass contains the following methods.
| entry [, value] |
| window |
The Fetch method gets or returns values from the INI file.
Fetch(section,entry[,value])
Retrieves a single value specified by section and entry from the
INI file specified in the INIClass.FileName property. If a value
parameter is present, the Fetch method updates it with the
requested value and returns nothing. If no value parameter is
present the Fetch method returns the requested value.
Fetch(section,entry,value,filename)
Retrieves a single value specified by section and entry from the
INI file specified by filename. The value parameter is updated
with the requested value. If the entry or filename does not exist
in the INI file, the Fetch method returns an empty string.
Fetch(section,window)
Retrieves and restores several WINDOW attributes saved by a
prior corresponding call to Update(section,window) from the INI
file specified in the INIClass.FileName property. Restoring the
values returns the specified WINDOW to its saved position and
size.
Implementation: If a window is present, the Fetch method gets five entries from the specified INI
file section: Maximize, XPos, YPos, Height, and Width. Then it applies the
retrieved values to the specified WINDOW or APPLICATION.
Return Data Type: STRING where prototype is Fetch(section, name, value, filename)
STRING where prototype is Fetch(section, name)
Example:
Sound STRING('ON ')
PWindow WINDOW('Preferences'),AT(,,89,34),IMM,MAX,RESIZE
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
INIMgr.Fetch('Preferences','Sound',Sound) !get 'Sound', default ON
Sound=INIMgr.Fetch('Preferences','Sound') !return 'Sound', no default
Sound=INIMgr.Fetch('Preferences','Sound',Sound,'MYAPP.INI')
!get 'Sound', from MYAPP.INI
OPEN(PWindow)
INIMgr.Fetch('Preferences',PWindow) !restore PWindow size & position
A field value of one (1) returns the value prior to the first comma in the string; a value of two (2)
returns the value between the first and second commas; a three (3) returns the value between the
second and third commas, etc.
Example:
Sound STRING('ON ')
Volume BYTE(3)
CODE
INIMgr.Update('Preferences','Sound&Volume', | !create INI entry like
CLIP(Sound)&','&Volume) !Sound&Volume=ON,3
!program code
Sound=INIMgr.FetchField('Preferences','Sound&Volume',1) !get 1st value - 'ON'
Volume=INIMgr.FetchField('Preferences','Sound&Volume',2) !get 2nd value - 3
792 ABC Library Reference
for example:
[Users]
User=3
User_1=Fred,1
User_2=Barney,0
User_3=Wilma,1
Example:
UserQ QUEUE
Name STRING(20)
Auth BYTE
END
CODE
INIMgr.FetchQueue('Users','User',UserQ,UserQ.Name,UserQ.Auth)!get UserQ
!program code
INIMgr.Update('Users','User',RECORDS(UserQ)) !put UserQ count
LOOP i# = 1 TO RECORDS(UserQ) !put UserQ entries
GET(UserQ,i#)
INIMgr.Update('Users','User_'&i#,CLIP(UserQ.Name)&','&UserQ.Auth)
END
IReportGenerator Interface 793
ExtraData A LONG integer. When the registry is used in the second parameter, ExtraData
is used to specify the part of the registry to use as the root of all entries. Valid
values are:
REG_CLASSES_ROOT
REG_CURRENT_USER
REG_LOCAL_MACHINE
REG_USERS
REG_PERFORMANCE_DATA
REG_CURRENT_CONFIG
REG_DYN_DATA
Example:
INCLUDE('ABUTIL.INC')
INIMgr INIClass
CODE
INIMgr.Init('c:\MyApp\MyApp.INI') !read & write from c:\MyApp\MyApp.INI
INIMgr.Init('.\MyApp.INI') !read & write from currentdirectory\MyApp.INI
INIMgr.Init('') !read & write from c:\Windows\WIN.INI
INIMgr.Init('MyApp.INI') !read & write from c:\Windows\MyApp.INI
INIMgr.Init('CONFIG.TPS',NVD_Table)
!read & write from a local table
Example:
Color BYTE
DefaultColor EQUATE(5)
CODE
Color=INIMgr.TryFetch('Preferences','Color') !return 'Color', no default
IF NOT Color
Color=DefaultColor
END
796 ABC Library Reference
TryFetchField assumes the entry value is a comma delimited string of the form V1,V2,...,Vn. A
field value of one (1) returns the value prior to the first comma in the string; a value of two (2)
returns the value between the first and second commas; a three (3) returns the value between the
second and third commas, etc.
Example:
Sound STRING(3)
Volume BYTE
CODE
Sound=INIMgr.TryFetchField('Preferences','Sound&Volume',1)
!get Sound value
IF NOT Sound !if not present
Sound='ON' !default to on
END
Volume=INIMgr.TryFetchField('Preferences','Sound&Volume',2)
!get Volume value
IF NOT Volume !if not present
Volume=3 !default to 3
END
!program code
INIMgr.Update('Preferences','Sound&Volume', | !create INI entry like
CLIP(Sound)&','&Volume) !Sound&Volume=ON,3
IReportGenerator Interface 797
| window |
The Update method writes entries to the INI file. If the specified value is null (''), the existing entry
is deleted.
Update(section,entry,value)
Writes a single value specified by section and entry to the INI file
specified in the INIClass.FileName property.
Update(section,entry,value,filename)
Writes a single value specified by section and entry to the INI file
specified by filename.
Update(section,window)
Writes several WINDOW position and size attributes to the INI
file specified in the INIClass.FileName property, for retrieval by a
subsequent corresponding call to Fetch(section,window).
Restoring the values returns the specified WINDOW to its saved
position and size.
Update(queue, field, [field], [field] )
Writes the records of a QUEUE with a maximum of three fields to
the INI file specified in the INIClass.FileName property.
Implementation: If a window is present, the Update method writes five entries to the specified INI
file section: Maximize, XPos, YPos, Height, and Width. These entries are
retrieved and applied by the Fetch method to restore the window's postion and
size.
Example:
Sound STRING('ON ')
PWindow WINDOW('Preferences'),AT(,,89,34),IMM,MAX,RESIZE
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
OPEN(PWindow)
INIMgr.Fetch('Preferences',PWindow) !restore PWindow size & position
INIMgr.Fetch('Preferences','Sound',Sound) !get 'Sound' entry
!program code
INIMgr.Update('Preferences','Sound',Sound) !save 'Sound' entry
INIMgr.Update('Preferences','Sound',Sound,'MYAPP.INI') !save 'Sound' entry to INI
INIMgr.Update('Preferences',PWindow) !save PWindow size & position
IReportGenerator Interface
IReportGenerator Interface
IReportGenerator Concepts
The IReportGenerator interface is a defined set of commands that are implemented by various
report output generators. This interface is not intended to be called by any code other than the
WMFParser.
IReportGenerator Methods
AskProperties (pop up window to set properties)
AskProperties( ), BYTE
CloseDocument Called after the document is printed, and returns an appropriate error
level.
The CloseDocument method is used to detect any error level state that may exist after the
document has been printed. CloseDocument returns Level:Benign if the document printed
normally.
ClosePage Called after each page is printed to detect a possible error condition.
The ClosePage method is used to detect any error state that may exist after each page
(WMF file) has been printed. ClosePage returns Level:Benign if the page printed
successfully.
Implementation: Called immediately after each WMF page has been printed.
The GetProperty method returns a value of the current document property. These properties are
defined in the documentation for each ReportGenerator object (i.e., the HTML report generator
contains a list of supported properties).
OpenDocument Called before the document is printed, and posts any error level code
that may have occurred during initialization.
The OpenDocument method is used to detect any error state that may exist before the
document has been printed. If the document is ready to print, OpenDocument returns a
Level:Benign
OpenPage Called before each page is printed to detect if an error has occured.
The OpenPage method is used to detect an error level state that may exist before each
page (WMF file) has been printed. If the page is ready to be printed, OpenPage returns
Level:Benign.
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.
IReportGenerator Interface 803
The ProcessArc method prints an arc of an ellipse to the appropriate document format. The
comment parameter is used to send the appropriate formatting information to the target document
type, and is limited to 2056 characters. (See COMMENT)
Implementation: The arc group contains the position and style of the arc from the contents of the
passed ArcFormatGrp.
The ProcessBand method is used to process all report bands and redirect to an
alternative document where appropriate If the position attribute is TRUE (1), the start of
each band is processed. If the position attribute is FALSE (0), the start of each band is
processed.
The ProcessCheck method prints a check box to the appropriate document format. The
comment parameter is used to send the appropriate formatting information to the target document
type, and is limited to 2056 characters. (See COMMENT)
Implementation: The check group contains the position, style, text, and check box state from the
contents of the passed CheckFormatGrp.
IReportGenerator Interface 805
The ProcessChord method prints a section of an ellipse to the appropriate document format.
The comment parameter is used to send the appropriate formatting information to the target
document type, and is limited to 2056 characters. (See COMMENT)
Implementation: The chord group contains the position and style of the chord from the contents of
the passed ChordFormatGrp.
The ProcessEllipse method prints an ellipse control to the appropriate document format. The
comment parameter is used to send the appropriate formatting information to the target document
type, and is limited to 2056 characters. (See COMMENT)
Implementation: The ellipse group contains the position and style of the ellipse control from the
contents of the passed EllipseFormatGrp.
The ProcessImage method prints an image control to the appropriate document format. The
comment parameter is used to send the appropriate formatting information to the target document
type, and is limited to 2056 characters. (See COMMENT)
Implementation: The image group contains the position and stretch mode (centered, tiled,
stretched) of the image control from the contents of the passed ImageFormatGrp.
IReportGenerator Interface 807
The ProcessOption method prints an option control to the appropriate document format. The
comment parameter is used to send the appropriate formatting information to the target document
type, and is limited to 2056 characters. (See COMMENT)
Implementation: The option group contains the position and other atrributes of the option control
from the contents of the passed OptionFormatGrp.
808 ABC Library Reference
Implementation: The radio group contains the contents, position (outer, inner) and radio state of
the radio control from the contents of the passed RadioFormatGrp.
Implementation: The rect group contains the position, style, and other attributes of the BOX
control from the contents of the passed RectFormatGrp.
IReportGenerator Interface 809
Implementation: The txtgrp group contains the position, alignment, styles, and other attributes of a
TEXT or STRING control from the contents of the passed TextFormatGrp.
810 ABC Library Reference
The SetProperty method sets a value of the named document property. These properties are
defined in the documentation for each ReportGenerator object (i.e., the HTML report generator
contains a list of supported properties).
Implementation: Returns the value of the IAm property initialized in the ReportGenerator object’s
constructor.
LocatorClass
LocatorClass Overview
The LocatorClass is an abstract class--it is not useful by itself. However, other useful classes are
derived from it and other structures (such as the BrowseClass) use it to reference its derived
classes.
LocatorClass Concepts
The classes derived from LocatorClass let you specify a locator control and a sort field on which
to search for each sort order of a BrowseClass object. These LocatorClass objects help the
BrowseClass locate and scroll to the requested items.
LocatorClass objects implement some of the common variations in locator controls (none,
STRING, ENTRY), locator invocation (keystroke, ENTER key, TAB key), and search methods
(single character search starting from current item, incremental character, exclusive search) that
occur in the browse context.
The BrowseClass optionally uses the classes derived from the LocatorClass. Therefore, if your
BrowseClass objects use a locator, then your program must instantiate a LocatorClass for each
use.
Step Locator
Use a Step Locator when the search field is a STRING, CSTRING, or PSTRING, a single
character search is sufficient (a step locator is not appropriate when there are many key
values that begin with the same character), and you want the search to take place
immediately upon the end user's keystroke. Step Locators are not appropriate for
numeric keys.
Entry Locator
Use an Entry Locator when you want a multi-character search (more precise) on numeric
or alphanumeric keys and you want to delay the search until the user accepts the locator
control. The delayed search reduces network traffic and provides a smoother search in a
client-server environment.
812 ABC Library Reference
ncremental Locator
Use an Incremental locator when you want a multi-character search (more precise) on
numeric or alphanumeric keys and you want the search to take place immediately upon
the end user's keystroke.
Filter Locator
Use a Filter Locator when you want a multi-character search (more precise) on
alphanumeric keys and you want to minimize network traffic.
LocatorClass Properties
The LocatorClass has the several properties described below. These properties are inherited by
classes derived from the LocatorClass.
Control SIGNED
The Control property contains the locator control number if there is a locator control. If there is no
locator control, it contains zero (0). The LocatorClass uses the Control property to refresh the
control or change its properties.
FreeElement ANY
The FreeElement property contains a reference to a component of the sort sequence of the
searched data set. The ABC Templates further require this to be a free component of a key. A
free component is one that is not range limited to a single value. Typically this is also the USE
variable of the locator control. The LocatorClass uses the FreeElement property to prime the free
component with the appropriate search value.
NoCase BYTE
The NoCase property determines whether the LocatorClass object performs case sensitive
searches or case insensitive searches.
Implementation: If NoCase contains a non-zero value, the search is not case sensitive. That is,
searches for "Tx," "tx," or "TX" all produce the same result. If NoCase contains a
value of zero (0), the search is case sensitive.
ViewManager &BrowseClass
The ViewManager property is a reference to the BrowseClass object that the LocatorClass object
is working for. See ViewManager and BrowseClass for more information. The LocatorClass uses
this property to manipulate the searched data set as well as the displayed LIST.
LocatorClass Methods
The LocatorClass contains the following methods.
Implementation: The Init method sets the values of the Control, FreeElement, NoCase, and
ViewManager properties.
Example:
BRW1::Sort1:Locator.Init(,CUST:StateCode,1) !without locator control
BRW1::Sort2:Locator.Init(?CUST:CustMo,CUST:CustNo,1)!with locator control
Reset, VIRTUAL
The Reset method is a virtual placeholder method to reset the locator for the next search.
Example:
BrowseClass.TakeAcceptedLocator PROCEDURE !process an accepted locator entry
CODE
IF ~SELF.Sort.Locator &= NULL AND ACCEPTED() = SELF.Sort.Locator.Control
IF SELF.Sort.Locator.TakeAccepted() !call locator take accepted method
SELF.Reset(1) !if search needed, reset the view
SELECT(SELF.ListControl) !focus on the browse list control
SELF.ResetQueue( Reset:Done ) !reload the browse queue
SELF.Sort.Locator.Reset !reset the locator
SELF.UpdateWindow !update (redraw) the window
END
END
Set, VIRTUAL
The Set method prepares the locator for a new search.
Example:
MyBrowseClass.TakeScroll PROCEDURE( SIGNED Event )
CODE
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 !after a scroll event
IF ~SELF.Sort.Locator &= NULL THEN !if locator is present
SELF.Sort.Locator.Set !set it to blank
END
SetEnabled( enabled )
Example:
MyBrowseClass.Enable PROCEDURE
CODE
IF ~SELF.Sort.Locator &= NULL !if locator is present
SELF.Sort.Locator.SetEnabled(RECORDS(SELF.ListQueue)) !disable locator if 0 items
END
TakeAccepted, VIRTUAL
The TakeAccepted method processes the accepted locator value and returns a value indicating
whether the browse list display must change. The TakeAccepted method is only a placeholder
method for classes derived from LocatorClass--EntryLocatorClass, FilterLocatorClass, etc.
This method is only appropriate for LocatorClass objects with locator controls that accept user
input; for example, entry controls, combo controls, or spin controls.
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.
TakeKey, VIRTUAL
The TakeKey method processes an alerted keystroke for the LIST control and returns a value
indicating whether the browse list display must change.
Tip: By default, all alphanumeric keys are alerted for LIST controls.
The TakeKey method is only a placeholder method for classes derived from
LocatorClass--StepLocatorClass, EntryLocatorClass, IncrementalLocatorClass,
etc.
UpdateWindow, VIRTUAL
The UpdateWindow method redraws the locator control with its current value.
MsgBoxClass
MsgBoxClass Overview
The MsgBoxClass provides a message window to the ErrorClass. This class manages the
display of the current error.
MsgBoxClass Properties
The The MsgBoxClass inherits all the properties of the WindowManager class from which it is
derived. In addition to the inherited properties, the MsgBoxClass contains the following
properties:
HistoryHandler &WindowComponent
The HistoryHandler property is a reference to the WindowComponent interface.
MsgRVal LONG
The MsgRVal property is a long value that is the return value from the message box. The
MsgBox.Init method sets this property to the Default window button.
MsgBoxClass Methods
The MsgBoxClass inherits all the methods of the WindowManager from which it is derived. In
addition to the inherited methods, the MsgBoxClass contains the methods listed below.
FetchStdButton(feq)
The FetchStdButton determines which of the windows standard buttons was pressed. The FEQ
of the button is returned.
Kill
The Kill method disposes any memory allocated during the object's lifetime and performs any
other necessary termination code.
828 ABC Library Reference
PopupClass
PopupClass Overview
The PopupClass object defines and manages a full featured popup (context) menu. The
PopupClass object makes it easy to add fully functional popup menus to your procedures.
PopupClass Concepts
You can set the popup menu items to mimic existing buttons on a window, so that associated
menu item text matches the button text, is enabled only when the button is enabled, and, when
selected, invokes the button action.
Alternatively, you can set the popup menu item to POST a particular event or simply return its ID
so you can trap it and custom code the item's functionality.
The PopupClass optionally uses the TranslatorClass so you can translate menu text to other
languages without changing your popup menu code. The PopupClass optionally uses the
INIClass to save and restore menu definitions to a configuration (.INI) file. Neither class is
required by the PopupClass; however, if you use either facility, you must instantiate them in your
program. See the Conceptual Example.
The ASCIIViewerClass, BrowseClass, and PrintPreviewClass all use the PopupClass to manage
their popup menus. This PopupClass use is automatic when you INCLUDE the class header
(ABASCII.INC, ABBROWSE.INC, or ABPRINT.INC) in your program's data section.
830 ABC Library Reference
The class is named PopupMgr# where # is the instance number of the Popup code template. The
templates provide the derived class so you can use the Popup code template Classes tab to
easily modify the popup menu behavior on an instance-by-instance basis.
The template generated code does not reference the PopupClass objects encapsulated within the
ASCIIViewerClass, BrowseClass, and PrintPreviewClass.
The PopupClass source code is installed by default to the Clarion \LIBSRC folder. The
PopupClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a PopupClass object.
This example displays a dialog with a right-click popup menu that mimics the dialog buttons with
three different PopupClass techniques. The dialog buttons demonstrate the PopupClass' ability to
save and restore menus to and from an INI file.
PROGRAM
MAP
END
INCLUDE('ABPOPUP.INC') !declare PopupClass
INCLUDE('ABUTIL.INC') !declare INIClass & Translator
INCLUDE('KEYCODES.CLW') !declare right-click EQUATE
ACCEPT
CASE EVENT()
OF EVENT:AlertKey !trap for alerted keys
IF KEYCODE() = MouseRight !if right-click
832 ABC Library Reference
PopupClass Properties
The PopupClass contains the properties described below.
ClearKeycode BYTE
The ClearKeycode property determines whether the PopupClass object clears the (MouseRight)
value from the KEYCODE() "buffer" before invoking the selected menu item's action. A value of
one (1 or True) sets the KEYCODE() "buffer" to zero; a value of zero (0 or False) leaves the
KEYCODE() "buffer" intact. See KEYCODE and SETKEYCODE in the Language Reference for
more information.
Tip: The uncleared KEYCODE() value can cause the popup menu to reappear in some
circumstances; therefore we recommend setting the ClearKeycode property to
True.
Implementation: The ABC Templates set the ClearKeycode property to True by default. The Ask
method implements the action specified by the ClearKeycode property.
PopupClass Methods
The PopupClass contains the 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:
Mainstream Use:
Ask display and process the popup menu
GetItemChecked return toggle item status
GetItemEnabled return item status
SetItemCheck set toggle item status
SetItemEnable set item status
Occasional Use:
DeleteItem remove menu item
GetLastSelection return last selected item
SetTranslator set run-time translator
Save save a menu for restoration
SetLevel set menu item hierarchy level
SetText set menu item text
Restore restore a saved menu
Virtual Methods
You set the action taken for each menu item with the AddItemMimic or AddItemEvent methods, or
with your own custom code. These methods (and your code) must refer to the menu items by
name (not by text).
AddItem(text)
Adds a single menu item at the end of the menu. The item name
is derived.
AddItem(text, name)
Adds a single menu item at the end of the menu with the name
specified.
AddItem(text, name, position, level)
Adds a single menu item following item position, at level level,
with name specified.
Each derived menu item name is the same as its text minus any special characters. That is, the
name contains only characters 'A-Z', 'a-z', and '0-9'. If the resulting name is not unique, the
PopupClass appends a sequence number to the name to make it unique.
836 ABC Library Reference
Example:
PopupMgr.AddItem('Save Popup') !add menu item named SavePopup
PopupMgr.AddItem('Save Popup','Save') !add menu item named Save
PopupMgr.AddItem('-','Separator') !add a separator
PopupMgr.AddItem('Restore Popup','Restore','Save',1)!add Restore item after Save item
Implementation: The Ask method traps the selected item and POSTs the event.
Example:
PopupMgr.AddItem('Close (control event)','Close') !add a menu item: Close
PopupMgr.AddItemEvent('Close',EVENT:Accepted,?Close)!Close POSTs event to a control
PopupMgr.AddItem('Close (window event)','Close2') !add a menu item: Close2
PopupMgr.AddItemEvent('Close2',EVENT:CloseWindow,0) !Close2 POSTs independent event
Implementation: The Ask method traps the selected item and POSTs an EVENT:Accepted to the
button.
Example:
PopupMgr.AddItem('Save Popup','Save') !add menu item: Save
PopupMgr.AddItemMimic('Save',?Save) !Save item mimics ?Save button
PopupMgr.AddItemMimic('Insert',?Insert) !add Insert item & mimic ?Insert button
You set the action taken for each menu item with the AddItemMimic or AddItemEvent methods, or
with your own custom code. These methods (and your code) must refer to the menu items by
name (not by text).
Implementation: The AddMenu method optionally replaces any previously defined menu for this
PopupClass object. The Ask method displays the popup menu and returns the
selected item's name.
The Popup class object derives the menu item name from its text. Each derived
item name is the same as its text minus any special characters. That is, the
name contains only characters 'A-Z', 'a-z', and '0-9'. If the resulting name is not
unique, the PopupClass appends a sequence number to the name to make it
unique.
Example:
MenuChoices EQUATE('&Save Menu|&Restore Menu|-|&Close')!declare menu definition string
CODE
PopupMgr.AddMenu(MenuChoices) !add Popup menu
PopupMgr.AddItemMimic('SaveMenu',?Save) !SaveMenu mimics ?Save button
PopupMgr.AddItemEvent('Close',EVENT:Accepted,?Close) !Close POSTs event to a control
!program code
IF PopupMgr.Ask() = 'RestoreMenu' !if RestoreMenu item selected
PopupMgr.Restore('MyMenu') !code your own functionality
ELSE !if any other item selected
END !Ask automatically handled it
Implementation: The Ask method displays the popup menu and returns the selected item's name.
The Popup class object derives the menu item name from its text. Each derived
item name is the same as its text minus any special characters. That is, the
name contains only characters 'A-Z', 'a-z', and '0-9'. If the resulting name is not
unique, the PopupClass appends a sequence number to the name to make it
unique. The text parameter accepts up to 1,024 characters; the selections
parameter accepts up to 10,000 characters.
Example:
MenuChoices EQUATE('&Insert|&Change|&Delete') !declare menu definition string
SubChoices EQUATE('{{by &name|by &ZIP code}') !declare submenu definition
CODE
PopupMgr.AddMenu(MenuChoices) !add Popup menu
PopupMgr.AddSubMenu('&Print',SubChoices,'Delete')!add Print submenu after delete
CASE PopupMgr.Ask() !display popup menu
OF ('Insert') ;DO Update(1) !process end user choice
OF ('Change') ;DO Update(2) !process end user choice
OF ('Delete') ;DO Update(3) !process end user choice
OF ('byname') ;DO PrintByName !process end user choice
OF ('byZIPcode') ;DO PrintByZIP !process end user choice
END
Example:
MenuChoices EQUATE('&Save Menu|&Restore Menu|-|&Close')!declare menu definition string
CODE
PopupMgr.AddMenu(MenuChoices) !add Popup menu
PopupMgr.AddItemMimic('SaveMenu',?Save) !SaveMenu mimics ?Save button
PopupMgr.AddItemEvent('Close',EVENT:Accepted,?Close) !Close POSTs event to a control
!program code
IF PopupMgr.Ask() = 'RestoreMenu' !if RestoreMenu item selected
PopupMgr.Restore('MyMenu') !code your own functionality
ELSE !if any other item selected
END !Ask automatically handled it
DeleteItem( name )
Example:
PopupMgr.AddItem('&Insert','Insert') !Insert item
PopupMgr.AddItem('&Change','Change') !Change item
PopupMgr.AddItem('&Delete','Delete') !Delete item
PopupMgr.AddItem('&Select','Select') !Select item
IF No_Records_Found
PopupMgr.DeleteItem('Change') !remove change item
PopupMgr.DeleteItem('Delete') !remove delete item
PopupMgr.DeleteItem('Select') !remove select item
END
DeleteMenu( name )
DeleteMenu Deletes a popup submenu item, and all associated child items.
name A string constant, variable, EQUATE, or expression containing the submenu item
name. The AddMenu method set the item name.
The DeleteMenu method deletes a popup submenu item and any associated child items.
Example:
PopupMgr.AddItem('&Insert','Insert') !Insert item
PopupMgr.AddItem('&Change','Change') !Change item
PopupMgr.AddItem('&Delete','Delete') !Delete item
PopupMgr.AddItem('&Select','Select') !Select item
IF No_Records_Found
PopupMgr.DeleteItem('Change') !remove change item
PopupMgr.DeleteItem('Delete') !remove delete item
PopupMgr.DeleteItem('Select') !remove select item
PopupMgr.DeleteMenu('Format List') !remove select sub menu
END
GetItemChecked( name )
Example:
IF PopupMgr.Ask() = 'Disable' !if Disable item selected
IF PopupMgr.GetItemChecked('Disable') !if item is checked/on
PopupMgr.SetItemCheck('Disable',False) ! toggle it off
ENABLE(?Save) ! take appropriate action
ELSE !if item is not checked/off
PopupMgr.SetItemCheck('Disable',True) ! toggle it on
DISABLE(?Save) ! take appropriate action
END
END
GetItemEnabled( name )
Example:
IF PopupMgr.GetItemEnabled('Save') !if item is enabled
PopupMgr.SetItemEnable('Save',False) ! disable it
ELSE !if item is disabled
PopupMgr.SetItemEnable('Save',True) ! enable it
END
The onlyitems parameter (DEFAULT=0) specifies that only the number of popup items is
returned. If non-zero, GetItems also returns the depth (nested) levels of the popup menu.
Example:
IF Popup.GetItems() ! Only if there are previous items.
Popup.AddItem('-','Separator1',Popup.GetItems(),1)
END
GetLastSelection
The GetLastSelection method returns the name of the last selected item.
The AddItem, AddItemMimic, AddMenu, or AddSubMenu method sets the item name.
Example:
MenuChoices EQUATE('Fred|Barney|Wilma') !declare menu definition string
CODE
PopupMgr.AddMenu(MenuChoices) !add Popup menu
!program code
PopupMgr.Ask() !display menu
MESSAGE('Thank you for choosing '&PopupMgr.GetLastSelection)
Init( [INIClass] )
Example:
PopupMgr PopupClass !declare PopupMgr object
INIMgr INIClass !declare INIMgr object
CODE
PopupMgr.Init(INIMgr) !initialize PopupMgr object
PopupMgr.AddItem('Save Popup','Save') !add menu item: Save
PopupMgr.AddItemMimic('Save',?Save) !Save item mimics ?Save button
Kill
The Kill method frees any memory allocated during the life of the PopupClass object and
performs any other required termination code.
Example:
PopupMgr.Init !initialize PopupMgr object
!program code
PopupMgr.Kill !shut down PopupMgr object
PopupClass 849
Restore( menu )
Implementation: The Restore method requires an INIClass object. The Init method specifies the
INIClass object.
Example:
PopupMgr PopupClass !declare PopupMgr object
INIMgr INIClass !declare INIMgr object
MenuChoices EQUATE('&Save Menu|&Restore Menu|-|&Close')!declare menu definition
CODE
PopupMgr.Init(INIMgr) !initialize PopupMgr object
PopupMgr.AddMenu(MenuChoices) !add Popup menu
ACCEPT
CASE FIELD()
OF ?Save
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Save('MyPopup') !save menu definition to INI
END
OF ?Restore
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Restore('MyPopup') !restore menu from INI
END
END
END
Save( menu )
Implementation: The Save method requires an INIClass object. The Init method specifies the
INIClass object.
Example:
PopupMgr PopupClass !declare PopupMgr object
INIMgr INIClass !declare INIMgr object
MenuChoices EQUATE('&Save Menu|&Restore Menu|-|&Close')!declare menu definition
CODE
PopupMgr.Init(INIMgr) !initialize PopupMgr object
PopupMgr.AddMenu(MenuChoices) !add Popup menu
ACCEPT
CASE FIELD()
OF ?Save
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Save('MyPopup') !save menu definition to INI
END
OF ?Restore
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Restore('MyPopup') !restore menu from INI
END
END
END
iconname A string constant, variable, EQUATE, or expression containing the name of the
icon to attach to the menu item.
The SetIcon method sets the icon of a popup menu item. The AddItem or AddSubItem
methods adds the menu item to the popup.
Example:
LOOP sm = 1 to RECORDS(QQ)
GET(QQ,sm)
pID = Popup.AddItem(CLIP(QQ.Item) & ' ',Clip(QQ.Item),pID,2)
Popup.SetIcon(pID,SELF.QkIcon)
Popup.AddItemEvent(pID,EVENT:NewSelection,QueryControl)
SELF.PopupList.PopupID = pID
SELF.PopupList.QueryName = QQ:Item
ADD(SELF.PopupList)
END
852 ABC Library Reference
Example:
IF PopupMgr.Ask() = 'Disable' !if Disable item selected
IF PopupMgr.GetItemChecked('Disable') !if item is checked/on
PopupMgr.SetItemCheck('Disable',False) ! toggle it off
ENABLE(?Save) ! take appropriate action
ELSE !if item is not checked/off
PopupMgr.SetItemCheck('Disable',True) ! toggle it on
DISABLE(?Save) ! take appropriate action
END
END
SetItemEnable( name )
Example:
IF PopupMgr.GetItemEnabled('Save') !if item is enabled
PopupMgr.SetItemEnable('Save',False) ! disable it
ELSE !if item is disabled
PopupMgr.SetItemEnable('Save',True) ! enable it
END
Example:
PopupMgr.SetLevel('Save',2)
Example:
PopupMgr.SetText('Save','&Save')
Implementation: The SetToolbox method is used with the BrowseClass SetAlerts method when
the BrowseClass ToolControl property is set to TRUE.
Example:
IF SELF.ToolControl
SELF.Popup.AddItem('-')
SELF.Popup.SetToolbox(SELF.Popup.AddItemMimic(DefaultToolName,|
SELF.ToolControl,'!'&DefaultToolName),0)
END
Toolbox
PopupClass 857
SetTranslator( translator )
Implementation: The Ask method uses the TranslatorClass object to translate popup menu text
before displaying it.
Example:
PopupMgr PopupClass !declare PopupMgr object
Translator TranslatorClass !declare Translator object
Toolbox( name )
name A string constant, variable, EQUATE, or expression containing the toolbox name.
This name will appear in the title bar of the toolbox window.
The Toolbox method displays the toolbox popup window. All items enabled by the
SetToolbox method are displayed as buttons, with the name parameter appearing in the
toolbox window’s title bar.
Implementation: The Toolbox method is called from the BrowseClass TakeEvent method when
the ToolControl property is set to TRUE. It is used to support the BrowseToolbar
control template.
Example:
BrowseClass.TakeEvent PROCEDURE
CASE ACCEPTED()
OF SELF.ToolControl
SELF.Popup.Toolbox('Browse Actions')
END
ViewMenu
The ViewMenu method displays information about the structure of the popup menu built up by
the various 'Add' methods.
Implementation: The ViewMenu method only works when the program is compiled with debug
information turned on.
860 ABC Library Reference
PrintPreviewClass 861
PrintPreviewClass
PrintPreviewClass Overview
The PrintPreviewClass is a WindowManager that implements a full-featured print preview dialog.
PrintPreviewClass Concepts
This print preview facility includes pinpoint zoom-in and zoom-out with configurable zoom
magnification, random and sequential page navigation, plus thumbnail views of each report page.
You can even specify how many rows and columns of thumbnails the print preview facility
displays.
When you finish viewing the report, you can send it directly to the printer for immediate What You
See Is What You Get (WYSIWYG) printing.
The PrintPreviewClass previews reports in the form of a Windows metafile (.WMF) per report
page. The PREVIEW attribute generates reports in Windows metafile format, and the Clarion
Report templates provide this capability as well. See PREVIEW in the Language Reference for
more information, and see Procedure Templates--Report for more information on Report
templates.
The PrintPreviewClass is derived from the WindowManager class (see Window Manager Class
for more information).
The ASCIIPrintClass and the ReportManager use the PrintPreviewClass to provide a print
preview facility.
862 ABC Library Reference
The Report and Viewer Procedure templates and the Report Wizard Utility template automatically
generate all the code and include all the classes necessary to provide the print preview facility for
your application's reports.
These Report templates instantiate a PrintPreviewClass object called Previewer for each report
procedure in the application. This object supports all the functionality specified in the Preview
Options section of the Report template's Report Properties dialog. See Procedure Templates--
Report for more information.
The template generated ReportManager object (ThisWindow) "drives" the Previewer object, so
generally, the only references to the Previewer object within the template generated code are to
initially configure the Previewer's properties.
The PrintPreviewClass source code is installed by default to the Clarion \LIBSRC folder. The
PrintPreviewClass source code and its respective components are contained in:
Zoom Configuration
The user interface text and the standard zoom choices the PrintPreviewClass displays at runtime
are defined in the ABREPORT.TRN file. To modify or customize this text or the standard zoom
choices, simply back up the ABREPORT.TRN file then edit it to suit your needs. See ZoomIndex
for more information.
PrintPreviewClass 863
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a PrintPreviewClass object and some related objects.
This example uses the PrintPreviewClass object to preview a very simple report before printing it.
The program specifies an initial position and size for the print preview window and allows custom
zoom factors.
PROGRAM
GlobalErrors ErrorClass
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
report REPORT,AT(1000,1542,6000,7458),PRE(RPT),FONT('Arial',10,,),THOUS
HEADER,AT(1000,1000,6000,542),FONT(,,,FONT:bold)
STRING('Customers'),AT(2000,20),FONT(,14,,)
STRING('Id'),AT(52,313),TRN
STRING('Name'),AT(2052,313),TRN
STRING('State'),AT(4052,313),TRN
END
detail DETAIL,AT(,,6000,281),USE(?detail)
STRING(@n-14),AT(52,52),USE(CUS:CUSTNO)
STRING(@s30),AT(2052,52),USE(CUS:NAME)
STRING(@s2),AT(4052,52),USE(CUS:State)
END
FOOTER,AT(1000,9000,6000,219)
STRING(@pPage <<<#p),AT(5250,31),PAGENO,USE(?PageCount)
END
END
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(PctDone),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?TxtDone),CENTER
BUTTON('Cancel'),AT(45,42),USE(?Cancel)
END
OPEN(ProgressWindow)
SELF.Opened=True
CusReport.Init(CusView,Relate:Customer,?TxtDone,PctDone,RECORDS(Customer))
CusReport.AddSortOrder(CUS:BYNUMBER)
SELF.AddItem(?Cancel,RequestCancelled)
SELF.Init(CusReport,report,Previewer) !register Previewer with ThisProcedure
SELF.Zoom = PageWidth
Previewer.AllowUserZoom=True !allow custom zoom factors
Previewer.Maximize=True !initially maximize preview window
SELF.SetAlerts()
RETURN ReturnValue
ThisProcedure.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Customer.Close
Relate:Customer.Kill
GlobalErrors.Kill
RETURN ReturnValue
CusReport.TakeRecord PROCEDURE()
ReturnValue BYTE,AUTO
SkipDetails BYTE
CODE
ReturnValue = PARENT.TakeRecord()
PRINT(RPT:detail)
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 0
SELF.LazyOpen = False
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
866 ABC Library Reference
PrintPreviewClass Properties
The PrintPreviewClass contains properties that primarily allow configuration of the print preview
window and its features. The PrintPreviewClass properties are described below.
AllowUserZoom BYTE
The AllowUserZoom property indicates whether the PrintPreviewClass object provides user
zoom capability for the end user. The user zoom lets the end user apply any zoom factor. Without
user zoom, the end user may only apply the standard zoom choices.
The ZoomIndex property indicates whether a user zoom factor or a standard zoom factor is
applied.
Implementation: A value of one (1) enables user zoom capability; a value of zero (0) disables user
zoom. The UserPercentile property contains the user zoom factor.
ConfirmPages BYTE
The ConfirmPages property indicates whether or not the AskPrintPages method should be
called before printing.
Implementation: Zero (0) is the default; a value of one (1) forces the enduser to choose the pages
to print before the print job is sent to the printer.
CurrentPage LONG
The CurrentPage property contains the number of the selected report page. The
PrintPreviewClass object uses this property to highlight the selected report page when more than
one page is displayed, to navigate pages, and to dislay the current page number for the end user.
Maximize BYTE
The Maximize property indicates whether to open the preview window mazimized. A value of one
(1 or True) maximizes the window; a value of zero (0 or False) opens the window according to the
WindowSizeSet property.
PagesAcross USHORT
The PagesAcross property contains the number of thumbnail pages the PrintPreviewClass
object displays horizontally within the preview window. The PrintPreviewClass object uses this
property to calculate appropriate positions and sizes when displaying several pages at a time.
The PrintPreviewClass object displays the PagesAcross value at runtime and lets the end user
set the value as well.
868 ABC Library Reference
PagesDown USHORT
The PagesDown property contains the number of thumbnail pages the PrintPreviewClass object
displays vertically within the preview window. The PrintPreviewClass object uses this property to
calculate appropriate positions and sizes when displaying several pages at a time.
The PrintPreviewClass object displays the PagesDown value at runtime and lets the end user set
the value as well.
The default value is 1-n, where n is equal to the total number of pages in the report. Individual
pages can be printed by seperating page numbers by commas. A range of pages to print can be
specified by seperating the first page number to print and the last page number to print by a dash
(-). Combinations of individual pages and ranges of pages are allowed.
UserPercentile USHORT
The UserPercentile property contains the user specified zoom factor. The PrintPreviewClass
object solicits this factor from the end user and applies it to the selected report page when the
AllowUserZoom property is True. The SetZoomPercentile method sets the UserPercentile
property.
WindowPosSet BYTE
The WindowPosSet property contains a value indicating whether a non-default initial position is
specified for the print preview window. The PrintPreviewClass object uses this property to
determine the initial position of the print preview window.
Implementation: The SetPosition method sets the value of this property. A value of one (1)
indicates a non-default initial position is specified and is applied; a zero (0)
indicates no position is specified and the default position is applied.
See Also: SetPosition
WindowSizeSet BYTE
The WindowSizeSet property contains a value indicating whether a non-default initial size is
specified for theprint preview window. The PrintPreviewClass object uses this property to
determine the initial size of the print preview window.
Implementation: The SetPosition method sets the value of this property. A value of one (1)
indicates a non-default initial size is specified and is applied; a zero (0) indicates
no size is specified and the default size is applied.
ZoomIndex BYTE
The ZoomIndex property contains a value indicating which zoom factor is applied. The
PrintPreviewClass object uses this property to identify and apply the selected zoom factor. The
SetZoomPercentile method sets the ZoomIndex property.
Implementation: The ZoomIndex value "points" to one of the 7 standard zoom settings or to a user
zoom setting. The PrintPreviewClass object sets the ZoomIndex value when the
end user selects a zoom setting from one of the zoom menus or from the zoom
combo box. The standard zoom choices are defined in ABREPORT.TRN as
follows:
No Zoom Displays the specified number of pages
(PagesAcross and PagesDown properties) in a tiled
arrangement in the preview window.
Page Width Displays a single page whose width is the same as
the width of the preview window.
50% Displays a single page at 50% of actual print size.
75% Displays a single page at 75% of actual print size.
100% Displays a single page at 100% of actual print size.
200% Displays a single page at 200% of actual print size.
300% Displays a single page at 300% of actual print size.
A ZoomIndex value of zero (0) indicates a nonstandard zoom factor is specified.
Nonstandard zoom factors may be specified when the AllowUserZoom property
is True. The UserPercentile property contains the nonstandard zoom factor.
PrintPreviewClass Methods
The PrintPreviewClass contains the 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 two categories:
Occasional Use:
SetINIManager save and restore window coordinates
SetPosition set print preview position and size
SetZoomPercentile set user or standard zoom factor
Virtual Methods
Typically you will not call these methods directly--the Display method calls 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 PrintPreviewClass.Display method calls the AskPage method. The AskPage
method displays a dialog that prompts for a specific report page.
Example:
!Virtual implementation of AskPage: a simplified version with no translator...
PrintPreviewClass.AskPage FUNCTION
JumpPage LONG,AUTO
RVal BOOL(False)
Example:
!Virtual implementation of AskThumbnails
PrintPreviewClass.AskPrintPages PROCEDURE
Preserve LIKE(PrintPreviewClass.PagesToPrint),AUTO
Window WINDOW('Pages to Print'),AT(,,260,37),CENTER,SYSTEM,GRAY
PROMPT('&Pages to Print:'),AT(4,8),USE(?Prompt)
ENTRY(@s255),AT(56,4,200,11),USE(SELF.PagesToPrint, , ?PagesToPrint)
BUTTON('&Reset'),AT(116,20,45,14),USE(?Reset)
BUTTON('&Ok'),AT(164,20,45,14),USE(?Ok),DEFAULT
BUTTON('&Cancel'),AT(212,20,45,14),USE(?Cancel),STD(STD:Close)
END
RVal BYTE(False)
CODE
Preserve = SELF.PagesToPrint
OPEN(Window)
ACCEPT
CASE EVENT()
OF EVENT:Accepted
CASE ACCEPTED()
OF ?Cancel
SELF.PagesToPrint = Preserve
POST(EVENT:CloseWindow)
OF ?Ok
RVal = True
POST(EVENT:CloseWindow)
OF ?Reset
SELF.SetDefaultPages
SELECT(?PagesToPrint)
END
874 ABC Library Reference
OF EVENT:OpenWindow
! INIMgr code for FETCHing window settings
OF EVENT:CloseWindow
! INIMgr code for UPDATEing window settings
END
END
CLOSE(Window)
RETURN Rval
PrintPreviewClass 875
Example:
!Virtual implementation of AskThumbnails
! a slightly simplified version with no translator...
PrintPreviewClass.AskThumbnails PROCEDURE
CODE
OPEN(SelectWindow)
ACCEPT
CASE EVENT()
OF EVENT:Accepted
CASE FIELD()
OF ?OK
IF SELF.PagesAcross*SELF.PagesDown>RECORDS(SELF.ImageQueue)
SELECT(?PagesAcross)
ELSE
POST(EVENT:CloseWindow)
END
END
END
END
CLOSE(SelectWindow)
876 ABC Library Reference
Implementation: The SyncImageQueue method calls the DeleteImageQueue method. The value
contained in the PagesToPrint property determines which records and images
are deleted.
Example:
PrintPreviewClass.SyncImageQueue PROCEDURE
i LONG,AUTO
CODE
LOOP i = RECORDS(SELF.ImageQueue) TO 1 BY -1
IF ~SELF.InPageList(i)
SELF.DeleteImageQueue(i)
END
END
The Display method is the print preview engine. It manages the print preview, providing
navigation, zoom, thumbnail configuration, plus the option to immediately print the report.
Implementation: The Display method declares the preview WINDOW, then calls the
WindowManager.Ask method to display the preview WINDOW and process its
events. EQUATEs for the zoom parameter are declared in ABREPORT.INC:
NoZoom EQUATE(-2)
PageWidth EQUATE(-1)
In addition to the EQUATE values, you may specify any integer zoom factor, such as 50 (50%
zoom) or 200 (200% zoom).
Example:
IF ReportCompleted !if report was not cancelled
ENDPAGE(report) !force final page overflow
IF PrtPrev.Display() !preview the report on-line
report{PROP:FlushPreview} = True !and print it if user asked to
END
END
The image queue parameter names a QUEUE with the same structure as the
PreviewQueue declared in \ABREPORT.INC as follows:
PreviewQueue QUEUE,TYPE
Filename STRING(128)
END
Example:
PrintPreviewQueue PreviewQueue !declare report image queue
PrtPrev PrintPreviewClass !declare PrtPrev object
CODE
PrtPrev.Init(PrintPreviewQueue) !initialize PrtPrev object
!program code
PrtPrev.Kill !shut down PrtPrev object
PrintPreviewClass 879
InPageList( page )
Example:
PrintPreviewClass.SyncImageQueue PROCEDURE
i LONG,AUTO
CODE
LOOP i = RECORDS(SELF.ImageQueue) TO 1 BY -1
IF ~SELF.InPageList(i)
SELF.DeleteImageQueue(i)
END
END
Implementation: The Kill method calls the WindowManager.Kill method and returns Level:Benign
to indicate a normal shut down. Return value EQUATEs are declared in
ABERROR.INC.
Example:
PrintPreviewQueue PreviewQueue !declare report image queue
PrtPrev PrintPreviewClass !declare PrtPrev object
CODE
PrtPrev.Init(PrintPreviewQueue) !initialize PrtPrev object
!program code
PrtPrev.Kill !shut down PrtPrev object
Open, VIRTUAL
The Open method prepares the PrintPreviewClass window for initial display. It is designed to
execute on window opening events such as EVENT:OpenWindow and EVENT:GainFocus.
Implementation: The Open method sets the window's initial size and position, enables and
disables controls as needed, and sets up the specified zoom configuration.
Example:
ThisWindow.TakeWindowEvent PROCEDURE
CODE
CASE EVENT()
OF EVENT:OpenWindow
IF ~BAND(SELF.Inited,1)
SELF.Open
END
OF EVENT:GainFocus
IF BAND(SELF.Inited,1)
SELF.Reset
ELSE
SELF.Open
END
END
RETURN Level:Benign
SetINIManager Enables save and restore of preview window position and size between
computing sessions.
INI manager The label of the INIClass object that saves and restores window coordinates. See
INI Class for more information.
The SetINIManager method names an INIClass object to save and restore window coordinates
between computing sessions.
Implementation: The Open method uses the INI manager to restore the window's initial size and
position. The TakeEvent method uses the INI manager to save the window's size
and position.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
ThisWindow.Init(Process,report,Previewer)
Previewer.SetINIManager(INIMgr)
SetPosition Sets the initial position and size of the print preview window.
x An integer constant, variable, EQUATE, or expression containing the initial
horizontal position of the print preview window. If omitted, the print preview
window opens to the default Windows position.
y An integer constant, variable, EQUATE, or expression containing the initial
vertical position of the print preview window. If omitted, the print preview window
opens to the default Windows position.
width An integer constant, variable, EQUATE, or expression containing the initial width
of the print preview window. If omitted, the print preview window opens to its
default width.
height An integer constant, variable, EQUATE, or expression containing the initial height
of the print preview window. If omitted, the print preview window opens to its
default height.
The SetPosition method sets the initial position and size of the print preview window.
Implementation: The SetPosition method sets the WindowPosSet and WindowSizeSet properties.
The Display method definition determines the default width and height of the print
preview window.
Example:
PrtPrev.SetPosition(1,1,300,250) !set initial position and size
PrtPrev.SetPosition(1,1) !set initial position only
PrtPrev.SetPosition(,,300,250) !set initial size only
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
ThisWindow.Init(Process,report,Previewer)
Previewer.SetZoomPercentile(120)
SetDefaultPages, VIRTUAL
The SetDefaultPages method sets the initial value of the PagesToPrint property. The initial
value is 1-n, where n is equal to the total number of pages in the report.
Implementation: The Display and AskPrintPreview methods call the SetDefaultPages method.
Example:
!Virtual implementation of SetDefaultPages method
PrintPreviewClass.SetDefaultPages PROCEDURE
CODE
SELF.PagesToPrint = '1-' & RECORDS(SELF.ImageQueue)
SyncImageQueue, VIRTUAL
The SyncImageQueue method synconizes the image queue with the contents of PagesToPrint
to ensure that only the specified pages are sent to the printer.
Implementation: The Display method calls the SyncImageQueue method. The value contained in
the PagesToPrint property determines which pages are printed.
Example:
PrintPreviewClass.Display PROCEDURE
! Window declaration
! executable Display code
IF SELF.PrintOk
SELF.SyncImageQueue
END
RETURN SELF.PrintOK
Implementation: The TakeEvent method calls the TakeAccepted method. The TakeAccepted
method calls the WindowManager.TakeAccepted method, then processes
EVENT:Accepted events for all the controls on the preview window, including
zoom controls, print button, navigation controls, thumbnail configuration controls,
etc.
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
Implementation: The Ask method calls the TakeEvent method. The TakeEvent method calls the
WindowManager.TakeEvent method, then processes EVENT:CloseWindow,
EVENT:Sized and EVENT:AlertKey events for the preview window.
Example:
WindowManager.Ask PROCEDURE
CODE
IF SELF.Dead THEN RETURN .
CLEAR(SELF.LastInsertedPosition)
ACCEPT
CASE SELF.TakeEvent()
OF Level:Fatal
BREAK
OF Level:Notify
CYCLE ! Used for 'short-stopping' certain events
END
END
Implementation: The TakeEvent method calls the TakeFieldEvent method. The TakeFieldEvent
method processes EVENT:NewSelection events for the preview window SPIN
controls.
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
ProcessClass
ProcessClass Overview
The ProcessClass is a ViewManager with a progress window.
ProcessClass Concepts
The ProcessClass lets you "batch" process a VIEW, applying sort orders, range limits, and filters
as needed to process only the specific result set in the specific sequence you require; plus the
ProcessClass supplies appropriate (configurable) visual feedback to the end user on the progress
of the batch process.
The ProcessClass is derived from the ViewManager, plus it relies on many of the other
Application Builder Classes to accomplish its tasks. Therefore, if your program instantiates the
ProcessClass, it must also instantiate these other classes. Much of this is automatic when you
INCLUDE the ProcessClass header (ABREPORT.INC) in your program's data section. See the
Conceptual Example.
The ReportManager uses the ProcessClass to process report data and provide appropriate visual
feedback to the end user on the progress of the report.
The ABC Templates automatically include all the classes necessary to support the batch
processes (Process procedures and Report procedures) specified in your application.
The templates derive a class from the ProcessClass for each batch process (Process Procedures
and Report Procedures) in the application. The derived classes are called ThisProcess and
ThisReport. These derived ProcessClass objects support all the functionality specified in the
Process or Report procedure template.
The derived ProcessClass is local to the procedure, is specific to a single process and relies on
the global file-specific RelationManager and FileManager objects for the processed files.
The ProcessClass source code is installed by default to the Clarion \LIBSRC. The ProcessClass
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 ProcessClass object and related objects. This example processes selected
records in a file, updates them, and displays a window with a progress bar to show the progress
of the process.
PROGRAM
INCLUDE('ABWINDOW.INC') !declare WindowManager Class
INCLUDE('ABREPORT.INC') !declare Process Class
MAP
END
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),THREAD !declare Customer file
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
CusView VIEW(Customer) !declare VIEW for process
END
Access:Customer CLASS(FileManager) !declare Access:Customer object
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)!declare Relate:Customer object
Init PROCEDURE
END
ThisWindow CLASS(ReportManager) !declare ThisWindow object
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
ThisProcess CLASS(ProcessClass) !declare ThisProcess object
TakeRecord PROCEDURE(),BYTE,PROC,VIRTUAL
END
ProgressMgr StepLongClass !declare ProgressMgr object
GlobalErrors ErrorClass !declare GlobalErrors object
VCRRequest LONG(0),THREAD
Thermometer BYTE !declare PROGRESS variable
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Thermometer),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?PctText),CENTER
BUTTON('Cancel'),AT(45,42),USE(?Cancel)
END
CODE
ThisWindow.Run() !run the Process procedure
ProcessClass 893
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.LazyOpen = False
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
ProcessClass 895
ProcessClass Properties
The ProcessClass inherits all the properties of the ViewManager class from which it is derived.
See ViewManager Properties for more information.
In addition to the inherited properties, the ProcessClass contains the following properties:
CaseSensitiveValue BYTE
The CaseSensitiveValue property is set to zero (0 or False) when the key for the processed
FILE is a case insensitive key, i.e. the NOCASE attriute is on the key definition.
The Init method initializes the Percentile property. See the Conceptual Example.
PText SIGNED
The PText property contains the control number of a text based Window control such as a
STRING or PROMPT. The ProcessClass uses this control to provide visual feedback to the end
user.
The Init method initializes the PText property. See the Conceptual Example.
RecordsProcessed LONG
The RecordsProcessed property contains the number of elements processed so far. The
ProcessClass uses this property to calculate how much of the process is completed.
RecordsToProcess LONG
The RecordsToProcess property contains the total number of elements to process. The
ProcessClass uses this property to calculate how much of the process is completed.
ProcessClass 897
ProcessClass Methods
The ProcessClass inherits all the methods of the ViewManager class from which it is derived. See
ViewManager Properties for more information.
Non-Virtual Methods
Mainstream Use:
OpenI open the view
NextV get the next result set element
PreviousIV get the previous result set element
PrimeRecordI prepare a record for adding
ValidateRecordIV validate the current result set element
SetFilterI specify a filter for the active sort order
SetSortIV set the active sort order
ApplyFilterI range limit and filter the result set
ApplyOrderI sort the result set
ApplyRangeI conditionally range limit and filter the result set
CloseI close the view
Occasional Use:
GetFreeElementNameI return the free element field name
ResetV reposition to the first result set element
SetOrderIV replace the active sort order
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 assigns progress txt to the PText property, reference assigns
progress pct to the Percentile property, and assigns total records to the
RecordsToProcess property. The Init method calls the ViewManager Init method.
900 ABC Library Reference
Example:
!initialize the ProcessClass object
Process.Init( Process:View, | !set the VIEW
Relate:Client, | !set the primary file RelationManager
?PctText, | !set the Window control for text messages
PctDone, | !set the PROGRESS USE variable
ProgressMgr, | !set StepClass object to monitor progress
CLI:Name) !set StepClass free element to monitor
Kill, VIRTUAL
The Kill method shuts down the ProcessClass object by freeing any memory allocated during the
life of the object and executing any other required termination code.
Example:
!initialize the ProcessClass object
Process.Init( Process:View, | !set the VIEW
Relate:Client, | !set the primary file RelationManager
?PctText, | !set the Window control for text messages
PctDone, | !set the PROGRESS USE variable
ProgressMgr, | !set StepClass object to monitor progress
CLI:Name) !set StepClass free element to monitor
!procedure code
Process.Kill !shut down the ProcessClass object
Implementation: The Next method calls the ViewManager.Next method. The ProcessClass.Next
method updates both the RecordsProcessed property and the Percentile
property.
Example:
ACCEPT
CASE EVENT()
OF Event:OpenWindow
Process.Reset !position to first record
IF Process.Next() !get first record
POST(Event:CloseWindow) !if no records, shut down
CYCLE
END
OF Event:Timer !process records with timer
StartOfCycle=Process.RecordsProcessed
LOOP WHILE Process.RecordsProcessed-StartOfCycle<RecordsPerCycle
CASE Process.Next() !get next record
OF Level:Notify !if end of file
MESSAGE('Process Completed') ! tell end user
POST(EVENT:CloseWindow) ! and shut down
BREAK
OF Level:Fatal !if fatal error
POST(EVENT:CloseWindow) ! shut down
BREAK
END
END
END
END
Implementation: The Reset method resets the RecordsProcessed property to zero (0),
conditionally calls the SetProgressLimits method, then calls the
ViewManager.Reset method.
Example:
CASE EVENT()
OF Event:OpenWindow
Process.Reset !position to first record
IF Process.Next() !get first record
POST(Event:CloseWindow) !if no records, shut down
CYCLE
END
Example:
MyProcessClass.Reset PROCEDURE !prepare to process the records
CODE
SELF.RecordsProcessed = 0 !set RecordsProcessed to 0
SELF.SetProgressLimits !set StepClass boundaries based
! on actual data processed
PARENT.Reset !call ViewManager.Reset to
!position to the first record
TakeLocate, VIRTUAL
Example:
ThisWindow.TakeRecord PROCEDURE()
CODE
IF ORD:Date = TODAY()
PRINT(RPT:detail)
END
RETURN Level:Benign
QueryClass
QueryClass Overview
The QueryClass provides support for ad hoc queries against Clarion VIEWs. The query support
includes a flexible user input dialog, a broad variety of search capabilities, and seamless
integration with the BrowseClass. The QueryClass provides the following features:
QueryClass Concepts
Use the AddItem method to define a standard user input dialog at runtime. Or create a custom
dialog to plug into your QueryClass object. Use the Ask method to solicit end user query input or
use the SetLimit method to programmatically set query search values. Finally, use the GetFilter
method to build the filter expression to apply to your VIEW. You can apply the resulting filter with
the ViewManager.SetFilter method, or directly with the PROP:Filter property.
The BrowseClass automatically provides a default query dialog that solicits end user search
values for each field displayed in the browse list. See the Conceptual Example.
906 ABC Library Reference
Note that the WindowManager and BrowseClass objects internally handle the normal events
surrounding the query.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABQUERY.INC')
MAP
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
CustomerIDKey KEY(CUS:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CUS:LastName),NOCASE,OPT
Record RECORD,PRE()
ID LONG
LastName STRING(20)
FirstName STRING(15)
City STRING(20)
State STRING(2)
ZIP STRING(10)
END
END
908 ABC Library Reference
CustView VIEW(Customer)
END
CustQ QUEUE
CUS:LastName LIKE(CUS:LastName)
CUS:FirstName LIKE(CUS:FirstName)
CUS:ZIP LIKE(CUS:ZIP)
CUS:State LIKE(CUS:State)
ViewPosition STRING(1024)
END
CusWindow WINDOW('Browse Customers'),AT(,,210,105),IMM,SYSTEM,GRAY
LIST,AT(5,5,200,80),USE(?CusList),IMM,HVSCROLL,FROM(CustQ),|
FORMAT('80L(2)|M~Last~@s20@64L(2)|M~First~@s15@44L(2)|M~ZIP~@s10@')
BUTTON('&Zoom In'),AT(50,88),USE(?Query)
BUTTON('Close'),AT(90,88),USE(?Close)
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CusList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(?Close,RequestCancelled)
Relate:Customer.Open
BRW1.Init(?CusList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,ThisWindow)
OPEN(CusWindow)
SELF.Opened=True
Query.Init !initialize the Query object
QueryClass 909
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:CustomerIDKey,'CUS:CustomerIDKey',1)
SELF.AddKey(CUS:NameKey,'CUS:NameKey',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
910 ABC Library Reference
QueryClass Properties
The QueryClass contains the following properies:
QKCurrentQuery CSTRING(100)
The QKCurrentQuery property holds the value of the popup menu item if QuickQBE support is
enabled.
QKIcon CSTRING(255)
The QKIcon property holds the full pathname of the icon file to be used in the QuickQBE
submenu items.
QKMenuIcon CSTRING(255)
The QKMenuIcon property holds the full pathname of the icon file to be in the popup menu if
QuickQBE has been enabled.
QueryClass 911
QKSupport BYTE
The QKSupport property indicates that QuickQBE support is enabled.
Window &Window
The Window property is a reference to the QBE dialog window.
912 ABC Library Reference
QueryClass Methods
The QueryClass 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:
AskV a virtual to accept query criteria
GetFilter return filter expression
Occasional Use:
Reset reset the QueryClass object
GetLimit get searchvalues
SetLimit set search values
Virtual Methods
Typically you will not call these methods directly--other ABC Library 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.
Other QueryClass methods, such as GetLimit and SetLimit, refer to the queryable item by its
name.
Tip: You may use the BrowseClass.UpdateQuery method in combination with the
AddItem method to define a query interface that contains the BrowseClass fields
plus other queryable items.
914 ABC Library Reference
Example:
QueryForm QueryFormClass
QueryVis QueryFormVisual
BRW1 CLASS(BrowseClass)
Q &CusQ
END
CusWindow.Init PROCEDURE()
CODE
!open files, views, window, etc.
BRW1.UpdateQuery(QueryForm) !add browse fields to query
QueryForm.AddItem('UPPER(CUS:NAME)','Name') !add caseless name to query
QueryForm.AddItem('CUS:ZIP_CODE','Name') !add zip code to query
QueryForm.AddItem('ITM:Qty+ITM:Price','Total')!add dynamic total to query
END
RETURN Level:Benign
The GetFilter method generates filter expressions using the search values set by the Ask method.
Implementation: For each item that can be queried (added by the AddItem method), the Ask
method collects the query values from the selected item's file buffers rather
than from a query input dialog. This default behavior automatically gives you
query criteria (search values) for the current item without soliciting input from
the end user. This allows you to, for example, use a regular update form as a
special kind of query (QBE) form.
Example:
MyQueryForm.Ask PROCEDURE(BYTE UseLast) !derived class Ask method
W WINDOW('Example values'),CENTER,SYSTEM,GRAY !declare user input dialog
BUTTON('&OK'),USE(?Ok,1000),DEFAULT
BUTTON('Cancel'),USE(?Cancel,1001)
END
CODE
OPEN(W)
IF ~UseLast THEN SELF.Reset(). !preserve or discard prior query
IF SELF.Win.Run()=RequestCancelled !show dialog and handle events
RETURN Level:Benign !return Cancel indicator
ELSE
RETURN Level:Notify !return OK indicator
END
ClearQuery, PROTECTED
The ClearQuery method clears the listbox on the QueryVisual dialog that contains the currently
loaded query.
Note: The Clear Query method does not remove the ad hoc filter from a Browse
procedure. It only affects the query dialog used for managing a Browse's queries.
Example:
QueryClass.Take PROCEDURE(PopupClass P)
CODE
ASSERT(~P &= NULL)
IF SELF.QkSupport
SELF.QkCurrentQuery = P.GetLastSelection()
SELF.PopupList.PopupID = SELF.QkCurrentQuery
GET(SELF.PopupList,SELF.PopupList.PopupID)
IF Errorcode()
SELF.ClearQuery()
ELSE
SELF.Restore(SELF.PopupList.QueryName)
END
SELF.Save('tsMRU') ! Save Most recently used for Browse\Report query sharing.
RETURN 1
END
RETURN 0
Note: The Delete method is primarily designed for use by the QuickQBE functionality.
The GetFilter method generates filter expressions using the search values set by the Ask method,
the SetLimit method, or both.
Tip: By default, the Ask method only sets the equal to value; it does not set lower and
upper values.
The generated filter expression searches for values greater than lower, less than upper, and
equal to equal. For string fields, the GetFilter method applies the following special meanings to
these special search characters:
For example:
Example:
MyBrowseClass.TakeLocate PROCEDURE
CurSort USHORT,AUTO
I USHORT,AUTO
CODE
IF ~SELF.Query&=NULL AND SELF.Query.Ask() !get query input from end user
CurSort = POINTER(SELF.Sort) !save current sort order
LOOP I = 1 TO RECORDS(SELF.Sort)
PARENT.SetSort(I) !step thru each sort order
SELF.SetFilter(SELF.Query.GetFilter(),'9-QBE') !get filter expression from
Query
END ! and give it to Browse object
PARENT.SetSort(CurSort) !restore current sort order
SELF.ResetSort(1) !apply the filter expression
END
Implementation: The GetFilter method generates filter expressions using the search values.
The generated filter expression searches for values greater than lower, less
than upper, and equal to equal.
Example:
QueryClass.Ask PROCEDURE(BYTE UseLast=1)
I USHORT,AUTO
EV CSTRING(1000),AUTO
CODE
SELF.Reset
LOOP I = 1 TO RECORDS(SELF.Fields)
GET(SELF.Fields,I)
EV = CLIP(EVALUATE(SELF.Fields.Name))
IF EV
SELF.SetLimit(SELF.Fields.Name,,,EV)
END
END
RETURN Level:Notify
Init([queryvisual] [,inimanager,family,errormanage]
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
Reset( [ name ] )
Implementation: The Reset method calls the SetLimit method to clear the search values for
each queryable item.
Example:
MyQueryForm.Ask PROCEDURE(BYTE UseLast) !derived class Ask method
W WINDOW('Example values'),CENTER,SYSTEM,GRAY !declare user input dialog
BUTTON('&OK'),USE(?Ok,1000),DEFAULT
BUTTON('Cancel'),USE(?Cancel,1001)
END
CODE
OPEN(W)
IF ~UseLast THEN SELF.Reset(). !preserve or discard prior query
IF SELF.Win.Run()=RequestCancelled !show dialog and handle events
RETURN Level:Benign !return Cancel indicator
ELSE
RETURN Level:Notify !return OK indicator
Restore ( queryname )
Note: The Restore method is primarily designed for use by the QuickQBE functionality.
Save ( queryname )
Note: The save method is primarily designed for use by the QuickQBE functionality.
Implementation: The GetFilter method generates filter expressions using the search values
set by the Ask method, the SetLimit method, or both.
Tip: By default, the Ask method only sets the equal to value; it does not set lower and
upper values.
The generated filter expression searches for values greater than lower, less than upper, and
equal to equal. For string fields, the GetFilter method applies the following special meanings to
these special search characters:
QueryClass 927
For example:
Example:
QueryClass.Ask PROCEDURE(BYTE UseLast=1)
I USHORT,AUTO
EV CSTRING(1000),AUTO
CODE
SELF.Reset
LOOP I = 1 TO RECORDS(SELF.Fields)
GET(SELF.Fields,I)
EV = CLIP(EVALUATE(SELF.Fields.Name))
IF EV
SELF.SetLimit(SELF.Fields.Name,,,EV)
END
END
RETURN Level:Notify
Take ( popup )
Note: The take method is primarily designed for use by the QuickQBE functionality.
QueryFormClass
QueryFormClass Overview
The QueryFormClass is a QueryClass with a "form" user interface. The QueryFormClass
provides support for ad hoc queries against Clarion VIEWs. The form interface includes an entry
field, a prompt, and an equivalence operator (equal, not equal, greater than, etc.) button for each
queryable item.
QueryFormClass Concepts
Use the AddItem method to define a user input dialog at runtime. Or create a custom dialog to
plug into your QueryClass object. Use the Ask method to solicit end user query criteria (search
values) or use the SetLimit method to programmatically set query search values. Finally, use the
GetFilter method to build the filter expression to apply to your VIEW. Use the
ViewManager.SetFilter method or the PROP:Filter property to apply the resulting filter.
The BrowseClass optionally uses the QueryFormClass to filter its result set. Therefore, if your
BrowseClass object uses a QueryFormClass object, it must instantiate the QueryFormClass
object and the QueryFormVisual object.
The BrowseClass automatically provides a default query dialog that solicits end user search
values for each field displayed in the browse list. See the Conceptual Example.
932 ABC Library Reference
The templates optionally derive a class from the QueryFormClass for each BrowseQBEButton
control in the application. The derived class is called QBE# where # is the instance number of the
BrowseQBEButton template. The templates provide the derived class so you can use the
BrowseQBEButton template Classes tab to easily modify the query's behavior on an instance-by-
instance basis.
Note that the WindowManager and BrowseClass objects internally handle the normal events
surrounding the query.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABQUERY.INC')
MAP
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
CustomerIDKey KEY(CUS:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CUS:LastName),NOCASE,OPT
Record RECORD,PRE()
ID LONG
LastName STRING(20)
FirstName STRING(15)
City STRING(20)
State STRING(2)
ZIP STRING(10)
END
END
934 ABC Library Reference
CustView VIEW(Customer)
END
CustQ QUEUE
CUS:LastName LIKE(CUS:LastName)
CUS:FirstName LIKE(CUS:FirstName)
CUS:ZIP LIKE(CUS:ZIP)
ViewPosition STRING(1024)
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CusList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(?Close,RequestCancelled)
Relate:Customer.Open
BRW1.Init(?CusList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,ThisWindow)
OPEN(CusWindow)
QueryFormClass 935
SELF.Opened=True
Query.Init(QBEWindow) !initialize Query object
BRW1.Q &= CustQ
BRW1.AddSortOrder(,CUS:NameKey)
BRW1.AddField(CUS:LastName,BRW1.Q.CUS:LastName)
BRW1.AddField(CUS:FirstName,BRW1.Q.CUS:FirstName)
BRW1.AddField(CUS:ZIP,BRW1.Q.CUS:ZIP)
BRW1.QueryControl = ?Query !register Query button w/ BRW1
BRW1.UpdateQuery(Query) !make each browse item Queryable
Query.AddItem('Cus:State','State') !make State field Queryable too
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:CustomerIDKey,'CUS:CustomerIDKey',1)
SELF.AddKey(CUS:NameKey,'CUS:NameKey',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
936 ABC Library Reference
QueryFormClass Properties
The QueryFormClass inherits all the properties of the QueryClass from which it is derived.
QueryFormClass 937
QueryFormClass Methods
The QueryFormClass inherits all the methods of the QueryClass from which it is derived. See
QueryClass 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:
Mainstream Use:
AskV accept query criteria
GetFilterI return filter expression
Occasional Use:
ResetI reset the QueryFormClass object
GetLimitI get searchvalues
SetLimitI set search values
Virtual Methods
Typically you will not call these methods directly--other ABC Library 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.
Ask Accepts query criteria (search values) from the end user.
uselast An integer constant, variable, EQUATE, or expression
that determines whether the QueryFormClass object
carries forward previous query criteria. A value of one (1
or True) carries forward input from the previous query; a
value of zero (0 or False) discards previous input.
The Ask method displays a query dialog, processes its events, and returns a value indicating
whether to apply the query or abandon it. A return value of Level:Notify indicates the
QueryFormClass object should apply the query criteria; a return value of Level:Benign indicates
the end user cancelled the query input dialog and the QueryFormClass object should not apply
the query criteria.
Implementation: The Ask method declares a generic (empty) dialog to accept query criteria.
The Ask method calls the QueryFormClass object's WindowManager to
define the dialog and process it's events.
The GetFilter method generates filter expressions using the search values
set by the Ask method.
Example:
MyBrowseClass.TakeLocate PROCEDURE
CurSort USHORT,AUTO
I USHORT,AUTO
CODE
IF ~SELF.Query&=NULL AND SELF.Query.Ask()
CurSort = POINTER(SELF.Sort)
LOOP I = 1 TO RECORDS(SELF.Sort)
PARENT.SetSort(I)
SELF.SetFilter(SELF.Query.GetFilter(),'9 - QBE')
END
PARENT.SetSort(CurSort)
SELF.ResetSort(1)
END
Implementation: The Init method sets the QFC property for the query window manager.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
QueryFormVisual
QueryFormVisual Overview
The QueryFormVisual class is a QueryVisualClass that displays a query input dialog and handles
the dialog events. The query dialog includes an entry field, a prompt, and an equivalence
operator (equal, not equal, greater than, etc.) button for each queryable item.
QueryFormVisual Concepts
The QueryFormVisual provides the query window for a QueryFormClass object. The Init method
defines and "programs" the query input dialog at runtime. The query input dialog contains a
prompt, an entry field, and a query operator button for each queryable item. On each button
press, the operator button cycles through the available operators: equal (=), greater than or equal
(>=), less than or equal (<=), not equal (<>), and no filter ( ).
The QueryFormClass recognizes these operators and uses them to create valid filter
expressions.
The BrowseClass uses the QueryFormVisual to provide the user interface to its query facility.
Therefore, if your BrowseClass object provides a query, it must instantiate the QueryFormVisual
object (and the QueryFormClass object). See the Conceptual Example.
The templates optionally derive a class from the QueryFormVisual for each BrowseQBEButton
control in the application. The derived class is called QBV# where # is the instance number of the
BrowseQBEButton template. The templates provide the derived class so you can use the
BrowseQBEButton template Classes tab to easily modify the query's behavior on an instance-by-
instance basis.
Note that the QueryVisualClass and BrowseClass objects internally handle the normal events
surrounding the query.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABQUERY.INC')
MAP
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
CustomerIDKey KEY(CUS:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CUS:LastName),NOCASE,OPT
Record RECORD,PRE()
ID LONG
LastName STRING(20)
FirstName STRING(15)
City STRING(20)
State STRING(2)
ZIP STRING(10)
END
END
944 ABC Library Reference
CustView VIEW(Customer)
END
CustQ QUEUE
CUS:LastName LIKE(CUS:LastName)
CUS:FirstName LIKE(CUS:FirstName)
CUS:ZIP LIKE(CUS:ZIP)
ViewPosition STRING(1024)
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CusList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(?Close,RequestCancelled)
Relate:Customer.Open
BRW1.Init(?CusList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,ThisWindow)
OPEN(CusWindow)
QueryFormVisual Class 945
SELF.Opened=True
Query.Init(QBEWindow) !initialize Query object
BRW1.Q &= CustQ
BRW1.AddSortOrder(,CUS:NameKey)
BRW1.AddField(CUS:LastName,BRW1.Q.CUS:LastName)
BRW1.AddField(CUS:FirstName,BRW1.Q.CUS:FirstName)
BRW1.AddField(CUS:ZIP,BRW1.Q.CUS:ZIP)
BRW1.QueryControl = ?Query !register Query button w/ BRW1
BRW1.UpdateQuery(Query) !make each browse item Queryable
Query.AddItem('Cus:State','State') !make State field Queryable too
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:CustomerIDKey,'CUS:CustomerIDKey',1)
SELF.AddKey(CUS:NameKey,'CUS:NameKey',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
946 ABC Library Reference
QueryFormVisual Properties
The QueryFormVisual inherits all the properties of the QueryVisualClass from which it is derived.
See QueryVisualClass properties for more information.
In addition to the inherited properties, the QueryFormVisual contains the following property:
QFC &QueryFormClass
The QFC property is a reference to the QueryFormClass that uses this QueryFormVisual object
to solicit query criteria (search values) from the end user.
QueryFormVisual Methods
The QueryFormVisual inherits all the methods of the QueryVisualClass from which it is derived.
See QueryVisualClass 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:
MainStream Use:
none
Occasional Use:
none
Virtual Methods
Typically you will not call these methods directly--other ABC Library 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.
GetButtonFeq(index)
GetButtonFeq Returns the field equate label of the starting set of QBE
controls.
index An integer constant, variable, EQUATE, or expression
that contains an indexed value to the starting set of QBE
controls
The GetButtonFeq method returns a field equate label which correponds to the starting set of
QBE controls.
Implementation: The GetButtonFeq method is used in conjunction with the Web Builder
template set. This method is called only if the WebServer.IsEnabled method
returns a TRUE value.
For each queryable item (defined by the QFC property), the Init method
creates a series of window controls to accept search values. By default, each
queryable item gets a prompt, an entry control, and an query operator button
(equal, not equal, greater than, etc.).
The Init method sets the coordinates for the QueryFormClass WINDOW and
for the individual controls.
Example:
MyQuery.Ask PROCEDURE(BYTE UseLast)
W WINDOW('Query values'),GRAY !declare an "empty" window
BUTTON('&OK'),USE(?Ok,1000),DEFAULT
BUTTON('Cancel'),USE(?Cancel,1001)
END
CODE
OPEN(W)
IF SELF.Win.Run()=RequestCancelled !configure, display & process query dialog
! Win &= QueryFormVisual
! Win.Run calls Init, Ask & Kill
! Win.Init configures the dialog
! Win.Ask displays dialog & handles events
! Win.Kill shuts down the dialog
RETURN Level:Notify
ELSE
RETURN Level:Benign
END
ResetFromQuery, DERIVED
The ResetFromQuery method resets the QueryFormVisual object after a query.
Implementation: The ResetFromQuery method calls the SetText method for each field
available for query.
Example:
QueryFormVisual.ResetFromQuery PROCEDURE
I USHORT
CODE
LOOP I = 1 TO RECORDS(SELF.QFC.Fields)
GET(SELF.QFC.Fields,I)
SELF.SetText((Feq:StartControl+(I*3-1)),SELF.QFC.Fields.Middle)
END
Update()
RETURN
SetText The SetText method sets the prompt text for the
QueryFormVisual object.
control An integer constant, variable, EQUATE, or expression
containing the control number of the control to act on.
entrytext A string constant, variable, EQUATE, or expression
containing the text to assign to the prompt.
Implementation: The ResetFromQuery method calls the SetText method for each field
available for query.
Example:
QueryFormVisual.ResetFromQuery PROCEDURE
I USHORT
CODE
LOOP I = 1 TO RECORDS(SELF.QFC.Fields)
GET(SELF.QFC.Fields,I)
SELF.SetText((Feq:StartControl+(I*3-1)),SELF.QFC.Fields.Middle)
END
Update()
RETURN
Implementation: For each item that can be queried(defined by the QFC property), the
TakeAccepted method implements cycling of operators for the query
operator buttons. On each button press, the button cycles through the
available filter operators: equal(=), greater than or equal(>=), less than or
equal(<=), not equal(<>), and no filter( ).
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
Implementation: Based on the current state of the querydialog, the TakeCompleted method
sets the search values in the QFC property. The QFC property may use
these search values to create a filter expresssion.
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
Implementation: Return values are declared in ABERROR.INC. The TakeEvent method calls
the TakeFieldEvent method.
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
UpdateFields, DERIVED
The UpdateFields method processes the values entereed into the query dialog for assignment to
a filter statment.
Example:
QueryFormVisual.TakeCompleted PROCEDURE
CODE
SELF.SetResponse(RequestCompleted)
SELF.UpdateFields
RETURN Level:Benign
QueryListClass
QueryListClass--Overview
The QueryListClass is a QueryClass with a "list" user interface. The QueryListClass provides
support for ad hoc queries against Clarion VIEWs. The list interface includes is an edit-in-place,
3-column listbox with a field column, an equivalence operator (contains, begins, equal, not equal,
greater than, less than) column, and a value (to query for) column.
QueryListClass Concepts
Use the AddItem method to define a user input dialog at runtime. Or create a custom dialog to
plug into your QueryClass object. Use the Ask method to solicit end user query criteria (search
values) or use the SetLimit method to programmatically set query search values. Finally, use the
GetFilter method to build the filter expression to apply to your VIEW. Use the
ViewManager.SetFilter method or the PROP:Filter property to apply the resulting filter.
The BrowseClass optionally uses the QueryListClass to filter its result set. If your BrowseClass
object uses a QueryListClass object, it must instantiate a QueryListClass object and a
QueryListVisual object.
The BrowseClass automatically provides a default query dialog that solicits end user search
values for each field displayed in the browse list. See the Conceptual Example.
The templates optionally derive a QueryListClass object for each BrowseQBEButton control in the
application. The derived class is called QBE# where # is the instance number of the
BrowseQBEButton template. The templates provide the derived class so you can use the
BrowseQBEButton template Classes tab to easily modify the query's behavior on an instance-by-
instance basis.
Tip: Use the BrowseQBEButton control template to add a QueryListClass object to your
template generated BrowseBoxes.
958 ABC Library Reference
QueryListClass--Conceptual Example
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a QueryListClass object and related objects. The example plugs a
QueryListClass into a BrowseClass object. The QueryListClass object solicits query criteria
(search values) with a "list" dialog, then generates a filter expression based on the end user input.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABQUERY.INC')
MAP
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
CustomerIDKey KEY(CUS:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CUS:LastName),NOCASE,OPT
Record RECORD,PRE()
ID LONG
LastName STRING(20)
FirstName STRING(15)
City STRING(20)
State STRING(2)
ZIP STRING(10)
END
END
960 ABC Library Reference
CustView VIEW(Customer)
END
CustQ QUEUE
CUS:LastName LIKE(CUS:LastName)
CUS:FirstName LIKE(CUS:FirstName)
CUS:ZIP LIKE(CUS:ZIP)
ViewPosition STRING(1024)
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CusList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(?Close,RequestCancelled)
Relate:Customer.Open
BRW1.Init(?CusList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,ThisWindow)
OPEN(CusWindow)
SELF.Opened=True
Query.Init(QBEWindow) !initialize Query object
QueryListClass 961
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:CustomerIDKey,'CUS:CustomerIDKey',1)
SELF.AddKey(CUS:NameKey,'CUS:NameKey',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
962 ABC Library Reference
QueryListClass Properties
The QueryListClass inherits all the properties of the QueryClass from which it is derived. See
QueryClass Properties for more information.
QueryListClass 963
QueryListClass Methods
The QueryListClass inherits all the methods of the QueryClass from which it is derived. See
QueryClass 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 two categories:
Mainstream Use:
AskV accept query criteria
GetFilterI return filter expression
Occasional Use:
ResetI reset the QueryListClass object
GetLimitI get search values
SetLimitI set search values
Virtual Methods
Typically you will not call these methods directly--other ABC Library 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.
Ask Accepts query criteria (search values) from the end user.
uselast An integer constant, variable, EQUATE, or expression that determines whether
the QueryListClass object carries forward previous query criteria. A value of one
(1) carries forward input from the previous query; a value of zero (0) discards
previous input.
The Ask method displays a query dialog, processes its events, and returns a value indicating
whether to apply the query or abandon it. A return value of Level:Notify indicates the
QueryListClass object should apply the query criteria; a return value of Level:Benign indicates the
end user cancelled the query input dialog and the QueryListClass object should not apply the
query criteria.
Implementation: The Ask method declares a generic (empty) dialog to accept query criteria. The
Ask method calls the QueryListClass object's WindowManager to define the
dialog and process it's events.
The GetFilter method generates filter expressions using the search values set by
the Ask method.
The Init method sets the value of the QueryListClass object's WindowManager.
Example:
MyBrowseClass.TakeLocate PROCEDURE
CurSort USHORT,AUTO
I USHORT,AUTO
CODE
IF ~SELF.Query&=NULL AND SELF.Query.Ask()
CurSort = POINTER(SELF.Sort)
LOOP I = 1 TO RECORDS(SELF.Sort)
PARENT.SetSort(I)
SELF.SetFilter(SELF.Query.GetFilter(),'9 - QBE')
END
PARENT.SetSort(CurSort)
SELF.ResetSort(1)
END
Implementation: The Init method sets the QFC property for the querywindowmanager.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
Kill, DERIVED
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other initialization code
Query.Init(QueryWindow)
Query.AddItem('UPPER(CLI:LastName)','Name','s20')
Query.AddItem('CLI:ZIP+1','ZIP+1','')
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!other termination code
Query.Kill
RETURN ReturnValue
QueryListVisual
QueryListVisual--Overview
The QueryListVisual class is a QueryVisualClass that displays a query input dialog and handles
the dialog events. The query dialog includes an edit-in-place, 3-column listbox, which allows the
end user to choose the fields to query, the equivalence operator, and the value to query for.
QueryListVisual Concepts
The QueryListVisual provides the query window for a QueryListClass object. The Init method
defines and "programs" the query input dialog at runtime. The query interface includes an edit-in-
place, 3-column listbox with a field column, an equivalence operator (contains, begins, equal, not
equal, greater than, less than) column, and a value (to query for) column.
The BrowseClass optionally uses the QueryListVisual class to provide the user an edit-in-place
list interface to it's query facility.
The templates optionally derive a class from the QueryListVisual for each BrowseQBEButton
control in the application. The derived class is called QBV# where # is the instance number of the
BrowseQBEButton template. The templates provide the derived class so you can use the
BrowseQBEButton template Classes tab to easily modify the query's behavior on an instance-by-
instance basis.
Tip: Use the BrowseQBEButton control template to add a QueryListClass object to your
template generated BrowseBoxes.
QueryListVisual--Conceptual Example
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a QueryListVisual object and related objects. The example plugs a
QueryListClass into a BrowseClass object. The QueryListClass object uses the QueryListVisual
to solicit query criteria (search values) from the end user.
Note that the QueryVisualClass and BrowseClass objects internally handle the normal events
surrounding the query.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABQUERY.INC')
MAP
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
CustomerIDKey KEY(CUS:ID),NOCASE,OPT,PRIMARY
NameKey KEY(CUS:LastName),NOCASE,OPT
Record RECORD,PRE()
ID LONG
LastName STRING(20)
FirstName STRING(15)
City STRING(20)
State STRING(2)
ZIP STRING(10)
END
END
970 ABC Library Reference
CustView VIEW(Customer)
END
CustQ QUEUE
CUS:LastName LIKE(CUS:LastName)
CUS:FirstName LIKE(CUS:FirstName)
CUS:ZIP LIKE(CUS:ZIP)
ViewPosition STRING(1024)
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?CusList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(?Close,RequestCancelled)
Relate:Customer.Open
BRW1.Init(?CusList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,ThisWindow)
OPEN(CusWindow)
QueryListVisual Class 971
SELF.Opened=True
Query.Init(QBEWindow) !initialize Query object
BRW1.Q &= CustQ
BRW1.AddSortOrder(,CUS:NameKey)
BRW1.AddField(CUS:LastName,BRW1.Q.CUS:LastName)
BRW1.AddField(CUS:FirstName,BRW1.Q.CUS:FirstName)
BRW1.AddField(CUS:ZIP,BRW1.Q.CUS:ZIP)
BRW1.QueryControl = ?Query !register Query button w/ BRW1
BRW1.UpdateQuery(Query) !make each browse item Queryable
Query.AddItem('Cus:State','State') !make State field Queryable too
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
Relate:Customer.Close
RETURN ReturnValue
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:CustomerIDKey,'CUS:CustomerIDKey',1)
SELF.AddKey(CUS:NameKey,'CUS:NameKey',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
972 ABC Library Reference
QueryListVisual Properties
The QueryListVisual inherits all the properties of the QueryVisualClass from which it is derived.
See QueryVisualClass properties for more information.
In addition to the inherited properties, the QueryListVisual contains the following properties:
QFC &QueryListClass
The QFC property is a reference to the QueryListClass that uses this QueryListVisual object to
solicit query criteria (search values) from the end user.
OpsEIP &EditDropListClass,PROTECTED
The OpsEIP property is a reference to the EditDropListClass that displays the available operators
in the QueryList dialog.
FldsEIP &EditDropListClass,PROTECTED
The FldsEIP property is a reference to the EditDropListClass that displays the available fields to
query in the QueryList dialog.
QueryListVisual Class 973
ValueEIP(reference to QEditEntryClass)
ValueEIP &EditEntryClass,PROTECTED
The ValueEIP property is a reference to the QEditEntryClass that enables edit-in-place entry
fields in the QBE window.
Implementation: The ValueEIP is initialized in the QueryListVisual.Init method and updated in the
QueryListVisual.UpdateControl method.
QueryListVisual Methods
The QueryListVisual inherits all the methods of the QueryVisualClass from which it is derived.
See QueryVisualClass 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:
MainStream Use:
none
Occasional Use:
none
Derived Methods
Typically you will not call these methods directly--other ABC Library 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.
Implementation: The QueryListClass.Ask method (indirectly) calls the Init method to configure the
QueryListClass WINDOW.
The Init method reads each queryable item (defined by the QFC property) from a
queue, then creates an edit-in-place, 3-column listbox with a field column, an
equivalence operator (equal, not equal, greater than, etc.) column, and a value
(to query for) column.
The Init method sets the coordinates for the QueryListClass WINDOW and for
the individual controls.
Example:
QueryListClass.Ask PROCEDURE(BYTE UseLast)
W WINDOW('Query'),AT(,,300,200),FONT('MS SansSerif',8,,FONT:regular),SYSTEM,GRAY,DOUBLE
LIST,AT(5,5,290,174),USE(?List,FEQ:ListBox),|
FORMAT('91L|M~Field~@s20@44C|M~Operator~L@s10@120C|M~Value~L@s30@')
BUTTON('Insert'),AT(5,183,45,14),USE(?Insert,FEQ:Insert)
BUTTON('Change'),AT(52,183,45,14),USE(?Change,FEQ:Change)
BUTTON('Delete'),AT(99,183,45,14),USE(?Delete,FEQ:Delete)
BUTTON('&OK'),AT(203,183,45,14),USE(?Ok,FEQ:OK),DEFAULT
BUTTON('Cancel'),AT(250,183,45,14),USE(?Cancel,FEQ:Cancel)
END
CODE
OPEN(W)
IF ~UseLast THEN SELF.Reset().
RETURN CHOOSE(SELF.Win.Run()=RequestCancelled,Level:Benign,Level:Notify)
ResetFromQuery, DERIVED
The ResetFromQuery method resets the QueryListVisual object after a query.
Implementation: The ResetFromQuery method calls the GetLimit method for each field available
for query.
Example:
QueryListVisual.ResetFromQuery PROCEDURE
I USHORT
CaseLess BYTE,AUTO
High BYTE
CODE
FREE(SELF.Vals)
LOOP I = 1 TO RECORDS(SELF.QFC.Fields)
GET(SELF.QFC.Fields,I)
LOOP
High = SELF.QFC.GetLimit(SELF.Vals.Value,SELF.Vals.Ops,CaseLess,High)
IF SELF.Vals.Value
IF CaseLess AND SELF.Vals.Value[1] ~= '^'
SELF.Vals.Value = '^' & SELF.Vals.Value
END
SELF.Vals.Field = SELF.QFC.Fields.Title
ADD(SELF.Vals)
END
WHILE High
END
RETURN
SetAlerts, DERIVED
The SetAlerts method method alerts appropriate keystrokes for the edit-in-place 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
specific keystrokes for the query dialog. Alerted keys are:
MouseLeft2 !edit selected record
InsertKey !add a query field
CtrlEnter !edit selected record
DeleteKey !delete query field
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 TakeAccepted method handles the processing of the update butons (Insert,
Change, Delete) on the Query list dialog.
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
Implementation: Based on the current state of the querydialog, the TakeCompleted method sets
the search values in the QFC property. The QFC property may use these search
values to create a filter expresssion.
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
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
! Not a known field
IF ?{PROP:Type} <> CREATE:Button OR EVENT() <> EVENT:Selected
!Wait to post accepted for button
SELF.Repost = EVENT()
SELF.RepostField = FIELD()
SELF.TakeFocusLoss
END
RETURN Level:Benign
Implementation: Return values are declared in ABERROR.INC. The TakeEvent method calls the
TakeFieldEvent method.
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
UpdateControl(fieldname)
UpdateFields, DERIVED
The UpdateFields method processes the values entereed into the query dialog for assignment to
a filter statment.
Example:
QueryListVisual.TakeCompleted PROCEDURE
CODE
SELF.SetResponse(RequestCompleted)
SELF.UpdateFields
RETURN Level:Benign
QueryVisualClass
QueryVisualClass: Overview
The QueryVisualClass is a WindowManager that displays a query input dialog and handles the
dialog events. The QueryVisualClass is an abstract class that handles all of the basic Window
functionality for the query dialog.
QueryVisualClass Concepts
The QueryVisualClass is the parent class for the Query dialogs. It is designed to encapsulate the
standard query requirements for the window manager.
The QueryVisualClass is derived from the WindowManager. The classes derived from the
QueryVisualClass are optionally used by the QueryClass object.
The ABC Templates do not instantiate the QueryClass object independently. The templates
instantiate the derived QueryFormClass or QueryListClass instead.
The QueryVisualClass source code is installed by default to the Clarion \LIBSRC folder. The
specific QueryVisualClass files and their respective components are:
QueryVisualClass Properties
The QueryVisualClass inherits all the properties of the WindowManager from which it is derived.
See WindowManager Properties for more information.
In addition to the inherited properties, the QueryVisualClass contains the following properties:
QC &QueryClass
The QC property is a reference to the QueryClass that uses this QueryVisualClass object to
solicit query criteria (search values) from the end user.
Resizer &WindowResizeClass
The Resizer property is a reference to the WindowResizeClass that is used by this
QueryVisualClass object to handle resizing of the Window controls at runtime.
QueryVisualClass Methods
The QueryVisualClass inherits all the methods of the WindowManager from which it is derived.
See WindowManager Methods for more information.
The Init method initializes the QueryVisual object. Init returns Level:Benign to indicate normal
initialization. The Init method "programs" the QueryVisual object.
Implementation: The Init method is called from the Init methods of both the QueryFormVisual and
the QueryListVisual as PARENT calls. Typically, the Init method is paired with
the Kill method, performing the converse of the Kill method tasks.
Example:
QueryFormVisual.Init PROCEDURE
CODE
QFC &= SELF.QFC
CLEAR(SELF)
SELF.QFC &= QFC
SELF.QC &= QFC
RVal = PARENT.Init() ! The call to the Init
IF RVal THEN RETURN RVal.
! Saved query code
RETURN RVal
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code. Kill returns a value to indicate the status of the shut down.
Implementation: Kill sets the Dead property to True and returns Level:Benign to indicate a normal
shut down. If the Dead property is already set to True, Kill returns Level:Notify to
indicate it is taking no additional action.
Typically, the Kill method is paired with the Init method, performing the converse
of the Init method tasks.
Example:
ThisWindow.Kill PROCEDURE()
CODE
IF PARENT.Kill() THEN RETURN Level:Notify.
IF FilesOpened
Relate:Defaults.Close
END
IF SELF.Opened
INIMgr.Update('Main',AppFrame)
END
GlobalResponse = CHOOSE(LocalResponse=0,RequestCancelled,LocalResponse)
Implementation: The Reset method calls the WindowMangaer.Reset and handles the logic for
enabling and disabling the Load and Save buttons. The Reset is called by the
TakeFieldEvent and TakeAccepted methods.
Example:
QueryVisual.TakeFieldEvent PROCEDURE
CODE
CASE FIELD()
OF FEQ:QueryNameField
CASE EVENT()
OF EVENT:NewSelection
SELF.Reset
END
OF FEQ:SaveListBox
CASE Event()
OF EVENT:AlertKey
IF Keycode() = MouseLeft2
GET(SELF.Queries,CHOICE(FEQ:SaveListBox))
SELF.QC.Restore(SELF.Queries.Item)
SELF.ResetFromQuery
POST(EVENT:Accepted,FEQ:Ok)
END
OF EVENT:NewSelection
GET(SELF.Queries,CHOICE(FEQ:SaveListBox))
FEQ:QueryNameField{Prop:ScreenText} = SELF.Queries.Item
Update(FEQ:QueryNameField)
SELF.Reset
END
END
RETURN PARENT.TakeFieldEvent()
The TakeAccepted method processes EVENT:Accepted events for the query dialog's controls,
and returns a value indicating whether ACCEPT loop processing is complete and should stop.
TakeAccepted returns Level:Benign to indicate processing of this event should continue normally;
it returns Level:Notify to indicate processing is completed for this event and the ACCEPT loop
should CYCLE; it returns Level:Fatal to indicate the event could not be processed and the
ACCEPT loop should BREAK.
Implementation: For each queryable item (defined by the QC property), the TakeAccepted method
implements cycling of operators for the query operator buttons. On each button
press, the button cycles through the available filter operators: equal(=), greater
than or equal(>=), less than or equal(<=), not equal(<>), and no filter( ).
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
See Also: QC
QueryVisualClass 991
Implementation: Return values are declared in ABERROR.INC. The TakeEvent method calls the
TakeFieldEvent method.
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
Implementation:
TakeWindowEvent implements standard handling of EVENT:OpenWindow Open
method), EVENT:LoseFocus, EVENT:GainFocus (Reset method), and EVENT:Sized
(WindowResizeClass.Resize method). Return values are declared in ABERROR.INC.
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
RelationManager
RelationManager Overview
The RelationManager class declares a relation manager object that does the following:
• Consistently and flexibly defines relationships between files--the relationships need not
be defined in a data dictionary; they may be defined directly (dynamically) to the relation
manager object.
• Reliably enforces discrete specified levels of referential integrity (RI) constraints between
the related files--the RI constraints need not be defined in a data dictionary; they may be
defined directly (dynamically) to the relation manager object.
• Conveniently forwards appropriate file commands to related files--for example, when a
relation manager object opens its primary file, it also opens any related files.
The RelationManager class provides "setup" methods that let you describe the file relationships,
their linking fields, and their associated RI constraints; plus other methods to perform the
cascadable or constrainable database operations such as open, change, delete, and close.
You can fully describe a set of file relationships with a series of RelationManager objects--one
RelationManager object for each file. Each RelationManager object defines the relationships
between its primary file and any files directly related to the primary file. However, each
RelationManager object also knows about its related files' RelationManager objects, so indirectly,
it knows about those secondary relationships too.
For example, consider three related files: Customer <->> Order <->> Item, where <->> indicates
a one:many relationship. The RelationManager object for the Customer file knows about the
relationship between Customer and Order, but it also knows about the Order file's
RelationManager object, so indirectly, it knows about the relationship between Order and Item
too.
The benefit of this chain of RelationManager awareness, is that you can issue a file command
such as open or close to any one of the RelationManager objects and it forwards the command
up and down the chain of related files; and for deletes or changes, it enforces any relational
integrity constraints up and down the chain of related files.
Me and Him
Some of the RelationManager methods refer to its primary file as "MyFile" or "Me" and its related
files as "HisFile" or "Him." See Relation Manager Properties for more information.
994 ABC Library Reference
Some of the RelationManager methods refer to its primary file record buffer as "Left," the
associated queue buffer as "Right" and the associated save area for the record as "Buffer." See
BufferedPairsClass and FieldPairsClass for more information.
The ABC Templates generate housekeeping procedures to initialize and shut down the
RelationManager objects. The procedures are DctInit and DctKill. They are generated into the
appnaBC.CLW file.
The derived RelationManager classes are configurable with the Global Properties dialog. See
Template Overview--File Control Options and Classes Options for more information.
The RelationManager relies on both the FileManager and the BufferedPairsClass to do much of
its work. Therefore, if your program instantiates the RelationManager it must also instantiate the
FileManager and the BufferedPairsClass. Much of this is automatic when you INCLUDE the
RelationManager header (ABFILE.INC) in your program's data section. See the Conceptual
Example and see File Manager Class and Field Pairs Classes for more information.
ViewManager
Perhaps more significantly, the RelationManager serves as the foundation or "errand boy" of the
ViewManager. If your program instantiates the ViewManager it must also instantiate the
RelationManager. See View Manager Class for more information.
The RelationManager source code is installed by default to the Clarion \LIBSRC folder. The
RelationManager source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate some RelationManager objects.
This example uses the RelationManager class to cascade new key values from parent file
records to the corresponding child file records.
PROGRAM
INCLUDE('ABFILE.INC')
INCLUDE('ABREPORT.INC')
MAP
END
CUSTOMER FILE,DRIVER('TOPSPEED'),NAME('CUSTOMER'),PRE(CUS),BINDABLE,CREATE,THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
NAME STRING(30)
ZIP DECIMAL(5)
END
END
PHONES FILE,DRIVER('TOPSPEED'),NAME('PHONES'),PRE(PHO),BINDABLE,CREATE,THREAD
BYCUSTOMER KEY(PHO:CUSTNO,PHO:PHONE),DUP,NOCASE,OPT
Record RECORD,PRE()
CUSTNO LONG
PHONE STRING(20)
TYPE STRING(8)
END
END
GlobalErrors ErrorClass
Access:CUSTOMER CLASS(FileManager)
Init PROCEDURE
END
Relate:CUSTOMER CLASS(RelationManager)
Init PROCEDURE
END
Access:PHONES CLASS(FileManager)
Init PROCEDURE
END
Relate:PHONES CLASS(RelationManager)
Init PROCEDURE
END
996 ABC Library Reference
RecordsPerCycle LONG(25)
StartOfCycle LONG,AUTO
PercentProgress BYTE
ProgressMgr StepLongClass
CustView VIEW(CUSTOMER)
END
Process ProcessClass
Progress:Bar BYTE
ProgressWindow WINDOW('Processing...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Progress:Bar),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:Text),CENTER
BUTTON('Cancel'),AT(45,42,50,15),USE(?Progress:Cancel)
END
CODE
GlobalErrors.Init
Relate:CUSTOMER.Init
Relate:PHONES.Init
ProgressMgr.Init(ScrollSort:AllowNumeric)
Process.Init(CustView,Relate:CUSTOMER,|
?Progress:Text,Progress:Bar,|
ProgressMgr,CUS:CUSTNO)
Process.AddSortOrder( CUS:BYNUMBER )
Relate:CUSTOMER.Open
OPEN(ProgressWindow)
?Progress:Text{Prop:Text} = '0% Completed'
ACCEPT
CASE EVENT()
OF Event:OpenWindow
Process.Reset
IF Process.Next()
POST(Event:CloseWindow)
CYCLE
END
OF Event:Timer
StartOfCycle=Process.RecordsProcessed
LOOP WHILE Process.RecordsProcessed-StartOfCycle<RecordsPerCycle
CUS:CUSTNO+=100 !change parent key value
IF Relate:CUSTOMER.Update() !cascade change to children
BREAK
END
CASE Process.Next()
OF Level:Notify
?Progress:Text{Prop:Text} = 'Process Completed'
DISPLAY(?Progress:Text)
POST(EVENT:CloseWindow)
BREAK
RelationManager 997
OF Level:Fatal
POST(EVENT:CloseWindow)
BREAK
END
END
END
CASE FIELD()
OF ?Progress:Cancel
CASE Event()
OF Event:Accepted
POST(Event:CloseWindow)
END
END
END
ProgressMgr.Kill
Relate:CUSTOMER.Close
Relate:CUSTOMER.Kill
Relate:PHONES.Kill
GlobalErrors.Kill
Access:CUSTOMER.Init PROCEDURE
CODE
PARENT.Init(Customer, GlobalErrors)
SELF.FileNameValue = 'CUSTOMER'
SELF.Buffer &= CUS:Record
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',1)
Relate:CUSTOMER.Init PROCEDURE
CODE
Access:CUSTOMER.Init
PARENT.Init(Access:CUSTOMER,1)
SELF.AddRelation(Relate:PHONES,RI:Cascade,RI:Restrict,PHO:BYCUSTOMER)
SELF.AddRelationLink(CUS:CUSTNO,PHO:CUSTNO)
Access:PHONES.Init PROCEDURE
CODE
PARENT.Init(Phones, GlobalErrors)
SELF.FileNameValue = 'PHONES'
SELF.Buffer &= PHO:Record
SELF.AddKey(PHO:BYCUSTOMER,'PHO:BYCUSTOMER')
Relate:PHONES.Init PROCEDURE
CODE
Access:PHONES.Init
PARENT.Init(Access:PHONES,1)
SELF.AddRelation( Relate:CUSTOMER )
998 ABC Library Reference
RelationManager Properties
RelationManager Properties
The Relation Manager contains the following properties.
Me &FileManager
The Me property is a reference to the FileManager object for the RelationManager's primary file.
By definition, the file referenced by this FileManager object is the RelationManager's primary file.
The Me property identifies the primary file's FileManager object for the various RelationManager
methods.
UseLogout BYTE
The UseLogout property determines whether cascaded updates or deletes are done within a
transaction frame (LOGOUT/COMMIT). A value of zero (0) indicates no transaction framing; a
value of one (1) indicates transaction framing.
Implementation: The Init method sets the value of the UseLogout property.
The ABC Templates set the UseLogout property based on the Enclose RI code
in transaction frame check box in the Global Properties dialog.
RelationManager Methods
RelationManager Functional Organization--Expected Use
As an aid to understanding the RelationManager, it is useful to organize its methods into two
categories according to their expected use--the Non-Virtual and the virtual methods. This
organization reflects what we believe is typical use of the RelationManager 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:
OpenV open a file and any related files
SaveV copy current and designated related records
UpdateV update current record subject to RI constraints
DeleteV delete current record subject to RI constraints
CloseV close a file and any related files
V These methods are also Virtual.
Occasional Use:
ListLinkingFields map pairs of linked fields
SetQuickScan enable QuickScan across related files
Virtual Methods
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.
AddRelation Describes a relationship between this object's primary file (see Me) and another
file.
relationmanager The label of the related file's RelationManager object.
updatemode A numeric constant, variable, EQUATE, or expression that indicates the
referential integrity constraint to apply upon updates to the primary file's linking
field. Valid constraints are none, clear, restrict, and cascade. If omitted, then
deletemode and relatedkey must also be omitted, and the relationship is
unconstrained.
deletemode A numeric constant, variable, EQUATE, or expression that indicates the
referential integrity constraint to apply upon deletes of the primary file's linking
field. Valid constraints are none, clear, restrict, and cascade. If omitted, then
updatemode and relatedkey must also be omitted, and the relationship is
unconstrained.
relatedkey The label of the related file's linking KEY. If included, the call to AddRelation must
be followed by a call to AddRelationLink for each linking component field of the
key. If omitted, then updatemode and deletemode must also be omitted, and the
relationship is unconstrained.
The AddRelation method, in conjunction with the AddRelationLink method, describes a
relationship between this object's primary file (see Me) and another file so that other
RelationManager methods can cascade or constrain file operations across the related files when
appropriate.
Implementation: You should typically call AddRelation after the Init method is called (or within your
derived Init method).
Example:
Orders FILE,DRIVER('TOPSPEED'),PRE(ORD),CREATE
ByCustomer KEY(ORD:CustNo,ORD:OrderNo),DUP,NOCASE,OPT
RelationManager 1001
Record RECORD,PRE()
CustNo LONG
OrderNo LONG
OrderDate LONG
Reference STRING(24)
ShipTo STRING(32)
Shipped BYTE
Carrier STRING(1)
END
END
Items FILE,DRIVER('TOPSPEED'),PRE(ITEM),CREATE
AsEntered KEY(ITEM:CustNo,ITEM:OrderNo,ITEM:LineNo),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CustNo LONG
OrderNo LONG
LineNo SHORT
ProdCode SHORT
Quantity SHORT
END
END
CODE
!program code
Relate:Orders.Init PROCEDURE
CODE
SELF.AddRelation( Relate:Items,0,0, ITEM:AsEntered )
SELF.AddRelationLink( ORD:CustNo, ITEM:CustNo )
SELF.AddRelationLink( ORD:OrderNo, ITEM:OrderNo )
SELF.AddRelation( Relate:Customer )
AddRelationLink
Identifies the linking fields for a relationship between this object's primary file (see
Me) and another file.
parentkey The label of the primary file's linking field.
childkey The label of the related file's linking field.
The AddRelationLink method, in conjunction with the AddRelation method, describes a
relationship between this object's primary file (see Me) and another file so that other
RelationManager methods can cascade or constrain file operations across the related files when
appropriate.
You must call AddRelationLink for each pair of linking fields, and the calls must be in sequence of
high order linking fields to low order linking fields.
Implementation: You should typically call AddRelationLink after the Init method is called (or within
your derived Init method).
Example:
Orders FILE,DRIVER('TOPSPEED'),PRE(ORD),CREATE
ByCustomer KEY(ORD:CustNo,ORD:OrderNo),DUP,NOCASE,OPT
Record RECORD,PRE()
CustNo LONG
OrderNo LONG
OrderDate LONG
Reference STRING(24)
ShipTo STRING(32)
Shipped BYTE
Carrier STRING(1)
END
END
Items FILE,DRIVER('TOPSPEED'),PRE(ITEM),CREATE
AsEntered KEY(ITEM:CustNo,ITEM:OrderNo,ITEM:LineNo),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CustNo LONG
OrderNo LONG
LineNo SHORT
ProdCode SHORT
Quantity SHORT
END
END
RelationManager 1003
CODE
!program code
Relate:Orders.Init PROCEDURE
CODE
SELF.AddRelation( Relate:Items,0,0, ITEM:AsEntered )
SELF.AddRelationLink( ORD:CustNo, ITEM:CustNo )
SELF.AddRelationLink( ORD:OrderNo, ITEM:OrderNo )
SELF.AddRelation( Relate:Customer )
Implementation: The CancelAutoInc method calls the FileManager.CancelAutoInc method for its
primary file, passing SELF as the relation manager parameter.
Example:
WindowManager.TakeCloseEvent PROCEDURE
CODE
IF SELF.Response <> RequestCompleted
!procedure code
IF SELF.OriginalRequest=InsertRecord AND SELF.Response=RequestCancelled
IF SELF.Primary.CancelAutoInc() !undo PrimeAutoInc - cascade
SELECT(SELF.FirstField)
RETURN Level:Notify
END
END
!procedure code
END
RETURN Level:Benign
Close Closes this object's primary file (see Me) and any related files.
cascading A numeric constant, variable, EQUATE, or expression that indicates whether this
method was called by itself (recursive). A value of zero (0) indicates a non-
recursive call; a value of one (1) indicates a recursive call. This allows the
method to stop when it has processed all the related files in a circular
relationship. If omitted, cascading defaults to zero (0). You should always omit
this parameter when calling the Close method from your program.
The Close method closes this object's primary file (see Me) if no other procedure needs it, and
any related files, and returns a value indicating its success or failure.
Implementation: The Close method uses the FileManager.Close method to close each file. The
Close method returns the FileManager.Close method's return value. See File
Manager Class for more information.
Example:
Relate:Customer.Open !open Customer and related files
!program code !process the files
Relate:Customer.Close !close Customer and related files
Delete Deletes the record from the primary file subject to any specified referential
integrity constraints.
confirm An integer constant, variable, EQUATE, or expression that indicates whether to
confirm the delete with the end user. A value of one (1 or True) deletes only on
confirmation from the end user; a value of zero (0 or false) deletes without
confirmation. If omitted, confirm defaults to one (1).
The Delete method deletes the current record from the primary file (see Me) applying any
specified referential integrity constraints, then returns a value indicating its success or failure. The
deletes are done within a transaction frame if the Init method's uselogout parameter is set to one
(1).
Implementation: Delete constraints are specified by the AddRelation method. If the constraint is
RI:Restrict, the method deletes the current record only if there are no related
child records. If the constraint is RI:Cascade, the method also deletes any related
child records. If the constraint is RI:None, the method unconditionally deletes
only the primary file record. If the constraint is RI:Clear, the method
unconditionally deletes the primary file record, and clears the linking field values
in any related child records.
The Delete method calls the primary file FileManager.Throw method to confirm
the delete with the end user.
Example:
DeleteCustomer PROCEDURE
CODE
Relate:Customer.Open !Open Customer & related files
IF NOT GlobalErrors.Throw(Msg:ConfirmDelete) !have user confirm delete
LOOP !allow retry if delete fails
IF Relate:Customer.Delete() !delete subject to constraints
IF NOT GlobalErrors.Throw(Msg:RetryDelete)!if del fails, offer to try again
CYCLE !if user accepts, try again
END ! otherwise, fall thru
END !if del succeeds or user declines
UNTIL 1 ! fall out of loop
END
GetNbFiles(relationmanager)
GetNbRelations
The GetNbRelations method returns the number of relations defined for this objects primary file.
GetRelation(|relationposition |)
|relatedfile |
GetRelation(relationposition)
Returns the relation manager for the specified relationposition in
the internal list of relations.
GetRelation(relatedfile)
Returns the relation manager for the specified file.
GetRelationType(whichrelation)
GetRelationType Returns the type of relation for the objects primary file.
whichrelation An integer constant, variable, EQUATE or expresssion that contains the relation
number.
The GetRelationType method returns the type of the relation for the specified relation number.
Implementation: The Init method sets the value of the Me and UseLogout properties. The ABC
Templates set the uselogout parameter based on the Enclose RI code in
transaction frame check box in the Global Properties dialog.
Example:
PROGRAM
INCLUDE('FILE.INC') !declare RelationManager class
Access:Client CLASS(FileManager) !declare Access:Client class
Init PROCEDURE
END
See Also: Me
1010 ABC Library Reference
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
PROGRAM
INCLUDE('FILE.INC') !declare RelationManager class
ListLinkingFields Maps pairs of linking fields between the primary file and a related file.
relationmanager The label of the related file's RelationManager object.
fieldpairs The label of the FieldPairsClass object to receive the linking field references.
recursed A numeric constant, variable, EQUATE, or expression that indicates whether this
method was called by itself (recursive). A value of zero (0) indicates a non-
recursive call; a value of one (1) indicates a recursive call. This allows the
method to get the list of linking fields from the relationmanager if necessary--
since only one side of the relationship maintains the list of linking fields. If
omitted, recursed defaults to zero (0). You should always omit this parameter
when calling the ListLinkingFields method from your program.
The ListLinkingFields method maps pairs of linking fields between the primary file and a related
file.
Implementation: The RelationManager object does not use the resulting mapped fields, but
provides this mapping service for the ViewManager class, etc.
Example:
ViewManager.AddRange PROCEDURE(*? Field,RelationManager MyFile,RelationManager HisFile)
CODE !add range limit to view
SELF.Order.LimitType = Limit:File !set limit type: relationship
MyFile.ListLinkingFields(HisFile,SELF.Order.RangeList)!get linking fields
ASSERT(RECORDS(SELF.Order.RangeList.List)) !confirm Range limits exist
SELF.SetFreeElement !set free key element
1012 ABC Library Reference
Open Opens this object's primary file (see Me) and any related files.
cascading A numeric constant, variable, EQUATE, or expression that indicates whether this
method was called by itself (recursive). A value of zero (0) indicates a non-
recursive call; value of one (1) indicates a recursive call. This allows the method
to stop when it has processed all the related files in a circular relationship. If
omitted, cascading defaults to zero (0). You should always omit this parameter
when calling the Open method from your program.
The Open method Opens this object's primary file (see Me) and any related files, and returns a
value indicating its success or failure.
Implementation: The Open method uses the FileManager.Open method to Open each file. The
Open method returns the FileManager.Open method's return value. See File
Manager Class for more information.
Example:
Relate:Customer.Open !open Customer and related files
!program code !process the files
Relate:Customer.Close !Close Customer and related files
Save, VIRTUAL
The Save method copies the current record in the primary file and any related files. The copies
may be used to detect subsequent changes to the current record or restore the current record to
its previous state.
SetAlias( relationmanager )
Example:
Customer FILE,DRIVER('TOPSPEED'),PRE(CLI),NAME('Customer') !declare Customer file
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
END
END
SetQuickScan Enables or disables quick scanning on this object's primary file and on the
propagated related files.
on A numeric constant, variable, EQUATE, or expression that enables or disables
quick scanning. A value of zero (0) disables quick scanning; a value of one (1)
enables quick scanning.
propagate A numeric constant, variable, EQUATE, or expression that indicates which
related files to include. Valid propogation options are none, one:many, many:one,
and all. If omitted, propagate defaults to none.
The SetQuickScan method enables or disables quick scanning on this object's primary file and
on the propagated related files.
Implementation: The SetQuickScan method SENDs the QUICKSCAN driver string to the file
driver for each specified file. The QUICKSCAN driver string is supported by the
ASCII, BASIC, and DOS drivers. See Database Drivers for more information.
Example:
Relate:Customer.SetQuickScan(1,Propagate:OneMany) !enable quickscan for 1:Many
Relate:Orders.SetQuickScan(1) !enable quickscan for primary
Relate:Orders.SetQuickScan(0) !disable quickscan for primary
RelationManager 1015
Update Updates this object's primary file (see Me) subject to the specified referential
integrity constraints.
fromform A numeric constant, variable, EQUATE, or expression that indicates whether this
method was called from a (form) procedure with field history (restore) capability.
A value of zero (0) indicates no restore capability; a value of one (1) indicates
restore capability. This allows the method to issue an appropriate message when
the update fails.
The Update method updates the current record in the primary file (see Me) applying any
specified referential integrity constraints, then returns a value indicating its success or failure.
Implementation: Update constraints are specified by the AddRelation method and they apply to
the values in the linking fields. If the constraint is RI:Restrict, the method does
not update the current record if the change would result in orphaned child
records. If the constraint is RI:Cascade, the method updates the primary file
record as well as the linking field values in any related child records. If the
constraint is RI:None, the method unconditionally updates only the primary file
record. If the constraint is RI:Clear, the method unconditionally updates the
primary file record, and clears the linking field values in any related child records.
Example:
ChangeOrder ROUTINE
IF Relate:Orders.Update(0) !update subject to constraints
MESSAGE('Update Failed') ! if fails, acknowledge
ELSE ! otherwise
POST(Event:CloseWindow) ! shut down
END
ReportManager Class
ReportManager Overview
The ReportManager is a WindowManager that uses a ProcessClass object to process report
records in the background, and optionally uses a PrintPreviewClass object to provide a full-
featured print preview facility.
ReportManager Concepts
The ReportManager supports a batch report procedure, complete with progress window, print
preview, DETAIL specific record filtering, and optimized sharing of machine resources.
The ReportManager uses the ProcessClass to manage the batch processing of the REPORT's
underlying VIEW. The ReportManager optionally uses the PrintPreviewClass to provide a full-
featured print preview for the report.
If your program instantiates the ReportManager, it should also instantiate the ProcessClass and
may need the PrintPreviewClass as well. Much of this is automatic when you INCLUDE the
ReportManager header (ABREPORT.INC) in your program's data section. See the Conceptual
Example.
1018 ABC Library Reference
The Report Procedure template and the Report Wizard Utility template automatically generate all
the code and include all the classes necessary to support your application's template generated
reports.
These Report templates generate code to instantiate a ReportManager object called ThisWindow
for each report procedure. The Report templates also instantiate a ProcessClass object and
optionally a PrintPreviewClass object for the ThisWindow object to use.
The ThisWindow object supports all the functionality specified in the Report template's Report
Properties dialog. See Procedure Templates--Report for more information.
The ReportManager source code is installed by default to the Clarion \LIBSRC folder. The
ReportManager 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 ReportManager and related objects.
This example uses the ReportManager object to preview a very simple report before printing it.
The program specifies a maximized print preview window.
PROGRAM
INCLUDE('ABREPORT.INC') !declare ReportManager &
! and PrintPreviewClass
MAP
END
GlobalErrors ErrorClass
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
report REPORT,AT(1000,1542,6000,7458),PRE(RPT),FONT('Arial',10,,),THOUS
HEADER,AT(1000,1000,6000,542),FONT(,,,FONT:bold)
STRING('Customers'),AT(2000,20),FONT(,14,,)
STRING('Id'),AT(52,313),TRN
STRING('Name'),AT(2052,313),TRN
STRING('State'),AT(4052,313),TRN
END
detail DETAIL,AT(,,6000,281),USE(?detail)
STRING(@n-14),AT(52,52),USE(CUS:CUSTNO)
STRING(@s30),AT(2052,52),USE(CUS:NAME)
1020 ABC Library Reference
STRING(@s2),AT(4052,52),USE(CUS:State)
END
FOOTER,AT(1000,9000,6000,219)
STRING(@pPage <<<#p),AT(5250,31),PAGENO,USE(?PageCount)
END
END
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(PctDone),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?TxtDone),CENTER
BUTTON('Cancel'),AT(45,42),USE(?Cancel)
END
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 0
SELF.LazyOpen = False
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
1022 ABC Library Reference
ReportManager Properties
The ReportManager inherits all the properties of the WindowManager class from which it is
derived. See WindowManager Properties for more information.
In addition to the inherited properties, the ReportManager contains the following properties:
The DeferOpenReport property gives you an opportunity to query the end user about items such
as filters and sort orders before the report starts printing.
Implementation: The Open and TakeWindowEvent methods implement the behavior specified by
the DeferOpenReport property.
The DeferWindow property gives you an opportunity to leave the progress window closed until
there are actual records to process.
The KeepVisible property controls whether the ReportManager closes the progress window
before or after the Print Preview window is displayed. A value of one (1 or True) delays the close
until after the Print Preview window is closed; a value of zero (0 or False) closes the window prior
to the Print Preview window open.
The KeepVisible property gives you an opportunity to leave the progress window open and
viewable with the Print Preview. Useful if you have results that you would like to display on the
progress window.
Implementation: The ReportManager only uses the OutputFileQueue property if the ReportTarget
property is active.
PrintPreviewFileQueue QUEUE,TYPE
Filename STRING(FILE:MaxFileName)
PrintPreviewImage STRING(FILE:MaxFileName),OVER(Filename)
END
ReportManager Class 1025
Implementation: The ReportManager only uses the PreviewQueue property if the Preview
property is set.
QueryControl SIGNED
The QueryControl property contains the number of the reports query control. This is typically the
value of the Query BUTTON's field equate. The ReportManager methods use this value to
process the report based on a user defined query.
Implementation: The Init method does not initialize the QueryControl property. You should
initialize the QueryControl property after the Init method is called. See the
Conceptual Example. On EVENT:Accepted for the QueryControl, the TakeEvent
method calls the TakeLocate method to collect (from the end user) and apply the
ad hoc query.
Report &WINDOW
The Report property is a reference to the managed REPORT structure. The ReportManager
uses this property to open, print, and close the REPORT.
Implementation: The TakeAccepted method of the PrintPreview Class and the SetReportTarget
method of the ReportManager sets the ReportTarget property.
SkipPreview BYTE
The SkipPreview property controls whether the ReportManager provides an on-line preview
when requested, or prints the report instead. A value of one (1 or True) prints rather than
previews the report; a value of zero (0 or False) previews the report. The SkipPreview property is
only effective if the Preview property is set.
The SkipPreview property lets you suppress the on-line print preview anytime before the
AskPreview method executes.
Implementation: The AskPreview method implements the behavior specified by the SkipPreview
property.
Implementation: The Init method of the PrintPreview Class sets the TargetSelector property.
Implementation: The Init method of the ReportManager sets the TargetSelectorCreated property.
TimeSlice USHORT
The TimeSlice property contains the amount of time in hundredths of a second the
ReportManager tries to "fill up" for each processing "cycle." A cycle begins with an EVENT:Timer
(see TIMER in the Language Reference), and ends about TimeSlice later. For example, for a
TimeSlice of 100, the ReportManager processes as many records as it can within about 100/100
(one) second before yielding control back to the operating system. To provide efficient sharing of
machine resources, we recommend setting the TIMER to something less than or equal to
TimeSlice.
Implementation: The Init method sets TimeSlice to one (100). The TakeWindowEvent method
continuously adjusts adjusts the number of records processed per cycle to fill the
specified TimeSlice--that is, to process as many records as possible within the
TimeSlice. This provides both efficient report processing and reasonable sharing
of machine resources, provided the TIMER value is less than or equal to the
TimeSlice value. This leaves the user in control in a multi-tasking environment,
especially when processing a large data set.
Implementation: The Ask method of the ReportManager implements the WaitCursor property.
Implementation: The Init method of the Reportmanger sets the WMFparser property.
Zoom SHORT
The Zoom property controls the initial zoom or magnification factor for the on-line report preview.
A value of zero (0) uses the PrintPreviewClass object's default zoom setting. Any other value
specifies the initial preview zoom factor.
The Zoom property lets you override the PrintPreviewClass object's default zoom setting. The
PrintPreviewClass object determines the actual zoom factor applied.
Implementation: The AskPreview method implements the behavior specified by the Zoom
property by passing the Zoom value to the PrintPreviewClass.Display method.
If the PrintPreviewClass object allows custom zoom factors, then the initial
magnification equals the Zoom value (81 gives 81%, 104 gives 104%, etc.). If the
PrintPreviewClass object only supports a limited set of discrete magnifications,
the initial magnification is the one closest to the Zoom value (81 gives 75%, 104
gives 100%, etc.).
ReportManager Methods
The ReportManager inherits all the methods of the WindowManager class from which it is
derived. See WindowManager 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.
The AddItem method registers an ABC Library interface with the ReportManager object
and adds the interface's specific functionality to the ReportManager.
Ask, VIRTUAL
The Ask method initiates the event processing (ACCEPT loop) for the report procedure. This
virtual method handles any special processing immediately before or after the report procedure's
event processing.
Implementation: The Run method calls the Ask method. The Ask method calls the PARENT.Ask
method to manage the ACCEPT loop for the report procedure.
Example:
MyReporter.Ask PROCEDURE
CODE
SETCURSOR(CURSOR:Wait) !special pre event handling code
PARENT.Ask !process events (ACCEPT)
SETCURSOR() !special post event handling code
AskPreview, VIRTUAL
The AskPreview method previews or prints the report, only if the Preview property references an
operative PrintPreviewClass object.
If the SkipPreview property is true, AskPreview does not preview the report, but prints it instead.
Implementation: The TakeCloseEvent method calls the AskPreview method to print or preview the
report. The AskPreview method calls the PrintPreviewClass.Display method to
preview the report.
Example:
MyReporter.TakeCloseEvent PROCEDURE
CODE
IF EVENT() = EVENT:CloseWindow
SELF.AskPreview()
IF ~SELF.Report&=NULL
CLOSE(SELF.Report)
END
END
RETURN Level:Benign
The CancelPrintReport method is a virtual method that allows you to write any clean up code to
execute when canceling in a Print Preview window.
Implementation: The AskPreview method CancelPrintReport method. The method is empty, but
generates an embed point to allow custom code to be implemented.
Example:
ReportManager.AskPreview PROCEDURE
CODE
IF NOT SELF.Report &= NULL AND SELF.Response = RequestCompleted
IF SELF.EndReport()=Level:Benign
IF NOT SELF.Preview &= NULL
IF CHOOSE (NOT SELF.SkipPreview, SELF.Preview.Display(SELF.Zoom), TRUE)
SELF.PrintReport()
ELSE
SELF.CancelPrintReport()
END
FREE(SELF.Preview.ImageQueue)
ELSE
SELF.PrintReport()
FREE(SELF.PreviewQueue)
END
ELSIF NOT SELF.Preview &= NULL
FREE(SELF.Preview.ImageQueue)
ELSE
FREE(SELF.PreviewQueue)
END
END
ReportManager Class 1035
CODE
IF NOT SELF.Report &= NULL AND SELF.Response = RequestCompleted
IF SELF.EndReport()= Level:Benign
IF NOT SELF.Preview &= NULL
IF CHOOSE (NOT SELF.SkipPreview, SELF.Preview.Display(SELF.Zoom), TRUE)
SELF.PrintReport()
ELSE
SELF.CancelPrintReport()
END
FREE(SELF.Preview.ImageQueue)
ELSE
SELF.PrintReport()
FREE(SELF.PreviewQueue)
END
ELSIF NOT SELF.Preview &= NULL
FREE(SELF.Preview.ImageQueue)
ELSE
FREE(SELF.PreviewQueue)
END
END
1036 ABC Library Reference
Implementation: Typically, the Init method calls the Init(process, report, preview) method to do
report-specific intialization. The Init method sets the Preview, Process, Report,
and TimeSlice properties.
Example:
PrintPhones PROCEDURE
report REPORT,AT(1000,1540,6000,7460),PRE(RPT)
detail DETAIL,AT(,,6000,280)
STRING(@s20),AT(50,50,5900,170),USE(PHO:Number)
END
END
Previewer PrintPreviewClass !declare Previewer object
Process ProcessClass !declare Process object
ThisWindow CLASS(ReportManager) !declare derived ThisWindow object
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
!procedure data
CODE
ThisWindow.Run !run the procedure (init,ask,kill)
ThisWindow.Init PROCEDURE()
CODE
!procedure code
ThisWindow.Init(Process,report,Previewer) !call the report-specific Init
!procedure code
Implementation: The Run method calls the Kill method. If the Dead property is True, Kill returns
Level:Notify and takes no other action. Otherwise, the Kill method, among other
things, calls the WindowManager.Kill method.
Example:
ThisWindow.Kill PROCEDURE()
CODE
IF PARENT.Kill() THEN RETURN Level:Notify.
IF FilesOpened
Relate:Defaults.Close
END
IF SELF.Opened
INIMgr.Update('Main',AppFrame)
END
GlobalResponse = CHOOSE(LocalResponse=0,RequestCancelled,LocalResponse)
Implementation: The Next method calls the ProcessClass.Next method to get the next report
record. When the report is completed or canceled, the Next method sets the
Response property and POSTs an EVENT:CloseWindow to end the progress
window procedure.
Example:
ReportManager.Open PROCEDURE
CODE
PARENT.Open
SELF.Process.Reset
IF ~SELF.Next()
IF ~SELF.Report&=NULL
OPEN(SELF.Report)
IF ~SELF.Preview &= NULL
SELF.Report{PROP:Preview} = SELF.PreviewQueue.Filename
END
END
END
Implementation: The TakeWindowEvent method calls the Open method. The Open method calls
the WindowManager.Open method, then conditionally (based on the
DeferOpenReport property) calls the OpenReport method to reset the
ProcessClass object and get the first report record.
Example:
WindowManager.TakeWindowEvent PROCEDURE
RVal BYTE(Level:Benign)
CODE
CASE EVENT()
OF EVENT:OpenWindow
IF ~BAND(SELF.Inited,1)
SELF.Open !handle EVENT:OpenWindow
END
IF SELF.FirstField
SELECT(SELF.FirstField)
END
OF EVENT:LoseFocus
IF SELF.ResetOnGainFocus
SELF.ForcedReset = 1
END
OF EVENT:GainFocus
IF BAND(SELF.Inited,1)
SELF.Reset
ELSE
SELF.Open !handle EVENT:GainFocus
END
OF EVENT:Completed
RVal = SELF.TakeCompleted()
OF EVENT:CloseWindow OROF EVENT:CloseDown
RVal = SELF.TakeCloseEvent()
END
RETURN RVal
Implementation: The TakeWindowEvent method or the Open method calls the OpenReport
method depending on the value of the DeferOpenReport property. The
OpenReport method calls the Process.Reset method to reset the ProcessClass
object, calls the Next method to get the first report record, then opens the
REPORT structure.
Example:
ReportManager.Open PROCEDURE
CODE
PARENT.Open
IF ~SELF.DeferOpenReport
SELF.OpenReport !call OpenReport if not deferred
END
MyReportManager.TakeWindowEvent PROCEDURE
!procedure data
CODE
IF EVENT() = EVENT:Timer
IF SELF.DeferOpenReport
SELF.OpenReport !if deferred, call OpenReport on timer
ELSE
!procedure code
ReportManager Class 1041
MyReportManager.OpenReport PROCEDURE
CODE
SELF.Process.SetFilter(UserFilter) !set dynamic filter
SELF.DeferOpenReport = 0
SELF.Process.Reset
IF ~SELF.Next()
IF ~SELF.Report&=NULL
OPEN(SELF.Report)
IF ~SELF.Preview &= NULL
SELF.Report{PROP:Preview} = SELF.PreviewQueue.Filename
END
END
END
The PrintReport method is used to determine where a report output will be redirected. Based on
the ReportTarget value, the report will be processed via the WMFparser, or as a standard report
is handled by the ProcessResultFiles method.
The ProcessResultFiles virtual method is provided as an entry point to process the contents of
the OutputFileQueue before the queue is freed and the report is either saved to disk in one of
several formats, or sent to the printer.
Example:
ReportManager.PrintReport PROCEDURE()
Rt BYTE
lIndex SHORT
CODE
! Used select the target at the beginning if this is not a standard report
IF NOT SELF.ReportTarget &= NULL THEN
IF RECORDS(SELF.PreviewQueue) THEN
IF SELF.ReportTarget.SupportResultQueue()=True THEN
SELF.ReportTarget.SetResultQueue(SELF.OutputFileQueue)
END
IF SELF.ReportTarget.AskProperties(False)=Level:Benign THEN
SELF.WMFParser.Init(SELF.PreviewQueue, SELF.ReportTarget, SELF.Errors)
IF SELF.WMFParser.GenerateReport()=Level:Benign THEN
IF SELF.ReportTarget.SupportResultQueue()=True THEN
Rt = SELF.ProcessResultFiles(SELF.OutputFileQueue) !after generating
END
END
END
END
ELSE
FREE(SELF.OutputFileQueue)
LOOP lIndex=1 TO RECORDS(SELF.PreviewQueue)
GET(SELF.PreviewQueue,lIndex)
IF NOT ERRORCODE() THEN
SELF.OutputFileQueue.FileName = SELF.PreviewQueue.FileName
ADD(SELF.OutputFileQueue)
END
END
!prior to flushing to printer
IF SELF.ProcessResultFiles(SELF.OutputFileQueue)=Level:Benign THEN
SELF.Report{PROP:FlushPreview} = True
ELSE
SELF.Report{PROP:FlushPreview} = FALSE
END
END
ReportManager Class 1043
The SetReportTarget method sets the report’s target output as passed by the IReportGenerator
interface. This target can be text, HTML, PDF or XML formats.
Example:
ReportManager.Open PROCEDURE
CODE
PARENT.Open
IF ~SELF.DeferOpenReport
SELF.OpenReport
IF NOT SELF.OpenFailed THEN
IF SELF.Report{PROPPRINT:Extend}=1 THEN
SELF.SetStaticControlsAttributes()
END
END
END
1044 ABC Library Reference
Example:
ReportManager.TakeRecord PROCEDURE
I LONG,AUTO
RVal BYTE(Level:Benign)
CODE
IF ~SELF.BreakMan &= NULL THEN
SELF.BreakMan.AskBreak()
END
IF SELF.Report{PROPPRINT:Extend}=1 THEN
SELF.SetDynamicControlsAttributes()
END
RVal = SELF.Process.TakeRecord()
DO CheckState
LOOP I = 1 TO RECORDS(SELF.Processors)
GET(SELF.Processors,I)
RVal = SELF.Processors.P.TakeRecord()
DO CheckState
END
IF SELF.Next() THEN
TARGET{PROP:Timer} = 0
RETURN Level:Notify
END
RETURN Rval
TakeCloseEvent returns returns Level:Benign to indicate processing of this event should continue
normally; it returns Level:Notify to indicate processing is completed for this event and the
ACCEPT loop should CYCLE; it returns Level:Fatal to indicate the event could not be processed
and the ACCEPT loop should BREAK.
Implementation: The TakeEvent method calls the TakeCloseEvent method. The TakeCloseEvent
method calls the AskPreview method to preview or print the report, then closes
the report.
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
TakeNoRecords, VIRTUAL
The TakeNoRecords method implements any special processing required for a report with no
records.
Implementation: The OpenReport method calls the TakeNoRecords method. The TakeNoRecords
method issues a message indicating there are no records, and therefore no
report.
You can use the TakeNoRecords method to print a page indicating an empty
report. The default action is to issue the message and print nothing.
Example:
MyReportr.TakeNoRecords PROCEDURE
CODE
PARENT.TakeNoRecords
CLI:CustomerName = 'No Customers'
PRINT(CustomerDetail)
TakeWindowEvent calls the TakeRecord method and the Next method for each
record within a processing cycle.
TakeWindowEvent adjusts the number of records processed per cycle to fill the
TimeSlice and optimize sharing of machine resources.
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
RuleManager
Overview
The Rule Manager classes work together to provide a central repository for business
rules logic and a methodology for checking and responding to business rules in Clarion
procedures. The Rule Manager classes also provide the option of visual indicators when
a rule has been broken and conditional hiding or disabling of controls in the presence of
broken rules.
The result is that code for validating a particular column is repeated in multiple places
throughout the application, providing opportunities for inconsistency and, as the system
grows, creating a maintenance nightmare.
The Rule Manager Classes and associated templates provide a mechanism for
centralizing validation code so that validation, wherever it is needed, is always provided
in exactly the same way by code which can be maintained in a single, central location.
In addition, the Rule Manager Classes provide facilities for identifying broken rules in a
convenient manner and enforcing rules through selective disabling or hiding of controls.
RuleManager Concepts
Rule Manager is implemented by a set of three classes:
• The Rule CLASS stores the definition of, and provides a method for testing, a single rule.
Visual Indicators
Each Rule object within the RulesCollection object has the option of displaying a small
button with an image next to a specified control when the rule has been checked and
found to be broken.
Evaluation of rules
When a rule is checked, the EVALUATE() function is called internally by the
RuleUsBroken() method. Therefore all variables used by a BrokenRulesManager object
need to be explicitly bound. If the result of the EVALUATE() returns FALSE, it means that
the rule has been broken.
Three templates support the use of the Rule Manager classes. They are:
• The Global Business Rules Manager, which establishes logical connections between
business rules and particular table columns, other fields, and controls.
• The Local Business Rules Manager, which implements global rules wherever relevant
items are populated and allows for the addition of local rules having effect in only one
procedure. The Local Business Rules Manager is automatically added to every
procedure in any application which contains the Global Business Rules Manager.
• A code template, the Error Handler for Business Rules, which provides enhanced
functionality where needed.
INCLUDE('ABRULES.INC'),ONCE
INCLUDE('ABTOOLBA.INC'),ONCE
INCLUDE('ABWINDOW.INC'),ONCE
MAP
INCLUDE('APP001.INC'),ONCE !Local module procedure declarations
1052 ABC Library Reference
END
CusName STRING(20)
CusAddress STRING(20)
CusPhone STRING(10)
CustomerRules &RuleManager !Rule manager for Rules for the customer
Window WINDOW('Example of using RulesManager'),AT(,,169,124), FONT(,,,,CHARSET:ANSI),|
GRAY,DOUBLE
SHEET,AT(3,4,159,116),USE(?Sheet1)
TAB('Customer Info'),USE(?Tab1)
SHEET,AT(8,26,149,62),USE(?Sheet2)
TAB('Name'),USE(?Tab3)
ENTRY(@s20),AT(51,55,60,10),USE(CusName),IMM
PROMPT('Cus Name:'),AT(13,55),USE(?CusName:Prompt)
END
TAB('Address'),USE(?Tab4)
PROMPT('Cus Address:'),AT(12,53),USE(?CusAddress:Prompt)
ENTRY(@s20),AT(69,53,60,10),USE(CusAddress),IMM
END
TAB('Phone'),USE(?Tab5)
PROMPT('Cus Phone:'),AT(12,52),USE(?CusPhone:Prompt)
ENTRY(@s10),AT(69,50,60,10),USE(CusPhone),IMM
END
END
BUTTON('OK'),AT(118,96,32,14),USE(?Button:OK),STD(STD:Close)
BUTTON('View Customer Broken Rules'),AT(8,95,101,14),USE(?Button:ListAll)
END
END
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,DERIVED
Kill PROCEDURE(),BYTE,PROC,DERIVED
TakeAccepted PROCEDURE(),BYTE,PROC,DERIVED
TakeFieldEvent PROCEDURE(),BYTE,PROC,DERIVED
TakeNewSelection PROCEDURE(),BYTE,PROC,DERIVED
END
Toolbar ToolbarClass
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
CODE
GlobalErrors.SetProcedureName('Main')
RuleManager 1053
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
!Define RulesManager
CustomerRules &= New(RuleManager)
CustomerRules.SetErrorImage('~SMCROSS.ICO')
CustomerRules.SetDescription('Rules for the customer')
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
GlobalErrors.SetProcedureName
RETURN ReturnValue
1054 ABC Library Reference
ThisWindow.TakeAccepted PROCEDURE
ReturnValue BYTE,AUTO
Looped BYTE
CODE
!Pass the Accepted control to RulesManager for processing in case
!the control clicked was an error indicator. If it was an error indicator,
!a MessageBox containing the description of the broken rule will be displayed
CustomerRules.TakeAccepted(Accepted())
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
ReturnValue = PARENT.TakeAccepted()
CASE ACCEPTED()
OF ?Button:ListAll
ThisWindow.Update
!This will Cause a window to popup that contains a list of all broken rules,
!and if the user double clicked one of the rules in the list, the relevant
!control will be selected.
Select(CustomerRules.EnumerateBrokenRules|
(CustomerRules.GetDescription(),CustomerRules.GetErrorImage()))
END
RETURN ReturnValue
END
ReturnValue = Level:Fatal
RETURN ReturnValue
ThisWindow.TakeFieldEvent PROCEDURE
ReturnValue BYTE,AUTO
Looped BYTE
CODE
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
?Button:ListAll{Prop:Hide} = Choose(CustomerRules.BrokenRuleCount() = 0)
ReturnValue = PARENT.TakeFieldEvent()
RETURN ReturnValue
END
ReturnValue = Level:Fatal
RETURN ReturnValue
ThisWindow.TakeNewSelection PROCEDURE
ReturnValue BYTE,AUTO
Looped BYTE
CODE
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
ReturnValue = PARENT.TakeNewSelection()
CASE FIELD()
OF ?CusName
UPDATE
CustomerRules.CheckRule('CusNameReq',1)!Check for broken rule in RulesManager
OF ?CusAddress
UPDATE
CustomerRules.CheckRule('AddReq',1) !Checking for broken rule in RulesManager
OF ?CusPhone
UPDATE
CustomerRules.CheckRule('PhoneReq',1)!Checking for broken rule in RulesManager
END
RETURN ReturnValue
END
ReturnValue = Level:Fatal
RETURN ReturnValue
1056 ABC Library Reference
1. Identify specific rules and assign each rule a name. For example, if Cus:Name is
required, call it CusNameReq.
2. For each rule, write a line of code that returns the value of TRUE when the rule is
unbroken. For example, if Cus:Name is required, the corresponding code will be:
Len(Clip(Cus:Name)) > 0
CustomerRules.AddRule|
('Addreq','Customer address is required if customer name is not
"Unknown"',|
'Choose(Upper(Clip(CusName))<<>''UNKNOWN'' and |
len(Clip(CusAddress))=0,0,1)',?CusAddress,3)
!A small button with the icon SMCROSS.ICO' will be displayed 3 pixels to
the left of !?CusAddress when the expression evaluates to false
RuleManager 1057
(CustomerRules.GetDescription(),CustomerRules.GetErrorImage()))
!Call a popup listbox of broken rules, and use the default RulesManager
icon as an icon. !If the user double clicks one of the broken rules, the
corresponding control will be !selected.
1058 ABC Library Reference
Although all of the properties of the Rule class are PRIVATE, public access to these
properties is provided by a set of methods:
GetName( ) returns a STRING containing the Name property.
GetExpression( ) returns a STRING containing the Expression property.
GetControlNum( ) returns a LONG containing the ControlNum Property
GetDescription( ) returns a STRING containing the Description property
GetErrorIndicator( ) returns a LONG containing the ErrorIndicator property
GetErrorImage( ) returns a STRING containing the ErrorImage property
GetIsBroken( ) returns a LONG containing the IsBroken property
GetOffsetRight( ) returns a LONG containing the OffsetRight property
Example:
RulesCollection.AddRule PROCEDURE(STRING RuleName,STRING RuleDescription,|
STRING RuleExpression,<LONG ControlNum>,|
LONG OSR=3)
Counter LONG
Found BYTE
CODE
SELF.BrokenRuleQueue.BrokenRuleInstance &= NEW(Rule)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetName(RuleName)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetExpression(RuleExpression)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetDescription(RuleDescription)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetErrorImage(SELF.ErrorImage)
IF ~OMITTED(5)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetControlNum(ControlNum)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetErrorIndicator(ControlNum+1000)
SELF.BrokenRuleQueue.BrokenRuleInstance.SetOffsetRight(OSR)
END
ADD(SELF.BrokenRuleQueue)
RuleManager 1061
SetGlobalRule
Example:
Rule.RuleIsBroken PROCEDURE(Byte DisplayIndicator)
RetVal LONG
EvaluateResults byte
CODE
SELF.SetGlobalRule
EvaluateResults = EVALUATE(SELF.Expression)
IF INLIST(ERRORCODE(),800,810,1011)
RetVal = ERRORCODE()
STOP('Evaluate Syntax error’)
ELSE
RetVal = CHOOSE(EvaluateResults = 0,1,0)
SELF.SetIsBroken(RetVal)
IF DisplayIndicator
SELF.SetIndicator(RetVal)
END
END
SELF.ResetGlobalRule
RETURN(RetVal)
ResetGlobalRule
Example:
Rule.RuleIsBroken PROCEDURE(Byte DisplayIndicator)
RetVal LONG
EvaluateResults byte
CODE
SELF.SetGlobalRule
EvaluateResults = EVALUATE(SELF.Expression)
IF INLIST(ERRORCODE(),800,810,1011)
RetVal = ERRORCODE()
STOP('Evaluate Syntax error’)
ELSE
RetVal = CHOOSE(EvaluateResults = 0,1,0)
SELF.SetIsBroken(RetVal)
IF DisplayIndicator
SELF.SetIndicator(RetVal)
END
END
SELF.ResetGlobalRule
RETURN(RetVal)
RuleIsBroken( display )
Implementation: The RuleIsBroken method relies on the EVALUATE function to test a string
containing an expression. Accordingly, all names used in the expression must be
bound. If a procedure name is used, it must return a STRING, REAL or LONG
value. If the procedures accept parameters, those paramaters must be STRINGs
passed by value and may not be omittable.
The RuleIsBroken method tests explicitly for errors related to the EVALUATE
process and ignores errors which might be posted by called procedures. These
procedures must therefore handle any errors which may be posted during their
execution.
Example:
RulesCollection.CheckAllRules Procedure(<BYTE DisplayIndicator>)
RetVal LONG
LBR &Rule
Counter LONG
Recs LONG
lIsBroken BYTE
CODE
Recs = SELF.RuleCount()
Retval = 0
LOOP Counter = 1 TO Recs
LBR &= SELF.Item(Counter)
lIsBroken= LBR.RuleIsBroken(DisplayIndicator)
RetVal +=lIsBroken
END
IF SELF.ChangeControlsStatus
SELF.SetControlsStatus()
END
RETURN(RetVal)
SetIndicator( broken )
The SetIndicator method creates or destroys an error indicator as appropriate.
broken An integer constant, variable, EQUATE, or expression that indicates whether the
current rule is broken.
Implementation: The SetIndicator method destroys any previously created error indicator for this
rule and conditionally creates a new one.
Example:
RetVal = CHOOSE(EvaluateResults = 0,1,0)
SELF.SetIsBroken(RetVal)
IF DisplayIndicator
SELF.SetIndicator(RetVal)
END
RuleManager 1065
Construct
Destruct
Destruct Performs necessary cleanup prior to the disposal of the RulesCollection object.
The Destruct method is executed automatically when the object is disposed of.
RuleCount()
RuleCount Returns the number of rules being monitored by this RulesCollection object.
Example:
NumberOfRules = SELF.RuleCount()
Example:
CustomerRules RulesCollection
CODE
... code omitted ...
BrokenRules = CustomerRules.BrokenRuleCount()
RuleManager 1067
AddRule( name,description,expression,control,offset)
AddRule Adds and initializes a rule to the collection being managed by this RuleManager
object
name A string constant, variable, EQUATE, or expression that contains a name for this
rule. If this name is not unique, results may be unpredictable.
description A string constant, variable, EQUATE, or expression that contains a description of
this rule. The primary use of this description is as a message identifying a broken
rule. The description should be worded with this use in mind.
expression A string constant, variable, EQUATE, or expression that contains the logical
expression which defines this rule. If the expression evaluates to False, the rule
is considered broken.
control A numeric constant, variable, EQUATE, or expression that specifies the Field
Equate of the control linked to this rule. If the rule is broken, an error indicator will
be placed to the right of this control.
offset A numeric constant, variable, EQUATE, or expression that specifies the distance,
in dialog units, between the right side of the linked control and the error indicator.
The AddRule method creates a Rule object and adds it to the broken rule queue.
Example:
Customer RulesCollection
CODE
Customer.SetErrorImage('~BRuleNo.ico')
Customer.SetDescription('Customer File Rules')
Customer.AddRule('ShortNameReqiored','Short name is required', |
'cus:ShortName <<> '''' OR CheckShortName()', |
?cus:ShortName,3)
Customer.AddRule('Company Boolean','Must select individual (0) or company (1)', |
'INRANGE(cus:Company,0,1)',?cus:Company,3)
Customer.AddRule('CompanyNameRequired','Company name is required', |
'cus:CompanyName <<> '''' OR NOT cus:Company',?cus:CompanyName,3)
Customer.AddRule('LastNameRequired','Last name is required', |
'cus:LastName <<> '''' OR cus:Company',?cus:LastName,3)
Customer.AddRule('CityRequired','City is required','cus:City <<> ''''',?cus:City,3)
Customer.AddRule('StateRequired','State is required','cus:State <<> ''''',?cus:State,
Customer.AddRule('ZipOK','Postal code must have valid format.',
'CheckCustomerZip()',?cus:ZipCode,3)
Customer.AddRule('CreditLimit','Credit limit must not exceed $1000.00',
'cus:CreditLimit =<< 1000',?cus:CreditLimit,3)
1068 ABC Library Reference
AddControl( feq,action )
AddControl Adds a control to the controls queue so that a specified action is taken when any
rule in the managed collection is broken.
feq A numeric constant, variable, EQUATE, or expression that indicates the Field
Equate number of a control whose hidden or disabled status will be determined
by the existence of one or more broken rules.
action A numeric constant, variable, EQUATE, or expression that indicates the action to
be taken with respect to this control when a rule is broken, defined as follows:
RuleAction:None EQUATE(0)
RuleAction:Hide EQUATE(1)
RuleAction:UnHide EQUATE(2)
RuleAction:Disable EQUATE(3)
RuleAction:Enable EQUATE(4)
Example:
Customer.SetErrorImage('~BRuleNo.ico')
Customer.SetDescription('Customer File Rules')
Customer.AddRule('StateRequired','State is required','cus:State <<> ''''',?cus:State,
Customer.AddRule('ZipOK','Postal code must have valid format.',
'CheckCustomerZip()',?cus:ZipCode,3)
Customer.AddRule('CreditLimit','Credit limit must not exceed $1000.00',
'cus:CreditLimit =<< 1000',?cus:CreditLimit,3)
Customer.AddControl(?Ok,RuleAction:Disable) ! Disable OK button if any rule broken
RuleManager 1069
AddControlToRule( rule,feq,action )
AddControlToRule Adds a control to the controls queue so that a specified action is taken
when a particular rule in the managed collection is broken.
rule A string constant, variable, EQUATE, or expression that contains the name of
this rule. If rule names are not unique within the collection managed by this
RuleManager object, results may be unpredictable.
feq A numeric constant, variable, EQUATE, or expression that indicates the Field
Equate number of a control whose hidden or disabled status will be determined
by the status of this rule.
action A numeric constant, variable, EQUATE, or expression that indicates the action to
be taken with respect to this control when a rule is broken, defined as follows:
RuleAction:None EQUATE(0)
RuleAction:Hide EQUATE(1)
RuleAction:UnHide EQUATE(2)
RuleAction:Disable EQUATE(3)
RuleAction:Enable EQUATE(4)
Example:
Customer.SetErrorImage('~BRuleNo.ico')
Customer.SetDescription('Customer File Rules')
Customer.AddRule('StateRequired','State is required','cus:State <<> ''''',?cus:State,
Customer.AddRule('ZipOK','Postal code must have valid format.',
'CheckCustomerZip()',?cus:ZipCode,3)
Customer.AddControlToRule(‘StateRequired, ?cus:ZipCode,RuleAction:Hide)
! Hide Zip Code field until state is filled in.
1070 ABC Library Reference
CheckRule( rule,display)
CheckRule Checks a particular rule and optionally sets the error indicator for its associated
control.
rule A string constant, variable, EQUATE, or expression that contains the name of
this rule. If rule names are not unique within the collection managed by this
RuleManager object, results may be unpredictable.
display A Boolean constant, variable, EQUATE, or expression that, if True, will cause the
error indicator to be set for the control associated with this rule.
Return Data Type: BYTE
Example:
Customer.CheckRule(ZipOK,True) ! Validate zip code and set indicator if invalid
CheckAllRules( display)
CheckAllRules Checks all rules in the collection managed by this FileManager object and
optionally sets the error indicators controls associated with those rules.
display A Boolean constant, variable, EQUATE, or expression that, if True, will cause the
error indicator to be set for the control associated with this rule.
Return Data Type: LONG
Example:
Customer.CheckAllRules(False) ! Validate all fields but do not set indicators.
RuleManager 1071
Item Locates a specified rule and retrieves its entry from the broken rule queue. t.
rulename A string constant, variable, EQUATE, or expression that contains the name of the
rule to be located. If rule names are not unique within the collection managed by
this RuleManager object, results may be unpredictable.
position A string constant, variable, EQUATE, or expression that contains a numeric
value corresponding to the position in the broken rule queue of the rule to be
located.
The Item method locates the specified rule and returns the address of its Rule object. If the
specified rule name does not exist in the broken rule queue or if the specified position is outside
the range of entries in the broken rule queue, the Item method returns zero.
Example:
RulesCollection.BrokenRuleCount PROCEDURE
LBR &Rule
NumberOfRules LONG
Counter LONG
RetVal LONG
CODE
NumberOfRules = SELF.RuleCount()
LOOP Counter = 1 TO NumberOfRules
LBR &= SELF.Item(Counter)
IF LBR.GetIsBroken()
Retval += 1
END
END
RETURN(Retval)
1072 ABC Library Reference
TakeAccepted( control )
TakeAccepted Determines whether or not the specified control is an error indicator for one of the
Rule objects managed by this RulesCollection object. If so, the TakeAccepted
method displays the description of the rule and provides the user with an option
to view the status of all broken rules.
control A numeric constant, variable, EQUATE, or expression that contains a field
equate value. The control indicated by this value is assumed to have been
Accepted.
Return Data Type: BYTE
Implementation: When the control that has been accepted is an error indicator, the description of
the associated rule is displayed in a message box. This message box always
provides a Close button. If the total number of broken rules found exceeds one, a
second button offers to display all of them. If the Supervisor property is not
NULL, this RulesCollection object uses that property to access the
EnumerateBrokenRules method of its supervising RulesManagerObject rather
than its own. As a result, the user gets a full list of broken rules even when the
controls on a screen involve rules from more than one collection.
Example:
ThisWindow.TakeAccepted PROCEDURE
ReturnValue BYTE,AUTO
Looped BYTE
CODE
Customer.TakeAccepted(Accepted())! RulesCollection traps to determine if
! error-indicator was clicked
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
CASE ACCEPTED()
END
EMD
SetEnumerateIcons Sets the icons for the display produced by the EnumerateBrokenRules
method.
windowicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on the title bar of the broken rules listing.
validicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on lines containing valid rules.
brokenicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on lines containing broken rules.
Return Data Type: LONG
Example:
Customer. SetEnumerateIcons('~BRules.ico','~BRuleOk.ico', |
'~BRuleNo.ico')
EnumerateBrokenRules( header,brokenonly )
Example:
IF MESSAGE(Desc,'Error Information',ICON:ASTERISK,'Close |' & MoreString) = 2
SelectControl = SELF.EnumerateBrokenRules(SELF.GetDescription())
IF SelectControl
SELECT(SelectControl)
END
END
Example:
RulesCollection.SetControlsStatus PROCEDURE
lIndex LONG
lIndex2 LONG
lChange BYTE
CODE
LOOP lIndex=1 TO RECORDS(SELF.Controls)
GET(SELF.Controls,lIndex)
IF ERRORCODE() THEN BREAK.
SELF.SetControlsStatus(SELF.Controls.Control,pAction)
END
1076 ABC Library Reference
Example:
lActionExist = RuleAction:None
lChange = SELF.NeedChangeControlStatus(pControlFeq,pAction,lActionExist)
IF lActionExist<>pAction THEN RETURN.
RuleManager 1077
RulesManager Properties
The RulesManager Class contains no public properties.
RulesManager Methods
Access Methods
Although most of the properties of the RulesCollection class are PRIVATE, public access to these
properties is provided by a set of methods:
GetChangeControls() returns a BYTE containing the ChangeControlsStatus property
SetChangeControls( status ) sets the ChangeControlsStatus property
RulesManagerCount()
RuleManagerCount Returns the number of RulesCollection objects being monitored by this
RulesCollection object.
Example:
NumberOfRulesCollections = SELF.RulesManagerCount()
BrokenRulesCount()
BrokenRulesCount Returns the number of rules being monitored, by all of the
RulesCollection objects managed by this RulesManager object, which
are broken.
Example:
BrokenRules = SELF.BrokenRuleCount()
RuleManager 1079
AddRulesCollection( RulesCollection )
Example:
BusinessRulesManager.AddRulesCollection(Customer)
BusinessRulesManager.SetEnumerateIcons('~BRules.ico','~BRuleOk.ico', |
'~BRuleNo.ico')
BusinessRulesManager.AddControl(?Ok,RuleAction:Disable)
BusinessRulesManager.SetGlobalRuleReferences(GlobalRule)
CheckAllRules Checks all rules in the collections (RulesCollection objects) managed by this
FilesManager object, optionally sets the error indicators controls associated with
those rules, and returns a count of broken rules.
display A Boolean constant, variable, EQUATE, or expression that, if True, will cause the
error indicator to be set for the control associated with this rule.
Return Data Type: LONG
Example:
BusinessRulesManager.CheckAllRules(True) ! Validate all fields and set indicators.
1080 ABC Library Reference
TakeAccepted( control )
TakeAccepted Determines whether or not the specified control is an error indicator for one of the
Rule objects monitored by RulesCollection objects which are in turn managed by
this RulesManager object. If so, the TakeAccepted method displays the
description of the rule and provides the user with an option to view the status of
all broken rules.
control A numeric constant, variable, EQUATE, or expression that contains a field
equate value. The control indicated by this value is assumed to have been
Accepted.
Return Data Type: BYTE
Example:
ThisWindow.TakeAccepted PROCEDURE
ReturnValue BYTE,AUTO
Looped BYTE
CODE
BusinessRulesManager.TakeAccepted(Accepted())! RulesManager trap to determine
! if error-indicator was clicked
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
CASE ACCEPTED()
END
EMD
RuleManager 1081
SetEnumerateIcons Sets the icons for the display produced by the EnumerateBrokenRules
method.
windowicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on the title bar of the broken rules listing.
validicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on lines containing valid rules.
brokenicon A string constant, variable, EQUATE, or expression that contains the file name of
the icon which will appear on lines containing broken rules.
Return Data Type: LONG
Example:
BusinessRulesManager.SetEnumerateIcons('~BRules.ico','~BRuleOk.ico', |
'~BRuleNo.ico')
EnumerateBrokenRules( header,brokenonly )
EnumerateBrokenRules
Displays a list of the rules monitored by RulesCollection objects which in turn are
managed by this RulesManager object.
header A string constant, variable, EQUATE, or expression that contains a header to be
displayed in the title bar of the enumerated rules display.
broken A Boolean constant, variable, EQUATE, or expression that, if True, causes the
EnumerateBrokenRules method to display only rules which are broken.
The EnumerateBrokenRules method provides a convenient way to display the set of rules (or
broken rules) monitored by RulesCollection objects managed by this RulesManager object. If the
user selects a rule from this display, the field equate of the control associated with that rule is
returned, allowing the appropriate field to be SELECTed,
Example:
IF MESSAGE(Desc,'Error Information',ICON:ASTERISK,'Close |' & MoreString) = 2
SelectControl = SELF.EnumerateBrokenRules(SELF.GetDescription(), |
SELF.GetErrorImage())
IF SelectControl
SELECT(SelectControl)
END
END
SetControlsStatus( )
SetControlsStatus
Sets the hidden or disabled status of a control or controls managed by this
RulesManager object and by RulesCollection objects assigned to this
RulesManager object.
The SetControlsStatus method sets the status of controls managed by this RulesManager
object and subsidiary RulesCollection objects.
1084 ABC Library Reference
SelectFileClass 1085
SelectFileClass
SelectFileClass Concepts
The SelectFileClass object manages the Windows File Dialog--both 16-bit (short filenames) and
32-bit versions (long filenames)--to select a single file or multiple files.
The ASCIIViewerClass uses the the SelectFileClass to let the end user choose the file to view.
Otherwise, the SelectFileClass is completely independent of other Application Builder Classes.
The class is named SelectFile# where # is the instance number of the DOSFileLookup control
template. The template provides the derived class so you can use the Classes tab to easily
modify the select file behavior on an instance-by-instance basis.
The SelectFileClass source code is installed by default to the Clarion \LIBSRC folder. The
SelectFileClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a SelectFileClass object. This example displays a dialog that alternatively
allows single file or multi-file selection.
PROGRAM
INCLUDE('ABUTIL.INC') !declare SelectFileClass
MAP
END
SelectFile SelectFileClass !declare SelectFile object
FileQ SelectFileQueue !declare FileName QUEUE
FileQCount USHORT,AUTO !declare Q counter
FileNames CSTRING(255) !variable to hold file names
FileMask CSTRING('Text *.txt|*.txt|All *.*|*.*') !File dialog file masks
MultiFiles BYTE !single/multiple file switch
GetFile WINDOW('Select File'),AT(,,173,40),SYSTEM,GRAY,RESIZE
ENTRY(@s254),AT(6,6,144,12),USE(FileNames)
BUTTON('...'),AT(156,6,12,12),USE(?SelectFiles)
OPTION,AT(6,20,),USE(MultiFiles)
RADIO('One File'),AT(5,25),USE(?1File),VALUE('0')
RADIO('Multiple Files'),AT(45,25),USE(?MultiFile),VALUE('1')
END
BUTTON('Close'),AT(119,24),USE(?Close)
END
CODE
OPEN(GetFile)
ACCEPT
IF EVENT() = EVENT:OpenWindow !on open window
SelectFile.Init !initialize SelectFile object
SelectFile.AddMask('Clarion source|*.clw;*.inc') !set default file mask
SelectFile.AddMask(FileMask) !set additional file masks
END
SelectFileClass 1087
CASE FIELD()
OF ?SelectFiles !on get file button
IF EVENT() = EVENT:Accepted !if user clicked it
IF MultiFiles !if multiple files requested
SelectFile.WindowTitle='Select multiple files' !set file dialog titlebar
SelectFile.Ask(FileQ,0) !display file dialog
LOOP FileQCount=1 TO RECORDS(FileQ) !for each selected file
GET(FileQ,FileQCount) !get the file information
MESSAGE(FileQ.Name) !process the file
END
ELSE !if single file requested
SelectFile.WindowTitle = 'Select one file' !set file dialog titlebar
FileNames = SelectFile.Ask(1) !display file dialog
DISPLAY(?FileNames) !redraw Filenames field
END
END
OF ?Close !on close button
IF EVENT() = EVENT:Accepted !if user clicked it
POST(Event:CloseWindow) !shut down
END
END
END
1088 ABC Library Reference
SelectFileClass Properties
The SelectFileClass contains the following properties.
DefaultDirectory CSTRING(File:MaxFilePath)
The DefaultDirectory property contains the directory the Windows file dialog initially opens to. If
DefaultDirectory is null, the file dialog opens to the current directory.
DefaultFile CSTRING(File:MaxFilePath)
The DefaultFile property contains the filename that initially appears in the Windows file dialog
filename field. The filename may contain wildcard characters such as * to filter the file dialog's file
list.
SelectFileClass 1089
Flags BYTE
The Flags property is a bitmap that indicates the type of file action the Windows file dialog
performs (select, multi-select, save directory, lock directory, suppress errors). The Flags property
operates identically to the FILEDIALOG flag parameter. See FILEDIALOG in the Language
Reference for more information.
Implementation: The Init method sets the Flags property to its default value declared in
ABUTIL.TRN--select a file from any directory.
WindowTitle CSTRING(80)
The WindowTitle property contains a string that sets the title bar text in the Windows file dialog.
Implementation: The Init method sets the WindowTitle property to its default value declared in
ABUTIL.TRN. The SelectFileClass uses the WindowTitle property as the title
parameter to the FILEDIALOG function. See FILEDIALOG in the Language
Reference for more information.
SelectFileClass Methods
AddMask (add file dialog file masks)
| mask string |
AddMask Adds file masks to the file dialog's List Files of Type drop-down list.
description A string constant, variable, EQUATE, or expression that contains a file mask
description such as 'all files-*.*' or 'source files-*.inc;*.clw'. The mask value may
be included in the description for information only.
masks A string constant, variable, EQUATE, or expression that defines the file mask or
masks corresponding to the description, such as '*.*' or '*.inc;*.clw'. Multiple
masks are separated by a semi-colon (;).
mask string A string constant, variable, EQUATE, or expression that defines both the file
masks and their descriptions.
The AddMask method adds file masks and their descriptions to the file dialog's List Files of
Type drop-down list. The first mask is the default selection in the file dialog.
The mask string parameter must 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.
Example:
FileMask CSTRING('Text *.txt|*.txt|All *.*|*.*') !File dialog file masks
CODE
!program code
IF EVENT() = EVENT:OpenWindow !on open window
SelectFile.Init !initialize SelectFile object
SelectFile.SetMask('Clarion source','*.clw;*.inc')!set default file mask
SelectFile.AddMask(FileMask) !set additional file masks
END
Implementation: The file queue parameter must name a QUEUE that begins the same as the
SelectFileQueue structure declared in ABUTIL.INC:
SelectFileQueue QUEUE,TYPE
Name STRING(File:MaxFilePath)
ShortName STRING(File:MaxFilePath)
END
Example:
FileQ SelectFileQueue !declare FileName QUEUE
FileQCount BYTE
CODE
!program code
SelectFile.Ask(FileQ,0) !multi file dialog, don't restore directory
LOOP FileQCount=1 TO RECORDS(FileQ) !for each selected file
GET(FileQ,FileQCount) !get the file information
MESSAGE(FileQ.Name) !process the file
END
Init
The Init method initializes the SelectFileClass object.
Implementation: The Init method WindowTitle and Flags properties to their default values declared
in ABUTIL.TRN.
Example:
IF EVENT() = EVENT:OpenWindow !on open window
SelectFile.Init !initialize SelectFile object
SelectFile.AddMask('Clarion source|*.clw;*.inc') !set default file mask
SelectFile.AddMask(FileMask) !set additional file masks
END
| mask string |
SetMask Sets the file masks available in the file dialog's List Files of Type drop-down list.
description A string constant, variable, EQUATE, or expression that contains a file mask
description such as 'all files-*.*' or 'source files-*.inc;*.clw'. The mask value may
be included in the description for information only.
masks A string constant, variable, EQUATE, or expression that defines the file mask or
masks corresponding to the description, such as '*.*' or '*.inc;*.clw'. Multiple
masks are separated by a semi-colon (;).
mask string A string constant, variable, EQUATE, or expression that defines both the file
masks and their descriptions.
The SetMask method sets the file masks and their descriptions available in the file dialog's List
Files of Type drop-down list. The first mask is the default selection in the file dialog.
The mask string parameter must 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.
Example:
FileMask CSTRING('Text *.txt|*.txt|All *.*|*.*') !File dialog file masks
CODE
!program code
IF EVENT() = EVENT:OpenWindow !on open window
SelectFile.Init !initialize SelectFile object
SelectFile.SetMask('Clarion source','*.clw;*.inc')!set default file mask
SelectFile.AddMask(FileMask) !set additional file masks
END
StandardBehavior Class
StandardBehavior Overview
The StandardBehavior class provides a central point for specification of standard basic browse
behavior.
StandardBehavior Properties
The StandardBehavior class contains no public properties.
StandardBehavior Class 1097
StandardBehavior Methods
StandardBehavior Methods
The StandardBehavior class inherits all of the methods from the BrowseQueue and IListControl
interfaces which it implements. See BrowseQueue and IListControl interfaces for more
information.
StandardErrorLogClass
StandardErrorLogClass Overview
The StandardErrorLogClass manages the opening and closing of an error log file. This class
implements the ErrorLogInterface.
StandardErrorLogClass Properties
The StandardErrorLogClass contains no public properties.
StandardErrorLogClass 1101
StandardErrorLogClass Methods
Close (close standarderrorlog file)
Construct
The Construct method initializes the StandardErrorLogClass. It is automatically called when the
object is created.
Destruct
The Destruct method destroys the StandardErrorLogClass object. This method is automatically
called when the object is destroyed.
1102 ABC Library Reference
StepClass
StepClass Overview
The StepClass estimates the relative position of a given record within a keyed dataset. The
StepClass is an abstract class--it is not useful by itself. However, other useful classes are derived
from it and other structures (such as the BrowseClass and ProcessClass) use it to reference any
of its derived classes.
StepClass Concepts
The classes derived from the StepClass let you define an upper and a lower boundary as well as
a series of steps between the boundaries. Then the classes help you traverse or navigate the
defined steps with a scrollbar thumb, a progress bar, or any control that shows a relative linear
position within a finite range.
The classes derived from the StepClass implement some of the common variations in boundaries
(alphanumeric or numeric) and steps (alphabetic distribution, surname distribution, normal
distribution) that occur in the context of a browse or batch process.
The StepClass requires that the data be traversed with a key. If you are traversing data without a
key, you can track your progress simply by counting records, and no StepClass is needed.
The BrowseClass and ProcessClass optionally use the classes derived from the StepClass.
Therefore, if your BrowseClass or ProcessClass objects use a StepClass, then your program
must instantiate a StepClass for each use.
The StepCustomClass, StepStringClass, StepLongClass, and StepRealClass are all derived from
the StepClass. Each of these derived classes provides slightly different behaviors and
characteristics.
StepCustomClass
Use the StepCustomClass when the data you are processing has an alphanumeric key
with a skewed distribution.
StepStringClass
Use the StepStringClass when the data you are processing has an alphanumeric key
with a normal distribution.
StepLongClass
Use the StepLongClass when the data you are processing has an integer key with a
normal distribution.
1104 ABC Library Reference
StepRealClass
Use the StepRealClass when the data you are processing has a non-integer numeric key
with a normal distribution.
Because the StepClass is abstract, the ABC Template generated code does not directly
reference the StepClass--rather, it references classes derived from the StepClass.
The StepClass source code is installed by default to the Clarion \LIBSRC folder. The StepClass
source code and its respective components are contained in:
StepClass Properties
The StepClass has a single property--Controls. This property is inherited by classes derived from
StepClass. The Controls property is described below.
Controls BYTE
The Controls property contains a value that identifies for the StepClass object:
A StepClass object may be associated with a BrowseClass object sort order. The
BrowseClass.AddSortOrder method sets the sort orders for a BrowseClass object.
Implementation: The Controls property is a single byte bitmap that contains several important
pieces of information for the StepClass object. Set the value of the Controls
property with the Init method.
StepClass Methods
GetPercentile Returns the specified value's percentile relative to the StepClass object's
boundaries.
value A constant, variable, EQUATE, or expression that specifies the value for which to
calculate the percentile.
The GetPercentile method returns the specified value's percentile relative to the StepClass
object's upper and lower boundaries.
GetValue Returns the specified percentile's value relative to the StepClass object's
boundaries.
percentile An integer constant, variable, EQUATE, or expression that specifies the
percentile for which to retrieve the value.
The GetValue method returns the specified percentile's value relative to the StepClass object's
upper and lower boundaries.
Init( controls )
Implementation: The Init method sets the value of the Controls property. Set the value of the
Controls property by adding together the applicable EQUATEs declared in
ABBROWSE.INC as follows:
ITEMIZE,PRE(ScrollSort)
AllowAlpha EQUATE(1) !include characters ABCDEFGHIJKLMNOPQRSTUVWXYZ
AllowAlt EQUATE(2) !include characters `!"£$%%^&*()''-=_+][#;~@:/.,?\|
AllowNumeric EQUATE(4) !include characters 0123456789
CaseSensitive EQUATE(8) !include characters abcdefghijklmnopqrstuvwxyz
Descending EQUATE(16) !the sort is descending
END
Example:
MyStepClass.Init(ScrollSort:AllowAlpha+ScrollSort:AllowNumeric)
Kill, VIRTUAL
The Kill method is a virtual method to shut down the StepClass object.
The Kill method is a placeholder method for classes derived from StepClass--
StepStringClass, StepCustomClass, etc.
StepCustomClass
StepCustomClass Overview
The StepCustomClass is a StepClass that handles a numeric or alphanumeric key with a skewed
distribution (data is not evenly distributed between the lowest and highest key values). You can
provide information about the data distribution so that the StepCustomClass object returns
accurate feedback about the data being processed.
StepCustomClass Concepts
You can specify a custom data distribution for a StepCustomClass object that fits a specific data
set (the other StepClass objects apply one of several predefined data distributions). Use the
AddItem method to set the steps or distribution points for the StepCustomClass object.
For example, your CustomerKey may contain values ranging from 1 to 10,000, but 90 percent of
the values fall between 9,000 and 10,000. If your StepClass object assumes the values are
evenly distributed between 1 and 10,000 (StepLongClass with Runtime distribution), then your
progress bars and vertical scroll bar thumbs will give a misleading visual representation of the
data. However, if your StepClass object knows the actual data distribution (StepCustomClass
object with 90 percent of the steps between 9,000 and 10,000), then your progress bars and
vertical scroll bar thumbs will give an accurate visual representation of the data.
Tip: Use the StepLongClass for integer keys with normal distribution. Use the
StepStringClass for alphanumeric keys with smooth or skewed distribution. Use
the StepRealClass for fractional keys with normal distribution.
Use the StepCustomClass when the data (key) is skewed (data is not evenly distributed between
the lowest and highest key values), and the skew does not match any of the standard
StepStringClass distribution options (see StepStringClass for more information).
The BrowseClass and the ProcessClass optionally use the StepCustomClass. Therefore, if your
BrowseClass or ProcessClass uses the StepCustomClass, your program must instantiate the
StepCustomClass for each use. See the Conceptual Example.
The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and
generate all the code necessary to use the StepCustomClass with your BrowseBoxes, Reports,
and Processes.
1114 ABC Library Reference
If you specify a StepCustomClass object for a Process or Report procedure, you must embed
calls to the AddItem method (ProgressMgr.AddItem) to set the custom "steps" or distribution
points.
The StepCustomClass source code is installed by default to the Clarion \LIBSRC folder. The
StepCustomClass source code and its 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.
INCLUDE('ABBROWSE.INC')
INCLUDE('ABREPORT.INC')
MAP
CustomerProcess PROCEDURE
END
CustomerProcess PROCEDURE
FilesOpened BYTE
Thermometer BYTE
Process:View VIEW(Customer)
END
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Thermometer),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?PctText),CENTER
BUTTON('Cancel'),AT(45,42,50,15),USE(?Cancel)
END
ThisWindow CLASS(ReportManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
ThisProcess ProcessClass !declare ThisProcess object
ProgressMgr StepCustomClass !declare ProgressMgr object
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?Thermometer
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
1116 ABC Library Reference
CLEAR(GlobalResponse)
Relate:Customer.Open
FilesOpened = True
OPEN(ProgressWindow)
SELF.Opened=True
ThisProcess.Init(Process:View,Relate:Customer,?PctText,Thermometer,ProgressMgr,CUS:ID)
ThisProcess.AddSortOrder(CUS:CustomerIDKey)
SELF.Init(ThisProcess)
SELF.AddItem(?Progress:Cancel,RequestCancelled)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Customer.Close
END
RETURN ReturnValue
StepCustomClass 1117
StepCustomClass Properties
The StepCustomClass inherits all the properties of the StepClass from which it is derived. See
StepClass Properties and StepClass Concepts for more information.
In addition to its inherited properties, the StepCustomClass also contains the following properties:
StepCustomClass Methods
StepCustomClass Methods
The StepCustomClass inherits all the methods of the StepClass from which it is derived. See
StepClass Concepts and StepClass Methods for more information.
AddItem( stepmarker )
AddItem Adds a step marker to the expected data distribution for the StepCustomClass
object.
stepmarker A string constant, variable, EQUATE, or expression that specifies the next step
boundary for each step of the StepCustomClass object's expected data
distribution.
The AddItem method adds a step marker to the expected data distribution for the
StepCustomClass object.
Implementation: The AddItem method sets the value of the Entries property.
Example:
GradeStepClass.AddItem('0') !Failing: 0-65
GradeStepClass.AddItem('65') !Below Average: 65-75
GradeStepClass.AddItem('75') !Average: 75-85
GradeStepClass.AddItem('85') !Better Than Average:85-95
GradeStepClass.AddItem('95') !Outstanding: 95-
GradeStepClass.AddItem('1000') !Catchall upper boundary
GetPercentile Returns the specified value's percentile relative to the StepCustomClass object's
boundaries.
value A string constant, variable, EQUATE, or expression that specifies the value for
which to calculate the percentile.
The GetPercentile method returns the specified value's percentile relative to the
StepCustomClass object's "steps."
Example:
IF FIELD() = ?Locator !focus on locator field
IF EVENT() = EVENT:Accepted !if accepted
MyBrowse.TakeAcceptedLocator !BrowseClass handles it
?MyList{PROP:VScrollPos}=MyStep.GetPercentile(Locator) !position thumb to match
END
END
GetValue Returns the specified percentile's value relative to the StepCustomClass object's
boundaries.
percentile An integer constant, variable, EQUATE, or expression that specifies the
percentile for which to retrieve the value.
The GetValue method returns the specified percentile's value relative to the StepCustomClass
object's "steps."
Example:
IF FIELD() = ?MyList !focus on browse list
IF EVENT() = EVENT:ScrollDrag !if thumb moved
Locator=MyStep.GetValue(?MyList{PROP:VScrollPos})!update locator to match
END
END
Init( controls )
Implementation: The Init method sets the value of the Controls property. Set the value of the
Controls property by adding together the applicable EQUATEs declared in
BROWSE.INC as follows:
ITEMIZE,PRE(ScrollSort)
CaseSensitive EQUATE(8) !include abcdefghijklmnopqrstuvwxyz
Descending EQUATE(16) !the sort is descending
END
Example:
MyStepCustomClass.Init(ScrollSort:CaseSensitive)
!program code
MyStepCustomClass.Kill
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Implementation: The Kill method frees memory allocated for the Custom property.
Example:
MyStepCustomClass.Init(ScrollSort:AllowAlpha+ScrollSort:AllowNumeric)
!program code
MyStepCustomClass.Kill
StepLongClass 1123
StepLongClass
StepLongClass Overview
The StepLongClass is a StepClass that handles integer keys with a normal distribution (data is
evenly distributed between the lowest and highest key values).
StepLongClass Concepts
The StepLongClass object applies a normal data distribution between its upper and lower
boundaries. Use the SetLimit method to set the expected data distribution for the StepLongClass
object.
Use the StepLongClass with integer keys that have a normal distribution (data is evenly
distributed between the lowest and highest key values).
Tip: Use the StepCustomClass for integer keys with other skews. Use the
StepRealClass for non-integer numeric keys. Use the StepStringClass for
alphanumeric keys.
The BrowseClass and the ProcessClass optionally use the StepLongClass. Therefore, if your
BrowseClass or ProcessClass uses the StepLongClass, your program must instantiate the
StepLongClass for each use. See the Conceptual Example.
The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and
generate all the code necessary to use the StepLongClass with your BrowseBoxes, Reports, and
Processes.
By default, the Process and Report templates declare a StepLongClass for integer keys called
ProgressMgr. You can use the Report Properties Classes tab (the Progress Class button) or
the Process Properties General tab (the Progress Manager button) to derive from the
StepLongClass instead. The templates provide the derived class so you can modify the
ProgressMgr behavior on an instance-by-instance basis.
By default, the BrowseBox template declares a StepLongClass for integer keys called
BRWn::Sort#:StepClass, where n is the BrowseBox template instance number, and # is the sort
order sequence (identifies the key). You can use the BrowseBox's Scroll Bar Behavior dialog--
Step Class button to derive from the StepLongClass so you can modify the StepLongClass
behavior on an instance-by-instance basis.
The StepLongClass source code is installed by default to the Clarion \LIBSRC folder. The
StepLongClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a StepLongClass object and related objects. The example batch processes a
Customer file on an integer key--CustomerID.
INCLUDE('ABBROWSE.INC')
INCLUDE('ABREPORT.INC')
MAP
CustomerProcess PROCEDURE
END
CustomerProcess PROCEDURE
FilesOpened BYTE
Thermometer BYTE
Process:View VIEW(Customer)
END
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Thermometer),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?PctText),CENTER
BUTTON('Cancel'),AT(45,42,50,15),USE(?Cancel)
END
ThisWindow CLASS(ReportManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?Thermometer
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
Relate:Customer.Open
FilesOpened = True
OPEN(ProgressWindow)
SELF.Opened=True
ProgressMgr.Init(ScrollSort:AllowNumeric) !initialize ProgressMgr object
! ignores inapplicable parameters
ThisProcess.Init(Process:View,Relate:Customer,?PctText,Thermometer,ProgressMgr,CUS:ID)
ThisProcess.AddSortOrder(CUS:CustomerIDKey)
SELF.Init(ThisProcess)
SELF.AddItem(?Progress:Cancel,RequestCancelled)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Customer.Close
END
RETURN ReturnValue
1126 ABC Library Reference
StepLongClass Properties
The StepLongClass inherits all the properties of the StepClass from which it is derived. See
StepClass Properties for more information.
In addition to its inherited properties, the StepLongClass also contains the following properties:
Low LONG
The Low property contains the value of the StepLongClass object's lower boundary.
High LONG
The High property contains the value of the StepLongClass object's upper boundary.
StepLongClass Methods
The StepLongClass inherits all the methods of the StepClass from which it is derived. See
StepClass Methods for more information.
In addition to (or instead of) the inherited methods, the StepLongClass contains the following
methods:
GetPercentile Returns the specified value's percentile relative to the StepLongClass object's
boundaries.
value A constant, variable, EQUATE, or expression that specifies the value for which to
calculate the percentile.
The GetPercentile method returns the specified value's percentile relative to the StepLongClass
object's upper and lower boundaries. For example, if the bounds are 0 and 1000 then
GetPercentile(750) returns 75.
Implementation: The SetLimit method sets the StepLongClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?Locator !focus on locator field
IF EVENT() = EVENT:Accepted !if accepted
MyBrowse.TakeAcceptedLocator !BrowseClass handles it
?MyList{PROP:VScrollPos}=MyStep.GetPercentile(Locator) !position thumb to match
END
END
GetValue Returns the specified percentile's value relative to the StepLongClass object's
boundaries.
percentile An integer constant, variable, EQUATE, or expression that specifies the
percentile for which to retrieve the value.
The GetValue method returns the specified percentile's value relative to the StepLongClass
object's upper and lower boundaries. For example, if the bounds are 0 and 1000 then
GetValue(25) returns '250'.
Implementation: The SetLimit method sets the StepLongClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?MyList !focus on browse list
IF EVENT() = EVENT:ScrollDrag !if thumb moved
Locator=MyStep.GetValue(?MyList{PROP:VScrollPos})!update locator to match
END
END
SetLimit Sets the StepLongClass object's evenly distributed steps between upper and
lower.
lower An integer constant, variable, EQUATE, or expression that specifies the
StepLongClass object's lower boundary.
upper An integer constant, variable, EQUATE, or expression that specifies the
StepLongClass object's upper boundary.
The SetLimit method sets the StepLongClass object's evenly distributed steps between upper
and lower. The StepLongClass object (GetPercentile and GetValue methods) uses these steps to
estimate key values and percentiles for the processed data.
Example:
MyStep.SetLimit(1,9700) !establish scrollbar steps and boundaries
StepLocatorClass
StepLocatorClass Overview
The StepLocatorClass is a LocatorClass that accepts a single character search value, and does a
continuous (wrap around) search starting from the current item so you can, for example, find the
next item that begins with the search value (say, 'T'), then continue to the next item that begins
with the same search value, etc. If there are no matching values, the step locator proceeds the
the next highest item.
Use a Step Locator when the search field is a STRING, CSTRING, or PSTRING, a single
character search is sufficient (a step locator is not appropriate when there are many key values
that begin with the same character), and you want the search to take place immediately upon the
end user's keystroke. Step Locators are not appropriate for numeric keys.
StepLocatorClass Concepts
A Step Locator is a single-character locator with no locator control required.
The StepLocatorClass 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 StepLocatorClass
to locate and scroll to the nearest matching item.
When the BrowseClass LIST has focus and the user types a character, the BrowseClass object
advances the list to the next matching item (or the subsequent item if there is no match).
The BrowseClass uses the StepLocatorClass to locate and scroll to the nearest matching item.
Therefore, if your program's BrowseClass objects use a Step Locator, your program must
instantiate the StepLocatorClass for each use. Once you register the StepLocatorClass object
with the BrowseClass object (see BrowseClass.AddLocator), the BrowseClass object uses the
StepLocatorClass object as needed, with no other code required. See the Conceptual Example.
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.
1132 ABC Library Reference
The StepLocatorClass source code is installed by default to the Clarion \LIBSRC folder. The
StepLocatorClass source code and its 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 a StepLocatorClass
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
StWindow WINDOW('Browse States'),AT(,,123,152),IMM,SYSTEM,GRAY
LIST,AT(8,5,108,124),USE(?StList),IMM,HVSCROLL,FROM(StateQ),|
FORMAT('27L(2)|M~CODE~@s2@80L(2)|M~STATENAME~@s20@')
END
StepLocatorClass 1133
CODE
ThisWindow.Run() !run the window procedure
StepLocatorClass Properties
The StepLocatorClass inherits all the properties of the LocatorClass from which it is derived. See
LocatorClass Properties for more information.
StepLocatorClass 1135
StepLocatorClass Methods
StepLocatorClass Methods
The StepLocatorClass inherits all the methods of the LocatorClass from which it is derived. See
LocatorClass Methods for more information.
In addition to (or instead of) the inherited methods, the StepLocatorClass contains the following
methods:
Set, DERIVED
The Set method prepares the locator for a new search.
Implementation: The Set method does nothing because each new step locator search reprimes
the locator's FreeElement--since the step locator is a single character search.
Example:
BrowseClass.SetSort PROCEDURE(BYTE B,BYTE Force)
CODE
IF SELF.SetSort(B)
IF ~SELF.Sort.Locator &= NULL
SELF.Sort.Locator.Set
END
END
1136 ABC Library Reference
TakeKey, DERIVED
The TakeKey method processes an alerted keystroke for the LIST control and returns a value
indicating whether the browse list display must change.
Tip: By default, all alphanumeric keys are alerted for LIST controls.
Implementation: The TakeKey method primes the FreeElement property with the appropriate
search value, then returns one (1) if a new search is required or returns zero (0)
if no new search is required. A search is required only if the keystroke is a valid
search character.
Example:
IF SELF.Sort.Locator.TakeKey() ! process the search key
SELF.Reset(1) ! if valid, reset the view
SELF.ResetQueue( Reset:Done ) ! and the browse queue
END
StepRealClass
StepRealClass Overview
The StepRealClass is a StepClass that handles fractional (non-integer) keys with a normal
distribution (data is evenly distributed between the lowest and highest key values).
StepRealClass Concepts
The StepRealClass object applies a normal data distribution between its upper and lower
boundaries. Use the SetLimit method to set the expected data distribution for the StepRealClass
object. Use the StepRealClass with non-integer numeric keys that have a normal distribution
(data is evenly distributed between the lowest and highest key values).
Tip: Use the StepLongClass for integer numeric keys. Use the StepStringClass for
alphanumeric keys. Use the StepCustomClass for keys with skewed distributions.
The BrowseClass and the ProcessClass optionally use the StepRealClass. Therefore, if your
BrowseClass or ProcessClass uses the StepRealClass, your program must instantiate the
StepRealClass for each use. See the Conceptual Example.
The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and
generate all the code necessary to use the StepRealClass with your BrowseBoxes, Reports, and
Processes.
By default, the Process and Report templates declare a StepRealClass for fractional keys called
ProgressMgr. You can use the Report Properties Classes tab (the Progress Class button) or
the Process Properties General tab (the Progress Manager button) to derive from the
StepRealClass instead. The templates provide the derived class so you can modify the
ProgressMgr behavior on an instance-by-instance basis.
By default, the BrowseBox template declares a StepRealClass for non-integer numeric keys
called BRWn::Sort#:StepClass, where n is the BrowseBox template instance number, and # is the
sort order sequence (identifies the key). You can use the BrowseBox's Scroll Bar Behavior
dialog--Step Class button to derive from the StepRealClass so you can modify the
StepRealClass behavior on an instance-by-instance basis.
1138 ABC Library Reference
The StepRealClass source code is installed by default to the Clarion \LIBSRC folder. The
StepRealClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a StepRealClass object and related objects. The example batch-processes a
Customer file on a fractional (non-integer) key--CustomerID.
INCLUDE('ABBROWSE.INC')
INCLUDE('ABREPORT.INC')
MAP
CustomerProcess PROCEDURE
END
CustomerProcess PROCEDURE
FilesOpened BYTE
Thermometer BYTE
Process:View VIEW(Customer)
END
ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE
PROGRESS,USE(Thermometer),AT(15,15,111,12),RANGE(0,100)
STRING(''),AT(0,3,141,10),USE(?UserString),CENTER
STRING(''),AT(0,30,141,10),USE(?PctText),CENTER
BUTTON('Cancel'),AT(45,42,50,15),USE(?Cancel)
END
ThisWindow CLASS(ReportManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
GlobalResponse = ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
StepRealClass 1139
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
IF ReturnValue THEN RETURN ReturnValue.
SELF.FirstField = ?Thermometer
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
Relate:Customer.Open
FilesOpened = True
OPEN(ProgressWindow)
SELF.Opened=True
ProgressMgr.Init(ScrollSort:AllowNumeric) !initialize ProgressMgr object
! ignores inapplicable parameters
ThisProcess.Init(Process:View,Relate:Customer,?PctText,Thermometer,ProgressMgr,CUS:ID)
ThisProcess.AddSortOrder(CUS:CustomerIDKey)
SELF.Init(ThisProcess)
SELF.AddItem(?Progress:Cancel,RequestCancelled)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Customer.Close
END
RETURN ReturnValue
1140 ABC Library Reference
StepRealClass Properties
StepRealClass Properties
The StepRealClass inherits all the properties of the StepClass from which it is derived. See
StepClass Properties for more information.
In addition to its inherited properties, the StepRealClass also contains the following properties:
Low REAL
The Low property contains the value of the StepRealClass object's lower boundary.
High REAL
The High property contains the value of the StepRealClass object's upper boundary.
StepRealClass Methods
StepRealClass Methods
The StepRealClass inherits all the methods of the StepClass from which it is derived. See
StepClass Methods for more information.
In addition to (or instead of) the inherited methods, the StepRealClass contains the following
methods:
GetPercentile Returns the specified value's percentile relative to the StepRealClass object's
boundaries.
value A constant, variable, EQUATE, or expression that specifies the value for which to
calculate the percentile.
The GetPercentile method returns the specified value's percentile relative to the StepRealClass
object's upper and lower boundaries. For example, if the bounds are 0 and 1000 then
GetPercentile(750) returns 75.
Implementation: The SetLimit method sets the StepRealClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?Locator !focus on locator field
IF EVENT() = EVENT:Accepted !if accepted
MyBrowse.TakeAcceptedLocator !BrowseClass handles it
?MyList{PROP:VScrollPos}=MyStep.GetPercentile(Locator) !position thumb to match
END
END
GetValue Returns the specified percentile's value relative to the StepRealClass object's
boundaries.
percentile An integer constant, variable, EQUATE, or expression that specifies the
percentile for which to retrieve the value.
The GetValue method returns the specified percentile's value relative to the StepRealClass
object's upper and lower boundaries. For example, if the bounds are 0 and 1000 then
GetValue(25) returns '250'.
Implementation: The SetLimit method sets the StepRealClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?MyList !focus on browse list
IF EVENT() = EVENT:ScrollDrag !if thumb moved
Locator=MyStep.GetValue(?MyList{PROP:VScrollPos})!update locator to match
END
END
SetLimit Sets the StepRealClass object's evenly distributed steps between upper and
lower.
lower An integer constant, variable, EQUATE, or expression that specifies the
StepRealClass object's lower boundary.
upper An integer constant, variable, EQUATE, or expression that specifies the
StepRealClass object's upper boundary.
The SetLimit method sets the StepRealClass object's evenly distributed steps between upper
and lower. The StepRealClass object (GetPercentile and GetValue methods) uses these steps to
estimate key values and percentiles for the processed data.
Example:
MyStep.SetLimit(1,9700) !establish scrollbar steps and boundaries
StepStringClass
StepStringClass Overview
The StepStringClass is a StepClass that handles alphanumeric keys with a normal distribution
(data is evenly distributed between the lowest and highest key values) or with English Alphabet or
US Surname distribution. You can provide information about the data distribution so that the
StepStringClass object returns accurate feedback about the data being processed.
StepStringClass Concepts
You can set the expected data distribution for a StepStringClass object--the StepStringClass
object applies one of several predefined data distributions. Use the Init and SetLimit methods to
set the expected data distribution for the StepStringClass object.
For example, your NameKey may contain US Surname values ranging from 'Aabel' to 'Zuger.' If
your StepClass assumes the values are evenly distributed between these values, then your
progress bars and vertical scroll bar thumbs will give an inaccurate visual representation of the
data. However, if your StepClass assumes a typical US Surname distribution, then your progress
bars and vertical scroll bar thumbs will give an accurate visual representation of the data.
Use the StepStringClass with alphanumeric keys that have a normal distribution (data is evenly
distributed between the lowest and highest key values) or with English Alphabet or US Surname
distribution.
Tip: Use the StepLongClass for integer keys with normal distribution. Use the
StepRealClass for fractional keys with normal distribution. Use the
StepCustomClass for numeric or alphanumeric keys with skewed distribution.
The BrowseClass and the ProcessClass optionally use the StepStringClass. Therefore, if your
BrowseClass or ProcessClass uses the StepStringClass, your program must instantiate the
StepStringClass for each use. See the Conceptual Example.
1146 ABC Library Reference
The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and
generate all the code necessary to use the StepStringClass with your BrowseBoxes, Reports,
and Processes.
By default, the Process and Report templates declare a StepStringClass for alphanumeric keys
called ProgressMgr. You can use the Report Properties Classes tab (the Progress Class
button) or the Process Properties General tab (the Progress Manager buttonto derive from the
StepStringClass instead. The templates provide the derived class so you can modify the
ProgressMgr behavior on an instance-by-instance basis.
By default, the BrowseBox template declares a StepStringClass for alphanumeric keys called
BRWn::Sort#:StepClass, where n is the BrowseBox template instance number, and # is the sort
order sequence (identifies the key). You can use the BrowseBox's Scroll Bar Behavior dialog to
specify the expected data distribution (normal distribution, English alphabet, or US surname). You
can use the Step Class button to derive from the StepStringClass so you can modify the
StepStringClass behavior on an instance-by-instance basis.
The StepStringClass source code is installed by default to the Clarion \LIBSRC folder. The
StepStringClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a StepStringClass object and related objects. The example initializes and
page-loads a LIST, then handles a number of associated events, including scrolling.
The StepStringClass object's steps are calculated based on the poles of the actual browsed data-
-a list of State abbreviations.
PROGRAM
INCLUDE('ABWINDOW.INC') !declare WindowManager class
INCLUDE('ABBROWSE.INC') !declare BrowseClass & StepClasses
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
GlobalErrors ErrorClass
Access:State CLASS(FileManager)
Init PROCEDURE
END
Relate:State CLASS(RelationManager)
Init PROCEDURE
END
VCRRequest LONG(0),THREAD
END
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
ThisWindow.Run() !run the window procedure
GlobalErrors.Kill
RETURN ReturnValue
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)
1150 ABC Library Reference
StepStringClass Properties
The StepStringClass inherits all the properties of the StepClass from which it is derived. See
StepClass Properties for more information. In addition to its inherited properties, the
StepStringClass also contains the following properties:
Implementation: Valid data distribution options are U.S. surnames, English alphabet, and runtime
data distribution calculated from the poles of the actual data. Corresponding
LookupMode EQUATEs are declared in ABBROWSE.INC as follows:
ITEMIZE,PRE(ScrollBy)
Name EQUATE !U.S. surnames distribution
Alpha EQUATE !English alphabet distribution
Runtime EQUATE !calculate distribution from runtime poles
END
The U.S. surnames and English alphabet data distributions are defined in ABBROWSE.CLW as
follows:
Scroll:Alpha STRING(' AFANATB BFBNBTC CFCNCT'|
&'D DFDNDTE EFENETF FFFNFT'|
&'G GFGNGTH HFHNHTI IFINIT'|
&'J JFJNJTK KFKNKTL LFLNLT'|
&'M MFMNMTN NFNNNTO OFONOT'|
&'P PFPNPTQ QNR RFRNRTS SF'|
&'SNSTT TFTNTTU UFUNUTV VF'|
&'VNVTW WFWNWTX XFXNXTY YF'|
&'YNYTZ ZN')
Scroll:Name STRING(' ALBAMEARNBAKBATBENBIABOBBRA'|
&'BROBUACACCARCENCHRCOECONCORCRU'|
&'DASDELDIADONDURELDEVEFELFISFLO'|
&'FREFUTGARGIBGOLGOSGREGUTHAMHEM'|
&'HOBHOTINGJASJONKAGKEAKIRKORKYO'|
&'LATLEOLIGLOUMACMAQMARMAUMCKMER'|
&'MILMONMORNATNOLOKEPAGPAUPETPIN'|
&'PORPULRAUREYROBROSRUBSALSCASCH'|
&'SCRSHASIGSKISNASOUSTESTISUNTAY'|
&'TIRTUCVANWACWASWEIWIEWIMWOLYOR')
See Also: Init
StepStringClass 1151
Implementation: The GetPercentile and GetValue methods use the Root and TestLen properties
to efficiently traverse the defined steps.
SortChars &CSTRING
The SortChars property is a reference to a structure containing the valid sort characters for the
StepStringClass object. The StepStringClass object uses the SortChars property to compute
steps. For example if SortChars contains only 'ABYZ' then that is the information the
StepStringClass uses to compute your steps.
Implementation: The SortChars property only affects StepStringClass objects with a LookupMode
specifying runtime data distribution. The SetLimit method computes the runtime
data distribution.
Implementation: The GetPercentile and GetValue methods use the Root and TestLen properties
to efficiently traverse the defined steps.
The value of the TestLen property depends on the value of the LookupMode
property. LookupMode of U.S. surnames uses TestLen of 3, English alphabet
uses TestLen of 2, and runtime data distribution uses TestLen of 4.
StepStringClass Methods
The StepStringClass inherits all the methods of the StepClass from which it is derived. See
StepClass Methods for more information.
In addition to (or instead of) the inherited methods, the StepStringClass contains the following
methods:
GetPercentile Returns the specified value's percentile relative to the StepStringClass object's
boundaries.
value A string constant, variable, EQUATE, or expression that specifies the value for
which to calculate the percentile.
The GetPercentile method returns the specified value's percentile relative to the StepStringClass
object's upper and lower boundaries. For example, if the bounds are 'A' and 'Z' then
GetPercentile('M') returns 50.
Implementation: The SetLimit method sets the StepStringClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?Locator !focus on locator field
IF EVENT() = EVENT:Accepted !if accepted
MyBrowse.TakeAcceptedLocator !BrowseClass handles it
?MyList{PROP:VScrollPos}=MyStep.GetPercentile(Locator) !position thumb to match
END
END
GetValue Returns the specified percentile's value relative to the StepStringClass object's
boundaries.
percentile An integer constant, variable, EQUATE, or expression that specifies the
percentile for which to retrieve the value.
The GetValue method returns the specified percentile's value relative to the StepStringClass
object's upper and lower boundaries. For example, if the bounds are 'A' and 'Z' then GetValue(50)
returns 'M'.
Implementation: The SetLimit method sets the StepStringClass object's upper and lower
boundaries.
Example:
IF FIELD() = ?MyList !focus on browse list
IF EVENT() = EVENT:ScrollDrag !if thumb moved
Locator=MyStep.GetValue(?MyList{PROP:VScrollPos})!update locator to match
END
END
A mode parameter value of ScrollBy:Name gives U.S. surname distribution, ScrollBy:Alpha gives
English alphabet distribution, and ScrollBy:Runtime gives a smooth data distribution from the
poles of the actual data, as calculated by the SetLimit method.
Implementation: The Init method sets the value of the Controls and LookupMode properties. Set
the value of the Controls property by adding together the applicable EQUATEs
declared in ABBROWSE.INC as follows:
ITEMIZE,PRE(ScrollSort)
AllowAlpha EQUATE(1) !include ABCDEFGHIJKLMNOPQRSTUVWXYZ
AllowAlt EQUATE(2) !include `!"£$%%^&*()''-=_+][#;~@:/.,?\|
AllowNumeric EQUATE(4) !include 0123456789
CaseSensitive EQUATE(8)!include abcdefghijklmnopqrstuvwxyz
Descending EQUATE(16) !the sort is descending
Example:
MyStepStringClass.Init(ScrollSort:AllowAlpha+ScrollSort:AllowNumeric)
!program code
MyStepStringClass.Kill
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Implementation: The Kill method frees memory allocated for the Ref, Root, and SortChars
properties.
Example:
MyStepStringClass.Init(ScrollSort:AllowAlpha+ScrollSort:AllowNumeric)
!program code
MyStepStringClass.Kill
StepStringClass 1157
SetLimit Sets the StepStringClass object's evenly distributed steps between upper and
lower.
lower A string constant, variable, EQUATE, or expression that specifies the
StepStringClass object's lower boundary. The value may be numeric or
alphanumeric.
upper A string constant, variable, EQUATE, or expression that specifies the
StepStringClass object's upper boundary. The value may be numeric or
alphanumeric.
The SetLimit method sets the StepStringClass object's evenly distributed steps between upper
and lower. The StepStringClass object (GetPercentile and GetValue methods) uses these steps
to estimate key values and percentiles for the processed data.
Example:
MyStep.SetLimit('A','Z') !establish uppercase alphabetic scrollbar limits
SetLimitNeeded, VIRTUAL
The SetLimitNeeded method returns a value indicating whether the StepClass object's steps and
boundaries are static (set at compile time) or dynamic (set at runtime). A return value of one (1)
indicates dynamic boundaries that may need to be reset when the monitored result set changes
(records are added, deleted, or filtered). A return value of zero (0) indicates the boundaries are
fixed at compile time (name or alpha distribution) and are not adjusted when the monitored result
set changes.
Implementation: The SetLimitNeeded method returns one (1 or True) if the LookupMode property
equals ScrollBy:RunTime; otherwise it returns zero (0 or False).
Example:
BrowseClass.ResetThumbLimits PROCEDURE
HighValue ANY
CODE
IF SELF.Sort.Thumb &= NULL OR ~SELF.Sort.Thumb.SetLimitNeeded()
RETURN
END
SELF.Reset
IF SELF.Previous()
RETURN
END
HighValue = SELF.Sort.FreeElement
SELF.Reset
IF SELF.Next()
RETURN
END
SELF.Sort.Thumb.SetLimit(SELF.Sort.FreeElement,HighValue)
TagHTMLHelp Class
TagHTMLHelpOverview
HTML Help is emerging as the new standard help file format. HTML Help is distributed in a single
(.chm) file. This file is compressed and made from several .html files. All images, table of
contents, index, and search files are compiled into this single .chm file. This makes for easier
distribution of your help system.
HTML Help is available on any 32-bit windows platform, Windows 95/98, Windows 2000, and NT
4. On Windows 95 and NT 4, the HTML Help Display Engine, Internet Explorer 4.0 or later, or
Microsoft Office 2000 must be installed on the user's system.
TagHTMLHelp Methods
The TagHTMLHelp class contains the following methods.
Example:
oHH.ALinkLookUp(sSearch,sMsg,sTitle )!Find sSearch Alink
TagHTMLHelp Class 1161
CloseHelp
The CloseHelp method closes any Help windows opened by the application.
Example:
oHH.CloseHelp()!Close all Help windows
GetHelpFile
The GetHelpFile method retrieves the current HTML Help (.chm) file name. The file name is
returned.
Example:
sHelpFileName =oHH.GetHelpFile()!Get Help file name
GetTopic
The GetTopic method retrieves the current HTML Help topic name. The topic name is returned.
Example:
sHelpFileName =oHH.GetTopic()!Get topic name
1162 ABC Library Reference
Example:
oHH.KeyWordLookUp( 'Demo' )
Kill
The Kill method shuts down the TagHTMLHelp object by freeing any memory used during the life
of the object.
Example:
oHH.Kill()
SetHelpFile( helpfile)
Example:
oHH.SetHelpFile('Demo.chm ' ) !Set help file name for application
TagHTMLHelp Class 1165
Example:
oHH.SetTopic( 'Class_Interface/Class_Interface.htm' )
oHH.SetTopic( ?OKButton, 'myform/ok.htm') ).
ShowIndex( keyword)
Example:
oHH.ShowIndex()!Opens Index tab
oHH.ShowIndex('Demo ' ))!Opens Index tab and searches for keyword
1166 ABC Library Reference
ShowSearch
The ShowSearch method opens the Search tab in the Navigation pane of the HTML Help
Viewer.
Example:
oHH.ShowSearch()
ShowTOC
The ShowTOC method opens the Contents tab in the Navigation pane of the HTML Help Viewer.
Example:
oHH.ShowTOC()
ShowTopic( topic)
Example:
oHH.ShowTopic()
TextWindowClass 1167
TextWindowClass
TextWindowClass Overview
The TextWindowClass is a Class that manages a Window that is used for the editing of EIP
memo and large string fields.
TextWindowClass Concepts
The TextWindowCkass manages a window (TxtWindow) that is defined in ABEIP.CLW. This
window contains a TEXT control along with OK and Cancel buttons.
The TextWindowClass is instantiated within the EditTextClass.TakeEvent method. When the user
presses the ellipsis button to edit the text, the special window is initiated.
TextWindowClass Properties
The TextWindowClass inherits all the properties of the WindowManager from which it is derived.
In addition to the inherited properties, the TextWindowClass contains the following properties:
TextWindowClass Methods
The TextWindowClass inherits all the methods of the WindowManager class from which it is
derived.
In addition to (or instead of) the inherited methods, the TextWindowClass contains the following
methods:
ToolbarClass
ToolbarClass Overview
ToolbarClass and ToolbarTarget objects work together to reliably "convert" an event associated
with a toolbar button into an appropriate event associated with a specific control or window.
ToolbarClass objects communicate with zero or more ToolbarTarget objects. Each ToolbarTarget
object is associated with a specific entity, such as a browse list, relation tree,or update form. The
ToolbarClass object forwards events and method calls to the active ToolbarTarget object. Only
one target is active at a time.
This lets you use a single toolbar to drive a variety of targets, such as update forms, browse lists,
relation tree lists, etc. A single toolbar can even drive multiple targets (two or more BrowseBoxes)
in a single procedure.
ToolbarClass Concepts
Within an MDI application, the ToolbarClass and ToolbarTarget work together to reliably interpret
and pass an event (EVENT:Accepted) associated with a toolbar button into an event associated
with a specific control or window. For example, the end user CLICKS on a toolbar button (say the
"Insert" button) on the MDI application frame. The frame procedure forwards the event to the
active thread (POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active})). The active thread
(procedure) manages a window that displays two LIST controls, and one of the LISTs has focus.
This procedure has a ToolbarClass object plus a ToolbarTarget object for each LIST control. The
ToolbarClass object takes the event (ToolbarClass.TakeEvent)1 and forwards the event to the
active ToolbarTarget object (the target that represents the LIST with focus). The ToolbarTarget
object takes the event (ToolbarListBoxClass.TakeEvent) and handles it by posting an appropriate
event to a specific control or to the window, for example:
POST(EVENT:ACCEPTED,SELF.InsertButton) !insert a record
POST(EVENT:PageDown,SELF.Control) !scroll a LIST
POST(EVENT:Completed) !complete an update form
POST(EVENT:CloseWindow) !select a record
etc.
1If the procedure has a WindowManager object, the WindowManager object takes the event
(WindowManager.TakeEvent) and forwards it to the ToolbarClass object
(WindowManager.TakeAccepted).
ToolbarTarget
The ToolbarClass object keeps a list of ToolbarTarget objects so it can forward events and
method calls to a particular target. Each ToolbarTarget object is associated with a specific entity,
1172 ABC Library Reference
such as a browse list, relation tree,or update form. At present, the ABC Library has three classes
derived from the ToolbarTarget:
These ToolbarTarget objects implement the event handling specific to the associated entity.
There may be zero or more ToolbarTarget objects within a procedure; however, only one is active
at a time. The SetTarget method sets the active ToolbarTarget object.
The WindowManager optionally uses the ToolbarClass, as does the BrowseClass. Therefore, if
your program uses a WindowManager or BrowseClass object, it may also need the ToolbarClass.
Much of this is automatic when you INCLUDE the WindowManager or BrowseClass headers
(ABWINDOW.INC and ABBROWSE.INC) in your program's data section. See the Conceptual
Example.
ToolBarClass 1173
The ABC procedure templates instantiate a ToolbarClass object called Toolbar within each
procedure containing a template that asks for global toolbar control--that is, the BrowseBox
template, the FormVCRControls template, and the RelationTree template.
The templates generate code to instantiate the ToolbarClass object and to register the
ToolbarClass object with the WindowManager object. You may see code such as the following in
your template-generated procedures.
Toolbar ToolbarClass !declare Toolbar object
CODE
!
ThisWindow.Init PROCEDURE
SELF.AddItem(Toolbar) !register Toolbar with WindowManager
BRW1.AddToolbarTarget(Toolbar) !register BrowseClass as target
Toolbar.AddTarget(REL1::Toolbar,?RelTree) !register RelTree as target
SELF.AddItem(ToolbarForm) !register update form as target
The WindowManager and BrowseClass are both programmed to use ToolbarClass objects.
Therefore most of the interaction between these objects is encapsulated within the Application
Builder Class code, and is only minimally reflected in the ABC Template generated code.
The ToolbarClass source code is installed by default to the Clarion \LIBSRC folder. The
ToolbarClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a ToolbarClass object and related ToolbarTarget objects.
This example uses the ToolbarClass to allow a global toolbar to drive two separate but related
LISTs within a single MDI procedure. The primary LIST shows client information and the related
LIST shows phone numbers for the selected client. The toolbar drives whichever list has focus.
The program POSTs toolbar events to the active MDI window using the SYSTEM{Prop:Active}
property. Then the local ToolbarClass object calls on the active ToolbarTarget object to handle
the event.
PROGRAM
Frame CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
TakeAccepted PROCEDURE(),BYTE,PROC,VIRTUAL
END
Toolbar ToolbarClass !declare Toolbar object
CODE
Frame.Run()
Frame.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ToolBarClass 1175
ReturnValue = PARENT.Init()
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with WindowManager
OPEN(AppFrame)
SELF.Opened=True
SELF.SetAlerts()
RETURN ReturnValue
Frame.TakeAccepted PROCEDURE()
ReturnValue BYTE,AUTO
Looped BYTE
CODE
LOOP
IF Looped THEN RETURN Level:Notify ELSE Looped=1.
CASE ACCEPTED()
OF Toolbar:First TO Toolbar:Last !for EVENT:Accepted on toolbar
POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active}) !transfer it to active thread
CYCLE ! and stop
END
ReturnValue = PARENT.TakeAccepted()
IF ACCEPTED() = ?BrowseCustomer
START(BrowseCustomer,050000)
END
RETURN ReturnValue
END
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
SELF.FirstField = ?CusList !CusList gets initial focus
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with WindowManager
Relate:Customer.Open
CusBrowse.Init(?CusList,CusQ.ViewPosition,CusView,CusQ,Relate:Customer,SELF)
PhBrowse.Init(?PhList,PhQ.ViewPosition,PhView,PhQ,Relate:Phones,SELF)
OPEN(CusWindow)
SELF.Opened=True
CusBrowse.Q &= CusQ
CusBrowse.AddSortOrder(,CUS:BYNUMBER)
CusBrowse.AddField(CUS:CUSTNO,CusBrowse.Q.CUS:CUSTNO)
CusBrowse.AddField(CUS:NAME,CusBrowse.Q.CUS:NAME)
PhBrowse.Q &= PhQ
PhBrowse.AddSortOrder(,PH:IDKEY)
PhBrowse.AddRange(PH:ID,Relate:Phones,Relate:Customer)
PhBrowse.AddField(PH:NUMBER,PhBrowse.Q.PH:NUMBER)
ToolBarClass 1177
PhBrowse.AddField(PH:ID,PhBrowse.Q.PH:ID)
CusBrowse.InsertControl=?InsertCus
CusBrowse.ChangeControl=?ChangeCus
CusBrowse.DeleteControl=?DeleteCus
CusBrowse.AddToolbarTarget(Toolbar) !Make CusBrowse a toolbar target
PhBrowse.InsertControl=?InsertPh
PhBrowse.ChangeControl=?ChangePh
PhBrowse.DeleteControl=?DeletePh
PhBrowse.AddToolbarTarget(Toolbar) !Make PhBrowse a toolbar target
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Customer.Close
RETURN ReturnValue
ThisWindow.TakeSelected PROCEDURE()
ReturnValue BYTE,AUTO
Looped BYTE
CODE
LOOP
IF Looped THEN RETURN Level:Notify ELSE Looped=1.
ReturnValue = PARENT.TakeSelected()
CASE FIELD()
OF ?CusList !if selected,
Toolbar.SetTarget(?CusList) ! make ?CusList the active target
OF ?PhList !if selected
IF RECORDS(PhBrowse.Q) > 1 !and contains more than one record,
Toolbar.SetTarget(?PhList) ! make ?PhList the active target
END
END
RETURN ReturnValue
END
1178 ABC Library Reference
ToolbarClass Methods
The ToolbarClass contains the 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 two categories:
Mainstream Use:
SetTarget set active target & appropriate toolbar state
TakeEventV process toolbar event for active target
Occasional Use:
DisplayButtonsV enable appropriate toolbar buttons
Virtual Methods
Typically you will not call these methods directly--other base class 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.
AddTarget Adds a toolbar target to the ToolbarClass object's list of potential toolbar targets.
target The label of a ToolbarTarget object.
control An integer constant, variable, EQUATE, or expression containing the target's ID
number. For targets associated with a control, this is the control number (usually
represented by the control's Field Equate Label).
The AddTarget method adds a toolbar target (ToolbarTarget object) to the ToolbarClass object's
list of potential toolbar targets.
The last added target is the active target until supplanted by a subsequent call to AddTarget or
SetTarget.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolBarForm, -1 ) !register an Update Form target
Toolbar.AddTarget( REL1::Toolbar, ?RelTree )!register a RelTree target
BRW1.AddToolbarTarget( Toolbar ) !register a BrowseBox target...
!BrowseClass method calls AddTarget
DisplayButtons, VIRTUAL
The DisplayButtons method enables and disables the appropriate toolbar buttons for the active
toolbar target.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolBarForm, -1 ) !register an Update Form target
Toolbar.DisplayButtons !and enable appropriate toolbar buttons
!for that target
Init
The Init method initializes the ToolbarClass object.
Implementation: The Init method allocates a new list of potential toolbar targets.
Example:
CODE
Toolbar.Init !initialize Toolbar object
!program code
ACCEPT
!program code
END
Toolbar.Kill !shut down Toolbar object
Kill, VIRTUAL
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Implementation: The Kill method disposes of the list of potential toolbar targets.
Example:
CODE
Toolbar.Init !initialize Toolbar object
!program code
ACCEPT
!program code
END
Toolbar.Kill !shut down Toolbar object
1182 ABC Library Reference
SetTarget( [ ID ] )
Example:
ACCEPT
CASE EVENT()
OF EVENT:OpenWindow !on open window
DO RefreshWindow !load the browse QUEUEs
OF EVENT:Accepted !for Accepted events (which may
CASE FOCUS() ! come from the global toolbar)
OF ?ClientList ! make the list with FOCUS
Toolbar.SetTarget(?ClientList) ! the active toolbar target
OF ?PhoneList ! and enable appropriate toolbar
Toolbar.SetTarget(?PhoneList) ! buttons and TIP attributes
END
Toolbar.TakeEvent(VCRRequest, WM)!the Toolbar object calls the
END ! active target's event handler
END ! which in turn scrolls, inserts,
! deletes, helps, etc. The event
! handler often simply POSTs
! another event to the correct
! control, e.g.
! Event:Accepted to ?Insert or
! Event:PageUp to ?ClientList
The vcr parameter lets the TakeEvent method specify an appropriate subsequent or secondary
action. For example, the ToolbarUpdateClass.TakeEvent method (for a FORM), may interpret a
vcr scroll down as "save and then scroll." The method takes the necessary action to save the item
and accomplishes the secondary scroll action by setting the vcr parameter.
Example:
MyWindowManager.TakeAccepted PROCEDURE
CODE
IF ~SELF.Toolbar &= NULL
SELF.Toolbar.TakeEvent(SELF.VCRRequest,SELF)
END
!procedure code
ToolbarListBoxClass
ToolbarListBoxClass Overview
The ToolbarListBoxClass is a ToolbarTarget that handles events for a BrowseClass LIST. See
BrowseClass and Control Templates--BrowseBox for more information.
ToolbarListboxClass Concepts
ToolbarListBoxClass objects implement the event handling specific to a BrowseClass LIST. The
LIST specific events are primarily scrolling events, but also include the event to select a single list
item (EVENT:Accepted for a Select button). There may be zero or several ToolbarTarget objects
within a procedure; however, only one is active at a time.
The ToolbarListboxClass source code is installed by default to the Clarion \LIBSRC folder. The
ToolbarListboxClass source code and its respective components are contained in:
This example uses a global toolbar to drive two separate but related LISTs within a single MDI
procedure. The primary LIST shows client information and the related LIST shows phone
numbers for the selected client. The toolbar drives whichever list has focus. See also
ToolbarUpdateClass--Conceptual Example.
1186 ABC Library Reference
The program POSTs toolbar events to the active MDI window using the SYSTEM{Prop:Active}
property. Then the local ToolbarClass object calls on the active ToolbarTarget object to handle
the event.
PROGRAM
INCLUDE('ABBROWSE.INC') !declare BrowseClass
INCLUDE('ABTOOLBA.INC') !declare Toolbar classes
INCLUDE('ABWINDOW.INC') !declare WindowManager
CODE
!program code
Frame.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with WindowManager
OPEN(AppFrame)
SELF.Opened=True
SELF.SetAlerts()
RETURN ReturnValue
Frame.TakeAccepted PROCEDURE()
ReturnValue BYTE,AUTO
Looped BYTE
ToolBarListBoxClass 1187
CODE
CASE ACCEPTED()
OF Toolbar:First TO Toolbar:Last !for EVENT:Accepted on toolbar
POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active}) !transfer it to active thread
RETURN Level:Notify
OF ?BrowseCustomer
START(BrowseCustomer,050000)
END
RETURN PARENT.TakeAccepted()
END
PhBrowse CLASS(BrowseClass) !declare PhBrowse object
Q &PhQ
END
CODE
ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
SELF.FirstField = ?CusList !CusList gets initial focus
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with WindowManager
Relate:Customer.Open
CusBrowse.Init(?CusList,CusQ.ViewPosition,CusView,CusQ,Relate:Customer,SELF)
PhBrowse.Init(?PhList,PhQ.ViewPosition,PhView,PhQ,Relate:Phones,SELF)
OPEN(CusWindow)
SELF.Opened=True
CusBrowse.Q &= CusQ
CusBrowse.AddSortOrder(,CUS:BYNUMBER)
CusBrowse.AddField(CUS:CUSTNO,CusBrowse.Q.CUS:CUSTNO)
CusBrowse.AddField(CUS:NAME,CusBrowse.Q.CUS:NAME)
PhBrowse.Q &= PhQ
PhBrowse.AddSortOrder(,PH:IDKEY)
PhBrowse.AddRange(PH:ID,Relate:Phones,Relate:Customer)
PhBrowse.AddField(PH:NUMBER,PhBrowse.Q.PH:NUMBER)
PhBrowse.AddField(PH:ID,PhBrowse.Q.PH:ID)
CusBrowse.InsertControl=?InsertCus
CusBrowse.ChangeControl=?ChangeCus
CusBrowse.DeleteControl=?DeleteCus
CusBrowse.AddToolbarTarget(Toolbar) !Make CusBrowse a toolbar target
PhBrowse.InsertControl=?InsertPh
PhBrowse.ChangeControl=?ChangePh
PhBrowse.DeleteControl=?DeletePh
PhBrowse.AddToolbarTarget(Toolbar) !Make PhBrowse a toolbar target
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Customer.Close
RETURN ReturnValue
ThisWindow.TakeSelected PROCEDURE()
ToolBarListBoxClass 1189
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.TakeSelected()
CASE FIELD()
OF ?CusList !if selected,
Toolbar.SetTarget(?CusList) ! make ?CusList the active target
OF ?PhList !if selected
IF RECORDS(PhBrowse.Q) > 1 !and contains more than one record,
Toolbar.SetTarget(?PhList) ! make ?PhList the active target
END
END
RETURN ReturnValue
1190 ABC Library Reference
ToolbarListboxClass Properties
The ToolbarListboxClass inherits all the properties of the ToolbarTarget from which it is derived.
See ToolbarTarget Properties for more information.
In addition to its inherited properties, the ToolbarListboxClass contains the following properties.
Browse &BrowseClass
The Browse property is a reference to the ToolbarListboxClass object's BrowseClass object. The
ToolbarListboxClass object uses this property to access the BrowseClass object's properties and
methods.
The TryTakeToolbar method uses the Browse property to determine whether the
associated LIST control is visible.
ToolbarListboxClass Methods
The ToolbarListboxClass inherits all the methods of the ToolbarTarget from which it is derived.
See ToolbarTarget Methods for more information.
In addition to (or instead of) the inherited methods, the ToolbarListboxClass contains the following
methods:
DisplayButtons, VIRTUAL
The DisplayButtons method enables and disables the appropriate toolbar buttons for the
ToolbarListboxClass object based on the values of the HelpButton, InsertButton, ChangeButton,
DeleteButton, and SelectButton properties.
Implementation: The TakeToolbar method calls the DisplayButtons method. The DisplayButtons
method calls the PARENT.DisplayButtons method
(ToolbarTarget.DisplayButtons) to handle buttons common to all ToolbarTargets.
Example:
CODE
Toolbar.Init !initialize Toolbar object
BRW1.AddToolbarTarget( Toolbar ) !register a BrowseBox target
ToolBar.SetTarget( ?Browse:1) !calls DisplayButtons via TakeToolbar
The vcr parameter lets the TakeEvent method specify an appropriate subsequent or secondary
action. For example, the ToolbarListboxClass.TakeEvent method, may interpret a scroll down as
"save and then scroll." The method takes the necessary action to save the item and
accomplishes the secondary scroll action by setting the vcr parameter.
Implementation: The ToolbarClass.TakeEvent method calls the TakeEvent method for the active
ToolbarTarget object. The ToolbarClass.SetTarget method sets the active
ToolbarTarget object.
Example:
ToolbarClass.TakeEvent PROCEDURE(<*LONG VCR>,WindowManager WM)
CODE
ASSERT(~SELF.List &= NULL)
IF RECORDS(SELF.List)
SELF.List.Item.TakeEvent(VCR,WM)
END
TakeToolbar, VIRTUAL
The TakeToolbar method sets the toolbar state appropriate to the ToolbarListboxClass object.
Implementation: The TakeToolbar method sets appropriate TIP attributes for the toolbar buttons
and enables and disables toolbar buttons appropriate for the
ToolbarListboxClass object. The ToolbarClass.SetTarget method and the
TryTakeToolbar method call the TakeToolbar method.
Example:
MyToolbarClass.SetTarget PROCEDURE(SIGNED Id)
I USHORT,AUTO
Hit USHORT
CODE
ASSERT(~ (SELF.List &= NULL))
IF Id !set explicitly requested target
SELF.List.Id = Id
GET(SELF.List,SELF.List.Id)
ASSERT (~ERRORCODE())
SELF.List.Item.TakeToolbar
ELSE !set any (last) valid target
LOOP I = 1 TO RECORDS(SELF.List)
GET(SELF.List,I)
IF SELF.List.Item.TryTakeToolbar() THEN Hit = I.
END
IF Hit THEN GET(SELF.List,Hit).
END
TryTakeToolbar, VIRTUAL
The TryTakeToolbar method returns a value indicating whether the ToolbarTarget object
successfully assumed control of the toolbar. A return value of one (1 or True) indicates success; a
value of zero (0 or False) indicates failure to take control of the toolbar.
Example:
ToolbarClass.SetTarget PROCEDURE(SIGNED Id)
I USHORT,AUTO
Hit USHORT
CODE
ASSERT(~ (SELF.List &= NULL))
IF Id !set explicitly requested target
SELF.List.Id = Id
GET(SELF.List,SELF.List.Id)
ASSERT (~ERRORCODE())
SELF.List.Item.TakeToolbar
ELSE !set a valid target
LOOP I = 1 TO RECORDS(SELF.List)
GET(SELF.List,I)
IF SELF.List.Item.TryTakeToolbar() THEN Hit = I.
END
IF Hit THEN GET(SELF.List,Hit).
END
ToolbarReltreeClass
ToolbarReltreeClass Overview
The ToolbarReltreeClass is a ToolbarTarget that handles events for a RelationTree control LIST.
See Control Templates--RelationTree for more information.
ToolbarReltreeClass Concepts
The ToolbarReltreeClass source code is installed by default to the Clarion \LIBSRC folder. The
source code and its respective components are in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a ToolbarClass object and a related ToolbarReltreeClass (ToolbarTarget)
object.
This example uses a global toolbar to drive a template generated RelTree control. The program
POSTs toolbar events to the active MDI window using the SYSTEM{Prop:Active} property. Then
the ToolbarClass object calls on the active ToolbarReltreeClass object to handle the (scrolling)
events.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABERROR.INC')
INCLUDE('ABFILE.INC')
INCLUDE('ABWINDOW.INC')
INCLUDE('ABTOOLBA.INC')
INCLUDE('KEYCODES.CLW')
MAP
Main PROCEDURE
OrderTree PROCEDURE
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
Access:Orders CLASS(FileManager)
Init PROCEDURE
END
Relate:Orders CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
ToolBarReltreeClass 1197
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,BINDABLE,THREAD
KeyCustNumber KEY(CUS:CustNumber),NOCASE,OPT
KeyCompany KEY(CUS:Company),DUP,NOCASE
Record RECORD,PRE()
CustNumber LONG
Company STRING(20)
ZipCode LONG
END
END
Orders FILE,DRIVER('TOPSPEED'),PRE(ORD),CREATE,BINDABLE,THREAD
KeyOrderNumber KEY(ORD:OrderNumber),NOCASE,OPT,PRIMARY
KeyCustNumber KEY(ORD:CustNumber),DUP,NOCASE,OPT
Record RECORD,PRE()
CustNumber LONG
OrderNumber SHORT
InvoiceAmount DECIMAL(7,2)
END
END
CODE
GlobalErrors.Init
Relate:Customer.Init
Relate:Orders.Init
Main !run Application Frame w/ toolbar
Relate:Customer.Kill
Relate:Orders.Kill
GlobalErrors.Kill
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
TakeAccepted PROCEDURE(),BYTE,PROC,VIRTUAL
END
1198 ABC Library Reference
CODE
ThisWindow.Run()
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
SELF.FirstField = 1
OPEN(Frame)
SELF.Opened=True
RETURN ReturnValue
ThisWindow.TakeAccepted PROCEDURE()
CODE
CASE ACCEPTED()
OF Toolbar:First TO Toolbar:Last !post toolbar event to active thread
POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active})
RETURN Level:Notify
OF ?OrderTree
START(OrderTree,25000) !start OrderTree procedure/thread
END
RETURN PARENT.TakeAccepted()
OrderTree PROCEDURE !template generated Window procedure
! with RelTree control template
DisplayString STRING(255)
Toolbar ToolbarClass !declare Toolbar object
REL1::Toolbar CLASS(ToolbarReltreeClass) !derive REL1::Toolbar object (target)
TakeEvent PROCEDURE(<*LONG VCR>,WindowManager WM),VIRTUAL
END
!template generated RelTree QUEUEs and vaiables
CODE
GlobalResponse = ThisWindow.Run()
!template generated RelTree ROUTINEs
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
SELF.FirstField = ?RelTree
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with ThisWindow
Relate:Customer.Open
DO REL1::ContractAll
OPEN(window)
SELF.Opened=True
Toolbar.AddTarget(REL1::Toolbar,?RelTree) !make REL1::Toolbar a toolbar target
Toolbar.SetTarget(?RelTree) !make REL1::Toolbar the active target
?RelTree{Prop:Selected} = 1
SELF.SetAlerts()
RETURN ReturnValue
ToolbarReltreeClass Properties
The ToolbarReltreeClass inherits all the properties of the ToolbarTarget from which it is derived.
See ToolbarTarget Properties for more information.
ToolBarReltreeClass 1201
ToolbarReltreeClass Methods
The ToolbarReltreeClass inherits all the methods of the ToolbarTarget from which it is derived.
See ToolbarTarget Methods for more information.
In addition to (or instead of) the inherited methods, the ToolbarReltreeClass contains the
following methods:
DisplayButtons, VIRTUAL
The DisplayButtons method enables and disables the appropriate toolbar buttons for the
ToolbarReltreeClass object based on the values of the HelpButton, InsertButton, ChangeButton,
DeleteButton, and SelectButton properties.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolBarForm, -1 ) !register an Update Form target
Toolbar.AddTarget( REL1::Toolbar, ?RelTree ) !register a RelTree target
ToolBar.SetTarget( ?RelTree ) !calls DisplayButtons via TakeToolbar
!program code
TakeToolbar, VIRTUAL
The TakeToolbar method sets the toolbar state appropriate to the ToolbarReltreeClass object.
Implementation: The TakeToolbar method sets appropriate TIP attributes for the toolbar buttons
and enables and disables toolbar buttons appropriate for the
ToolbarReltreeClass object. The ToolbarClass.SetTarget method calls the
TakeToolbar method.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolBarForm, -1 ) !register an Update Form target
Toolbar.AddTarget( REL1::Toolbar, ?RelTree ) !register a RelTree target
ToolBar.SetTarget( ?RelTree ) !calls TakeToolbar
!program code
ToolbarTargetClass
ToolbarTarget Overview
ToolbarClass and ToolbarTarget objects work together to reliably "convert" an event associated
with a toolbar button into an appropriate event associated with a specific control or window. This
lets you use a single toolbar to drive a variety of targets, such as update forms, browse lists,
relation tree lists, etc. A single toolbar can even drive multiple targets (two or more BrowseBoxes)
in a single procedure.
Although the ToolbarTarget is useful by itself, other more useful classes are derived from it
(ToolbarListboxClass, the ToolbarRelTreeClass, and the ToolbarUpdateClass), and other
structures, such as the ToolbarClass, use it to reference any of these derived classes. The
classes derived from ToolbarTarget let you set the state of the toolbar appropriate to the toolbar
driven entity (set tooltips, enable/disable buttons, etc.), then process toolbar events for the entity
by converting the generic toolbar events into appropriate entity-specific events.
ToolbarTarget Concepts
Within an MDI application, the ToolbarClass and ToolbarTarget work together to reliably interpret
and pass an event (EVENT:Accepted) associated with a toolbar button into an event associated
with a specific control or window. For example, the end user CLICKS on a toolbar button (say the
"Insert" button) on the MDI application frame. The frame procedure forwards the event to the
active thread (POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active})). The active thread
(procedure) manages a window that displays two LIST controls, and one of the LISTs has focus.
This procedure has a ToolbarClass object plus a ToolbarTarget object for each LIST control. The
ToolbarClass object takes the event (ToolbarClass.TakeEvent)1 and forwards the event to the
active ToolbarTarget object (the target that represents the LIST with focus). The ToolbarTarget
object takes the event (ToolbarListBoxClass.TakeEvent) and handles it by posting an appropriate
event to a specific control or to the window, for example:
POST(EVENT:ACCEPTED,SELF.InsertButton) !insert a record
POST(EVENT:PageDown,SELF.Control) !scroll a LIST
POST(EVENT:Completed) !complete an update form
POST(EVENT:CloseWindow) !select a record
etc.
1If the procedure has a WindowManager object, the WindowManager object takes the event
(WindowManager.TakeEvent) and forwards it to the ToolbarClass object
(WindowManager.TakeAccepted).
1204 ABC Library Reference
At present, the ABC Library has three classes derived from the ToolbarTarget class:
These ToolbarTarget objects convert generic toolbar events into appropriate entity-specific
events. There may be zero or more ToolbarTarget objects within a procedure; however, only one
is active at a time.
The ToolbarClass keeps a list of ToolbarTarget objects so it can forward events and method calls
to a particular target.
The ToolbarTarget source code is installed by default to the Clarion \LIBSRC folder. The
ToolbarTarget source code and its respective components are contained in:
ToolbarTarget Properties
ChangeButton (change control number)
ChangeButton SIGNED
The ChangeButton property contains the control number (usually represented by the control's
Field Equate Label) of the window control that invokes the change record action for this
ToolbarTarget object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar
change button, and as the target control when POSTing certain events. See
POST in the Language Reference for more information. The ToolbarTarget
object POSTs an EVENT:Accepted to the ChangeButton control when the end
user CLICKS the toolbar change button.
Control SIGNED
The Control property contains the control number (usually represented by the control's Field
Equate Label) of the window control associated with this ToolbarTarget object. For ToolbarTarget
objects that do not have an associated control (update forms), the Control property may contain
any identifying number.
The ToolbarTarget object uses this property as the target control when POSTing certain events.
See POST in the Language Reference.
Implementation: By convention, update forms have a Control value of negative one (-1).
DeleteButton SIGNED
The DeleteButton property contains the control number (usually represented by the control's
Field Equate Label) of the window control that invokes the delete record action for this
ToolbarTarget object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar
delete button, and as the target control when POSTing certain events. See POST
in the Language Reference for more information. The ToolbarTarget object
POSTs an EVENT:Accepted to the DeleteButton control when the end user
CLICKS the toolbar delete button.
HelpButton SIGNED
The HelpButton property contains the control number (usually represented by the control's Field
Equate Label) of the window control that invokes Windows help for this ToolbarTarget object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar help
button. The ToolbarTarget object "presses" the help (F1) key when the end user
CLICKS the toolbar help button.
ToolBarTargetClass 1207
InsertButton SIGNED
The InsertButton property contains the control number (usually represented by the control's
Field Equate Label) of the window control that invokes the insert record action for this
ToolbarTarget object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar
insert button, and as the target control when POSTing certain events. See POST
in the Language Reference for more information. The ToolbarTarget object
POSTs an EVENT:Accepted to the InsertButton control when the end user
CLICKS the toolbar insert button.
LocateButton SIGNED
The LocateButton property contains the control number (usually represented by the control's
field equate label) of the window control that invokes the query action for this ToolbarTarget
object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar
Locate button, and as the target control when POSTing certain events. See
POST in the Language Reference for more information. The ToolbarTarget
object POSTs an EVENT:Accepted to the LocateButton control when the user
Presses the toolbar locate button.
The LocateButton control is used when the QBE extension template has been
added to a procedure.
SelectButton SIGNED
The SelectButton property contains the control number (usually represented by the control's
Field Equate Label) of the window control that invokes the select record action for this
ToolbarTarget object.
Implementation: The ToolbarTarget object uses this property to enable or disable the toolbar
select button, and as the target control when POSTing certain events. See POST
in the Language Reference for more information. The ToolbarTarget object
POSTs an EVENT:Accepted to the SelectButton control when the end user
CLICKS the toolbar select button.
ToolBarTargetClass 1209
ToolbarTarget Methods
ToolbarTarget Functional Organization--Expected Use
As an aid to understanding the ToolbarTarget class, it is useful to recognize that all its methods
are virtual. Typically you will not call these methods directly from your program--the ToolbarClass
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.
Virtual Methods
DisplayButtons, VIRTUAL
The DisplayButtons method enables and disables the appropriate toolbar buttons for the
ToolbarTarget object based on the values of the HelpButton, InsertButton, ChangeButton,
DeleteButton, and SelectButton properties.
Example:
MyToolbarListboxClass.DisplayButtons PROCEDURE
CODE
PARENT.DisplayButtons !Call base class DisplayButtons
!your custom code here
The vcr parameter lets the TakeEvent method specify an appropriate subsequent or secondary
action. For example, the ToolbarUpdateClass.TakeEvent method (for a FORM), may interpret a
vcr scroll down as "save and then scroll." The method takes the necessary action to save the item
and accomplishes the secondary scroll action by setting the vcr parameter.
Implementation: The ToolbarClass.TakeEvent method calls the TakeEvent method for the active
ToolbarTarget object. The ToolbarClass.SetTarget method sets the active
ToolbarTarget object. The TakeEvent method POSTs an EVENT:Accepted to the
appropriate local control (insert, change, delete, help) common to all
ToolbarTarget objects.
1212 ABC Library Reference
Example:
REL1::Toolbar.TakeEvent PROCEDURE(<*LONG VCR>,WindowManager WM)
CODE
CASE ACCEPTED()
OF Toolbar:Bottom TO Toolbar:Up
SELF.Control{PROPLIST:MouseDownRow} = CHOICE(SELF.Control)
EXECUTE(ACCEPTED()-Toolbar:Bottom+1)
DO REL1::NextParent
DO REL1::PreviousParent
DO REL1::NextLevel
DO REL1::PreviousLevel
DO REL1::NextRecord
DO REL1::PreviousRecord
END
OF Toolbar:Insert TO Toolbar:Delete
SELF.Control{PROPLIST:MouseDownRow} = CHOICE(SELF.Control)
EXECUTE(ACCEPTED()-Toolbar:Insert+1)
DO REL1::AddEntry
DO REL1::EditEntry
DO REL1::RemoveEntry
END
ELSE
PARENT.TakeEvent(VCR,ThisWindow)
END
TakeToolbar, VIRTUAL
The TakeToolbar method is a placeholder method to set the toolbar state appropriate to the
ToolbarTarget object. This includes setting MSG and TIP attributes, enabling and disabling
appropriate buttons, etc.
TryTakeToolbar, VIRTUAL
The TryTakeToolbar method is a virtual placeholder method to return a value indicating whether
the ToolbarTarget object successfully assumed control of the toolbar. A return value of one (1 or
True) indicates success; a value of zero (0 or False) indicates failure to take control of the toolbar.
ToolbarUpdateClass
ToolbarUpdateClass Overview
The ToolbarUpdateClass is a ToolbarTarget that handles events for a template generated Form
Procedure that is called from a template generated Browse Procedure. See Procedure
Templates--Browse and Form for more information.
ToolbarUpdateClass Concepts
ToolbarUpdateClass objects implement the event handling specific to a template generated Form
Procedure. The Form specific events are primarily the event to complete the Form and save the
record (EVENT:Accepted for an OK button). There may be zero or several ToolbarTarget objects
within a procedure; however, only one is active at a time.
Once the ToolbarForm is registered with the WindowManager, the WindowManager handles the
interaction between the ToolbarClass object and the ToolbarUpdateClass object with no other
references in the template generated code.
You can use the FormVCRControl template's prompts to derive from the ToolbarUpdateClass.
The templates provide the derived class so you can modify the ToolBarForm's behavior on an
instance-by-instance basis.
The ToolbarUpdateClass source code is installed by default to the Clarion \LIBSRC folder. The
ToolbarUpdateClass source code and its respective components are:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a ToolbarClass object and related ToolbarTarget (ToolbarUpdateClass and
ToolbarListboxClass) objects.
This example uses a global toolbar to drive a BrowseClass LIST, its child Form procedure, and
the Form procedure's secondary BrowseClass LIST.
The program POSTs toolbar events to the active MDI window using the SYSTEM{Prop:Active}
property. Then the local ToolbarClass object calls on the active ToolbarTarget object to handle
the event.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABERROR.INC')
INCLUDE('ABFILE.INC')
INCLUDE('ABWINDOW.INC')
INCLUDE('ABBROWSE.INC')
INCLUDE('ABTOOLBA.INC')
INCLUDE('KEYCODES.CLW')
MAP
Main PROCEDURE !contains global toolbar
BrowseCustomers PROCEDURE !template generated Browse
UpdateCustomer PROCEDURE !template generated Form
END
GlobalErrors ErrorClass
Access:Customer CLASS(FileManager)
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
Access:Orders CLASS(FileManager)
Init PROCEDURE
END
Relate:Orders CLASS(RelationManager)
Init PROCEDURE
Kill PROCEDURE,VIRTUAL
END
GlobalRequest BYTE(0),THREAD
GlobalResponse BYTE(0),THREAD
VCRRequest LONG(0),THREAD
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,BINDABLE,THREAD
KeyCustNumber KEY(CUS:CustNumber),NOCASE,OPT
ToolBarUpdateClass 1217
KeyCompany KEY(CUS:Company),DUP,NOCASE
Record RECORD,PRE()
CustNumber LONG
Company STRING(20)
ZipCode LONG
END
END
Orders FILE,DRIVER('TOPSPEED'),PRE(ORD),CREATE,BINDABLE,THREAD
KeyOrderNumber KEY(ORD:OrderNumber),NOCASE,OPT,PRIMARY
KeyCustNumber KEY(ORD:CustNumber),DUP,NOCASE,OPT
Record RECORD,PRE()
CustNumber LONG
OrderNumber SHORT
InvoiceAmount DECIMAL(7,2)
END
END
CODE
GlobalErrors.Init
Relate:Customer.Init
Relate:Orders.Init
Main !run Application Frame w/ toolbar
Relate:Customer.Kill
Relate:Orders.Kill
GlobalErrors.Kill
FrameWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
TakeAccepted PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
FrameWindow.Run()
FrameWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
1218 ABC Library Reference
SELF.FirstField = 1
OPEN(Frame)
SELF.Opened=True
RETURN ReturnValue
FrameWindow.TakeAccepted PROCEDURE()
CODE
CASE ACCEPTED()
OF Toolbar:First TO Toolbar:Last !post toolbar event to active thread
POST(EVENT:Accepted,ACCEPTED(),SYSTEM{Prop:Active})
RETURN Level:Notify
OF ?BrowseCustomers
START(BrowseCustomers,25000) !start BrowseCustomers procedure/thread
END
RETURN PARENT.TakeAccepted()
BrowseWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
ToolBarUpdateClass 1219
SELF.FirstField = ?CustList
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar) !register Toolbar with BrowseWindow
Relate:Customer.Open
BRW1.Init(?CustList,CustQ.ViewPosition,CustView,CustQ,Relate:Customer,SELF)
OPEN(QuickWindow)
SELF.Opened=True
BRW1.Q &= CustQ
BRW1.AddSortOrder(,CUS:KeyCompany) !set scroll order for Browse AND child Form
BRW1.AddField(CUS:CustNumber,BRW1.Q.CUS:CustNumber)
BRW1.AddField(CUS:Company,BRW1.Q.CUS:Company)
BRW1.AddField(CUS:ZipCode,BRW1.Q.CUS:ZipCode)
BRW1.AskProcedure = 1
BRW1.InsertControl=?Insert
BRW1.ChangeControl=?Change
BRW1.DeleteControl=?Delete
BRW1.AddToolbarTarget(Toolbar) !BRW1 instantiates a ToolbarListboxClass
SELF.SetAlerts() ! object, and makes it a target
RETURN ReturnValue
BrowseWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Customer.Close
RETURN ReturnValue
OrderView VIEW(Orders)
END
OrderQ QUEUE
ORD:OrderNumber LIKE(ORD:OrderNumber)
ORD:InvoiceAmount LIKE(ORD:InvoiceAmount)
ViewPosition STRING(1024)
END
ENTRY(@s20),AT(64,36),USE(CUS:Company)
PROMPT('&Zip Code:'),AT(8,52),USE(?Zip:Prompt)
ENTRY(@P#####P),AT(64,52),USE(CUS:ZipCode),RIGHT(1)
END
TAB('Orders'),USE(?OrderTab)
LIST,AT(8,22,156,81),USE(?OrdList),IMM,HVSCROLL,FROM(OrderQ),|
FORMAT('52R(2)|M~Order ID~C(0)@n-7@60D(12)|M~Amount~C(0)@n-10.2@')
END
END
BUTTON('OK'),AT(97,114),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(133,114),USE(?Cancel)
END
FormWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
SELF.FirstField = ?CustNumber:Prompt
SELF.VCRRequest &= VCRRequest
SELF.Errors &= GlobalErrors
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
SELF.AddItem(?Cancel,RequestCancelled)
Relate:Customer.Open
SELF.Primary &= Relate:Customer
SELF.OkControl = ?OK
IF SELF.PrimeUpdate() THEN RETURN Level:Notify.
OrderBrowse.Init(?OrdList,OrderQ.ViewPosition,OrderView,OrderQ,Relate:Orders,SELF)
OPEN(QuickWindow)
SELF.Opened=True
OrderBrowse.Q &= OrderQ
OrderBrowse.AddSortOrder(,ORD:KeyCustNumber)
OrderBrowse.AddRange(ORD:CustNumber,Relate:Orders,Relate:Customer)
OrderBrowse.AddField(ORD:OrderNumber,OrderBrowse.Q.ORD:OrderNumber)
OrderBrowse.AddField(ORD:InvoiceAmount,OrderBrowse.Q.ORD:InvoiceAmount)
SELF.AddItem(Toolbar) !Register Toolbar with FormWindow
SELF.AddItem(ToolbarForm) !Register ToolbarForm with FormWindow
ToolBarUpdateClass 1221
FormWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Customer.Close
RETURN ReturnValue
FormWindow.TakeSelected PROCEDURE
CODE
IF FIELD(){PROP:Type}=Create:List
Toolbar.SetTarget(FIELD()) !make selected list the active Target
END !(FormWindow also auto selects the Target)
RETURN PARENT.TakeSelected()
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'Customer'
SELF.Buffer &= CUS:Record
SELF.Create = 1
SELF.AddKey(CUS:KeyCustNumber,'CUS:KeyCustNumber',1)
SELF.AddKey(CUS:KeyCompany,'CUS:KeyCompany',0)
SELF.AddKey(CUS:KeyZipCode,'CUS:KeyZipCode',0)
Access:Orders.Init PROCEDURE
CODE
PARENT.Init(Orders,GlobalErrors)
SELF.FileNameValue = 'Orders'
SELF.Buffer &= ORD:Record
SELF.Create = 1
SELF.AddKey(ORD:KeyOrderNumber,'ORD:KeyOrderNumber',1)
SELF.AddKey(ORD:KeyCustNumber,'ORD:KeyCustNumber',0)
Relate:Customer.Init PROCEDURE
CODE
Access:Customer.Init
PARENT.Init(Access:Customer,1)
SELF.AddRelation(Relate:Orders,RI:CASCADE,RI:RESTRICT,ORD:KeyCustNumber)
SELF.AddRelationLink(CUS:CustNumber,ORD:CustNumber)
Relate:Customer.Kill PROCEDURE
CODE
Access:Customer.Kill
PARENT.Kill
Relate:Orders.Init PROCEDURE
CODE
Access:Orders.Init
1222 ABC Library Reference
PARENT.Init(Access:Orders,1)
SELF.AddRelation(Relate:Customer)
Relate:Orders.Kill PROCEDURE
CODE
Access:Orders.Kill
PARENT.Kill
ToolBarUpdateClass 1223
ToolbarUpdateClass Properties
The ToolbarUpdateClass inherits all the properties of the ToolbarTarget from which it is derived.
See ToolbarTarget Properties for more information.
In addition to the inherited properties, the ToolbarUpdateClass contains the following properties.
Request BYTE
The Request property indicates for what purpose the ToolbarUpdateClass object's entity is used.
The ToolbarUpdateClass uses this value to set appropriate toolbar button TIP attributes and
enable and disable the appropriate toolbar buttons.
Implementation: The TakeToolbar and DisplayButtons methods set the toolbar state based on the
value of the Request property. EQUATEs for the Request values are declared in
TPLEQU.CLW as follows:
InsertRecord EQUATE (1) !Add a record
ChangeRecord EQUATE (2) !Change the current record
DeleteRecord EQUATE (3) !Delete the current record
SelectRecord EQUATE (4) !Select the current record
History BYTE
The History property indicates whether or not to enable the toolbar history (ditto) button for this
ToolbarUpdateClass object. The ToolbarUpdateClass uses this value to set the appropriate
toolbar button TIP attribute and enable or disable the appropriate toolbar button.
By convention the history button restores the previous value for a field or record. See Control
Templates--SaveButton for more information.
Implementation: The TakeToolbar and DisplayButtons methods set the toolbar state based on the
value of the History property. A History value of one (1) enables the toolbar
history button; a value of zero (0) disables the history button
ToolbarUpdateClass Methods
The ToolbarUpdateClass inherits all the methods of the ToolbarTarget from which it is derived.
See ToolbarTarget Methods for more information.
In addition to (or instead of) the inherited methods, the ToolbarUpdateClass contains the
following methods:
DisplayButtons, VIRTUAL
The DisplayButtons method enables and disables the appropriate toolbar buttons for the
ToolbarUpdateClass object based on the values of the HelpButton, InsertButton, ChangeButton,
DeleteButton, and SelectButton properties.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolbarForm, -1 ) !register an Update Form target
Toolbar.AddTarget( REL1::Toolbar, ?RelTree ) !register a RelTree target
ToolBar.SetTarget( -1 ) !calls DisplayButtons via TakeToolbar
!program code
The vcr parameter lets the TakeEvent method specify an appropriate subsequent or secondary
action. For example, the ToolbarUpdateClass.TakeEvent method (for a FORM), may interpret a
vcr scroll down as "save and then scroll." The method takes the necessary action to save the item
and accomplishes the secondary scroll action by setting the vcr parameter.
Implementation: The ToolbarClass.TakeEvent method calls the TakeEvent method for the active
ToolbarTarget object. The ToolbarClass.SetTarget method sets the active
ToolbarTarget object.
Example:
ToolbarClass.TakeEvent PROCEDURE(<*LONG VCR>,WindowManager WM)
CODE
ASSERT(~SELF.List &= NULL)
IF RECORDS(SELF.List)
SELF.List.Item.TakeEvent(VCR,WM)
END
TakeToolbar, VIRTUAL
The TakeToolbar method sets the toolbar state appropriate to the ToolbarUpdateClass object.
Implementation: The TakeToolbar method sets appropriate TIP attributes for the toolbar buttons
and enables and disables toolbar buttons appropriate for the
ToolbarUpdateClass object. The ToolbarClass.SetTarget method and the
TryTakeToolbar method call the TakeToolbar method.
Example:
CODE
Toolbar.Init !initialize Toolbar object
ToolBar.AddTarget( ToolbarForm, -1 ) !register an Update Form target
Toolbar.AddTarget( REL1::Toolbar, ?RelTree ) !register a RelTree target
ToolBar.SetTarget( -1 ) !calls TakeToolbar
!program code
TryTakeToolbar, VIRTUAL
The TryTakeToolbar method returns a value indicating whether the ToolbarTarget object
successfully assumed control of the toolbar. A return value of one (1 or True) indicates success; a
value of zero (0 or False) indicates failure to take control of the toolbar.
Example:
ToolbarClass.SetTarget PROCEDURE(SIGNED Id)
I USHORT,AUTO
Hit USHORT
CODE
ASSERT(~ (SELF.List &= NULL))
IF Id !set explicitly requested target
SELF.List.Id = Id
GET(SELF.List,SELF.List.Id)
ASSERT (~ERRORCODE())
SELF.List.Item.TakeToolbar
ELSE !set a valid target
LOOP I = 1 TO RECORDS(SELF.List)
GET(SELF.List,I)
IF SELF.List.Item.TryTakeToolbar() THEN Hit = I.
END
IF Hit THEN GET(SELF.List,Hit).
END
TranslatorClass
TranslatorClass Overview
By default, the ABC Templates, the ABC Library, and the
Clarion visual source code formatters generate American English user interfaces. However,
Clarion makes it very easy to efficiently produce non-English user interfaces for your application
programs.
The TranslatorClass provides very fast runtime translation of user interface text. The
TranslatorClass lets you deploy a single application that serves all your customers, regardless of
their language preference. That is, you can use the TranslatorClass to display several different
user interface languages based on end user input or some other runtime criteria, such as INI file
or control file contents.
Alternatively, you can use the Clarion translation files (*.TRN) to implement a single non-English
user inteface at compile time.
TranslatorClass Concepts
The TranslatorClass and the ABUTIL.TRN file provide a way to perform language translation at
runtime. That is, you can make your program display one or more non-English user interfaces
based on end user input or some other runtime criteria such as INI file or control file contents.
You can also use the TranslatorClass to customize a single application for multiple customers.
The TranslatorClass operates on all user interface elements including window controls, window
titlebars, tooltips, list box headers, and static report controls.
The ABUTIL.TRN file contains translation pairs for all the user interface text generated by the
ABC Templates and the ABC Library. A translation pair is simply two text strings: one text string
for which to search and another text string to replace the searched-for text. At runtime, the
TranslatorClass applies the translation pairs to each user interface element.
You can directly edit the ABUTIL.TRN file to add additional translation items. We recommend this
method for translated text common to several applications. The translation pairs you add to the
Translator GROUP declared in ABUTIL.TRN are automatically shared by any application relying
on the ABC Library and the ABC Templates.
1230 ABC Library Reference
The default ABUTIL.TRN translation pairs do not include any custom text that you apply to your
windows and menus. To translate custom text, you simply add translation pairs to the translation
process, either at a global level or at a local level according to your requirements. To help identify
custom text, the TranslatorClass automatically identifies any untranslated text for you; you need
only supply the translation. See ExtractText for more information.
Macro Substitution
The TranslatorClass defines and translates macro strings. A TranslatorClass macro is simply text
delimited by percent signs (%), such as %mymacro%. You may use a macro within the text on an
APPLICATION, WINDOW, or REPORT control or titlebar, or you may use a macro within
TranslatorClass translation pairs text.
You define the macro with surrounding percent signs (%), and you define its substitution value
with a TranslatorClass translation pair (without percent signs).
The ABC Templates instantiate a global TranslatorClass object for each application that checks
the Enable Run-Time Translation box on the Global Properties dialog. See Template
Overview--Application Properties for more information.
The TranslatorClass object is called Translator, and each template-generated procedure calls on
the Translator object to translate all text for its APPLICATION, WINDOW or REPORT.
Additionally, the template-generated PopupClass objects (ASCIIViewer and BrowseBox
templates) and PrintPreviewClass objects (Report template) use the Translator to translate menu
text.
Note: The ABC Templates use the TranslatorClass to apply user interface text defined at
compile time. The templates do not provide a runtime switch between user
interface languages.
The TranslatorClass source code is installed by default to the Clarion \LIBSRC folder. The
TranslatorClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a TranslatorClass object.
This example applies both default and custom translations to a "preferences" window. It also
collects and stores untranslated text in a file so you don't have to manually collect the text to
translate.
PROGRAM
INCLUDE('ABUTIL.INC') !declare TranslatorClass
MAP
END
ACCEPT
IF EVENT() = EVENT:Accepted
IF FIELD() = ?OK
INIMgr.Update('Preferences','Sound',Sound)
INIMgr.Update('Preferences','Volume',Volume)
POST(EVENT:CloseWindow)
. . .
Translator.Kill !write user inteface text
1234 ABC Library Reference
TranslatorClass Properties
The TranslatorClass contains the following properties:
ExtractText CSTRING(File:MaxFilePath)
The ExtractText property contains the pathname of a file to receive a list of runtime user
interface text to translate. If ExtractText contains a pathname, the TranslatorClass identifies,
extracts, and writes the user interface text it encounters at runtime to the named file.
To generate a complete list of text to translate, assign a filename to the ExtractText property,
compile and run your application, then open each procedure, menu, and option in the application.
When you close the application, the TranslatorClass generates a sorted list of all the untranslated
text items. You can then use this information to provide appropriate translations for the
untranslated text. See AddTranslation for more information.
For applications that do dynamic text assignments based on data, you may even want to set the
ExtractText property when you deploy your application, so you can collect the text that actually
appears on end user screens based on the specific ways the end users work and the data they
access.
Implementation: The ExtractText property defaults to blank. A value of blank does not extract
untranslated text. A non-blank value extracts the text, and a valid pathname
writes the untranslated text to the specified file.
TranslatorClass Methods
The TranslatorClass contains the following methods:
AddTranslation( | group |)
| text, translation |
The text is not limited to a single word; it may contain a phrase, or any text string, including
TranslatorClass macros (see TranslatorClass Concepts--Runtime Translation).
Implementation: The group parameter must name a GROUP that begins the same as the
TranslatorGroup structure declared in ABUTIL.INC:
TranslatorGroup GROUP,TYPE
Number USHORT
END
When you declare a translation group, be sure to set the correct number of translation pairs in the
GROUP. For example:
MyAppTranslator GROUP
Pairs USHORT(2) !2 translation pairs
PSTRING('&Insert') !begin 1st pair
PSTRING('&Agregar') ! end 1st pair
PSTRING('Insert a new Record') !begin 2nd pair
PSTRING('Agregar un nuevo Registro') ! end 2nd pair
END
The TranslatorClass uses whole word, case sensitive matching to search for text.
For example, 'Insert' does not match '&Insert' or 'INSERT' or 'Insert a new
Record.'
1236 ABC Library Reference
The Init method uses the AddTranslation method to add the translation pairs
declared in ABUTIL.TRN to the translation process.
Example:
MyTranslations GROUP !declare local translations
Pairs USHORT(4) !4 translations pairs
PSTRING('&Sound') ! item 1 text
PSTRING('&xSoundx') ! item 1 replacement text
PSTRING('&Volume') ! item 2 text
PSTRING('&xVolumex') ! item 2 replacement text
PSTRING('Preferences') ! item 3 text
PSTRING('xPreferencesx') ! item 3 replacement text
PSTRING('OK') ! item 4 text
PSTRING('xOKx') ! item 4 replacement text
END
Translator TranslatorClass !declare Translator object
CODE
Translator.Init !initialize Translator object
!add default translation pairs
Translator.AddTranslation(MyTranslations) !add local translation pairs
OPEN(MyWindow)
Translator.TranslateWindow !translate all window controls
! and window titlebar
Init
The Init method initializes the TranslatorClass object.
Implementation: The Init method uses the TranslatorClass.AddTranslation method to add the
translation pairs declared in ABUTIL.TRN to the translation process.
Example:
Translator TranslatorClass !declare Translator object
CODE
Translator.Init !initialize Translator object:
! with default translation pairs
!program code
Translator.Kill !shut down Translator object
Kill
The Kill method frees any memory allocated during the life of the object and does any other
required termination code.
Implementation: The Kill method writes out a list of untranslated text strings if the ExtractText
property contains a valid INI file pathname.
Example:
Translator TranslatorClass !declare Translator object
CODE
Translator.Init !initialize Translator object:
! with default translation pairs
!program code
Translator.Kill !shut down Translator object
1238 ABC Library Reference
Implementation: The TranslateControl method calls the TranslateString method for the specified
control. Where applicable, the TranslateControl method translates MSG attribute
text, TIP attribute text, and FORMAT attribute text.
The TranslateControl method does not translate USE variable contents; therefore
it does not translate STRING controls that display a variable, nor the contents of
ENTRY, SPIN, TEXT, or COMBO controls. You can use the TranslateString
method to translate these elements if necessary.
Example:
PWindow WINDOW('Preferences'),AT(,,89,34),IMM,SYSTEM,GRAY
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
PROMPT('&Volume'),AT(31,19),USE(?VolumePrompt)
SPIN(@s20),AT(8,20,21,7),USE(Volume),HVSCROLL,RANGE(0,9),STEP(1)
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
OPEN(PWindow)
Translator.TranslateControl(?Sound) !translate Sound check box
Translator.TranslateControl(?VolumePrompt) !translate Volume prompt
ACCEPT !leave OK button
END ! and window title bar alone
Implementation: The TranslateControls method calls the TranslateControl method for each control
with a USE attribute in the specified range. The TranslateControls method
ignores controls with no USE attribute.
Example:
Pwindow WINDOW('Preferences'),AT(,,89,34),IMM,SYSTEM,GRAY
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
PROMPT('&Volume'),AT(31,19),USE(?VolumePrompt)
SPIN(@s20),AT(8,20,21,7),USE(Volume),HVSCROLL,RANGE(0,9),STEP(1)
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
OPEN(PWindow)
Translator.TranslateControls(?Sound,?VolumePrompt) !translate ?Sound thru ?Volume
ACCEPT !leave OK button untranslated
END
Implementation: The TranslateString method uses whole word, case sensitive matching to search
for text. For example, 'Insert' does not match '&Insert' or 'INSERT' or 'Insert a
new Record.' If there is no translation value for the specified text, TranslateString
returns text.
Example:
MyVar STRING('Sound')
PWindow WINDOW('Preferences'),AT(,,89,34),IMM,SYSTEM,GRAY
STRING(@s12),AT(8,30),USE(MyVar)
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
OPEN(PWindow)
MyVar=Translator.TranslateString(MyVar) !translate USE variable contents
ACCEPT
END
Implementation: The TranslateWindow method calls the TranslateControls method, specifying the
entire range of controls on the window, except for menus and toolbars.
Example:
PWindow WINDOW('Preferences'),AT(,,89,34),IMM,SYSTEM,GRAY
CHECK('&Sound'),AT(8,6),USE(Sound),VALUE('ON','OFF')
PROMPT('&Volume'),AT(31,19),USE(?VolumePrompt)
SPIN(@s20),AT(8,20,21,7),USE(Volume),HVSCROLL,RANGE(0,9),STEP(1)
BUTTON('OK'),AT(57,3,30,10),USE(?OK)
END
CODE
OPEN(PWindow)
Translator.TranslateWindow ! translate all controls
ACCEPT ! plus window titlebar
END
ViewManager
ViewManager Overview
The ViewManager class manages a VIEW. The ViewManager gives you easy, reliable access to
all the sophisticated power and speed of VIEWs, through its proven objects. So you get this
speed and power without reinventing any wheels.
ViewManager Concepts
The management provided by the ViewManager includes defining and applying multiple sort
orders, range limits (key based filters), and filters (non-key based) to the VIEW result set. It also
includes opening, buffering, reading, and closing the VIEW. Finally, it includes priming and
validating the view's primary file record buffer in anticipation of adding or updating records.
All these services provided by the ViewManager are applied to a VIEW--not a FILE. A VIEW may
encompass some or all of the fields in one or more related FILEs. The VIEW concept is extremely
powerful and perhaps essential in a client-server environment with normalized data. The VIEW
lets you access data from several different FILEs as though from a single file, and it does so very
efficiently. See VIEW in the Language Reference for more information.
In addition, the ViewManager supports buffering (some file drivers do not support buffering) which
allows the performance of "browse" type procedures to be virtually instantaneous when displaying
pages of records already read. Buffering (see BUFFER in the Language Reference) can also
optimize performance when the file driver is a Client/Server back-end database engine (usually
SQL-based), since the file driver can then optimize the calls made to the back-end database for
minimum network traffic.
The ViewManager relies on the FieldPairsClass and the RelationManager to do much of its work.
Therefore, if your program instantiates the ViewManager it must also instantiate these other
classes. Much of this is automatic when you INCLUDE the ViewManager header (ABFILE.INC) in
your program's data section. See Field Pairs Classes and Relation Manager Class for more
information. Also, see the Conceptual Example.
Perhaps more significantly, the ViewManager serves as the foundation of the BrowseClass and
the ProcessClass. That is, both the BrowseClass and the ProcessClass are derived from the
ViewManager.
The BrowseClass implements an interactive VIEW that includes a visual display of records with
scrolling, sorting, searching, and updating capabilities. See Browse Classes for more information.
1244 ABC Library Reference
The ProcessClass implements a batch (non-interactive) VIEW with sorting and updating
capability, but no visual display and therefore no scrolling or searching capability. See Process
Class for more information.
The ViewManager serves as the foundation to the Browse procedure template, the Report
procedure template, and the Process procedure template, because all these templates rely on
VIEWs.
The BrowseClass and the ProcessClass are derived from the ViewManager, and the ABC
Templates instantiate these derived classes; that is, the templates do not instantiate the
ViewManager independently of the BrowseClass or ProcessClass. The Browse procedure
template instantiates the BrowseClass, and the Process and Report procedure templates
instantiate the ProcessClass.
The ViewManager source code is installed by default to ..\LIBSRC. The specific ViewManager
files and their respective components are:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a ViewManager object. This example simply establishes a VIEW with a
particular sort order, range limit and filter, then processes the result set that fits the range and
filter criteria.
PROGRAM
INCLUDE('ABFILE.INC') !declare ViewManager class
MAP !program map
END
CUSTOMER FILE,DRIVER('TOPSPEED'),PRE(CUS),THREAD,BINDABLE
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
NAME STRING(30)
ZIP DECIMAL(5)
END
END
ProgressWindow WINDOW('Processing...'),AT(,,215,60),GRAY,TIMER(100)
STRING(@S60),AT(1,21,210,10),USE(ProgressMsg),CENTER
BUTTON('Cancel'),AT(87,37,45,14),USE(?Cancel)
END
1246 ABC Library Reference
CODE
GlobalErrors.Init !initialize GlobalErrors object
Relate:CUSTOMER.Ini !initialize Relate:Customer object
View:Customer.Init(Customer:View,Relate:CUSTOMER) !initialize View:Customer object
View:Customer.AddSortOrder( CUS:BYNUMBER ) !add sort BYNUMBER
View:Customer.AppendOrder( 'CUS:Name,CUS:ZIP' ) !add secondary sorts
View:Customer.AddRange(CUS:CUSTNO,Low,High) !add a range limit
View:Customer.SetFilter( 'CUS:ZIP=33066','1') !add filter #1
Relate:CUSTOMER.Open !open customer & related files
OPEN(ProgressWindow) !open the window
ProgressMsg='Processing...'
ACCEPT
CASE EVENT()
OF Event:OpenWindow
View:Customer.Reset(1) !open view, apply range & filter
OF Event:Timer
CASE View:Customer.Next() !get next view record
OF Level:Notify !if end of file, stop
POST(EVENT:CloseWindow)
BREAK
OF Level:Fatal !if fatal error, stop
POST(EVENT:CloseWindow)
BREAK
END
CUS:ZIP=33065 !process the record
IF Relate:CUSTOMER.Update() !update customer & related files
BREAK
ELSE
ProgressMsg = CLIP(CUS:Name)&' zip changed to '&CUS:ZIP
DISPLAY(ProgressMsg)
END
END
IF FIELD() = ?Cancel !if user cancelled, stop
IF EVENT() = Event:Accepted
POST(Event:CloseWindow)
END
END
END
Relate:CUSTOMER.Close !close customer & related files
View:CUSTOMER.Kill !shut down View:Customer object
Relate:CUSTOMER.Kill !shut down Relate:Customer object
GlobalErrors.Kill !shut down GlobalErrors object
ViewManager 1247
Access:CUSTOMER.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
SELF.FileNameValue = 'CUSTOMER.TPS'
SELF.Buffer &= CUS:Record
SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',1)
SELF.LazyOpen = False
Relate:CUSTOMER.Init PROCEDURE
CODE
Access:CUSTOMER.Init
PARENT.Init(Access:CUSTOMER,1)
1248 ABC Library Reference
ViewManager Properties
The ViewManager properties include references to the specific view being managed, as well as
several flags or switches that tell the ViewManager how to manage the referenced view.
The references are to the VIEW, the primary FILE's RelationManager object, and the VIEW's sort
information. These references allow the otherwise generic ViewManager object to process a
specific view.
The processing switches include buffering parameters that allow asynchronous read-ahead
buffering of pages and saving pages of already read records. This buffering provides instant
response for procedures displaying pages of records already read, and can also minimize
network traffic for Client/Server programs by reducing packets.
Several ViewManager methods affect the contents of the Order property, including AddSortOrder,
AddRange, AppendOrder, and SetFilter. The SetOrder method overrides a particular sort order,
and the SetSort method determines which sort order is current for the underlying VIEW.
PagesAhead USHORT
The PagesAhead property controls automatic record set buffering for the managed view (see
BUFFER in the Language Reference). Some file drivers do not support buffering. PagesAhead
specifies the number of additional "pages" of records to read ahead of the currently displayed
page.
Implementation: The Init method sets the PagesAhead property to zero (0). The Open method
implements the buffering specified by the PagesAhead, PagesBehind, PageSize,
and TimeOut properties.
PagesBehind USHORT
The PagesBehind property controls automatic record set buffering for the managed view (see
BUFFER in the Language Reference). Some file drivers do not support buffering. PagesBehind
specifies the number of "pages" of already read records to save.
Implementation: The Init method sets the PagesBehind property to two (2). The Open method
implements the buffering specified by the PagesAhead, PagesBehind, PageSize,
and TimeOut properties.
PageSize USHORT
The PageSize property controls automatic record set buffering for the managed view (see
BUFFER in the Language Reference). Some file drivers do not support buffering. PageSize
specifies the number of records in a buffer "page."
Implementation: The Init method sets the PageSize property to twenty(20). The Open method
implements the buffering specified by the PagesAhead, PagesBehind, PageSize,
and TimeOut properties.
Implementation: The SaveBuffers method stores a copy of the current Buffer contents into the
SavedBuffers property.
TimeOut USHORT
The TimeOut property controls automatic record set buffering for the managed view (see
BUFFER in the Language Reference). Some file drivers do not support buffering.
TimeOut specifies the number of seconds the buffered records are considered "trustworthy" in a
network environment. If the TimeOut period has expired, the VIEW fills a request for records from
the backend database rather than from the buffer.
Implementation: The Init method sets the TimeOut property to sixty (60). The Open method
implements the buffering specified by the PagesAhead, PagesBehind, PageSize,
and TimeOut properties.
View &VIEW
The View property is a reference to the managed VIEW. The View property simply identifies the
managed VIEW for the various ViewManager methods.
ViewManager 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:
OpenV open the VIEW
NextV get the next element
PreviousV get the previous element
PrimeRecord prepare a record for adding
ValidateRecordV validate the current element
SetFilterV specify a filter for the active sort order
SetSortV set the active sort order
CloseV close the VIEW
Occasional Use:
SetOrderV replace the active sort order
UseView use LazyOpen files
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.
| ,primaryrelation, parentrelation |
Implementation: The AddSortOrder method adds a sort order. The ApplyRange method applies
the active sort order's range limit. The SetSort method sets the active sort order.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
MyView.AddSortOrder(ORD:ByOrder) !sort by order no
MyView.AddRange(ORD:OrderNo) !range limit by current
!value of ORD:OrderNo
Only one sort order is active at a time. The SetSort method sets the active sort order based on
the sequence numbers returned by AddSortOrder.
Implementation: You may specify multiple sort orders by calling AddSortOrder multiple times. The
first call to AddSortOrder returns one (1), the second call returns two (2), etc.
Example:
CustSort = MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
OrderSort = MyView.AddSortOrder(ORD:ByOrder) !sort by order no
MyView.AddRange(ORD:OrderNo) !range limit by current
!value of ORD:OrderNo
!program code
IF MyView.SetSort(CustSort) !set active sort order
DISPLAY !if changed, refresh
END
AppendOrder Refines the active sort order for the ViewManager object.
expression list A string constant, variable, EQUATE, or expression that contains an ORDER
expression list. See the Language Reference--ORDER for more information.
The AppendOrder method refines or extends the active sort order for the ViewManager object.
Implementation: The ViewManager implements sort orders with the VIEW's ORDER attribute. The
AppendOrder method appends the expression list to the active sort order's
expression list. You do not need to prepend a comma or other separator to the
expression list.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AppendOrder('CUST:CustName') !and customer name
ApplyFilter, VIRTUAL
The ApplyFilter method applies the range limits and filter for the active sort order to the
managed VIEW. The filter applies starting with the next read.
The AddSortOrder and SetSort methods set the active sort order. The SetFilter method sets filter
expression.
Implementation: The ViewManager implements range limits and filters with the VIEW's FILTER
attribute. See the Language Reference--FILTER for more information.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
MyView.SetFilter( '(CUST:Name>''T'')' ) !set customer name filter
!program code
MyView.ApplyFilter !apply the filter
MyView.Next() !get next subject to filter
ApplyOrder, VIRTUAL
The ApplyOrder method applies the active sort order to the managed VIEW. The order applies
starting with the next read from the VIEW.
The AddSortOrder method sets the available sort orders.The SetSort method sets the active sort
order.
Implementation: The ViewManager implements sort orders with the VIEW's ORDER attribute. See
the Language Reference--ORDER for more information.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
!program code
MyView.ApplyOrder !apply the order
MyView.Next() !get next in specified order
The AddRange method specifies the range limits for the ViewManager object. The SetSort
method sets the active sort order.
Implementation: The ApplyRange method applies range limits and filters with the ApplyFilter
method.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
!program code
MyView.ApplyRange !apply the range limit
MyView.Next() !get next, subject to range
Normally, a VIEW is closed by the Close method, providing that it was opened with the Open
method. The force flag is used to close a VIEW that was not originally opened by the
ViewManagers’s Open method
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
MyView.Open !open the view
!program code
MyView.Close !close the view
GetFirstSortField
The GetFirstSortField method returns the first field that contains the current sort. If there is no
current sort active, the GetFirstSortField method returns a NULL.
GetFreeElementName
The GetFreeElementName method returns the fully qualified field name of the first sort field in
the active sort order that is not limited to a single value by the applied range limit. For example,
consider a VIEW sorted by Customer, Order, and Item, with the Customer field range limited to its
current value. The free element is the Order field. But remove the range limit, and the free
element is the Customer field.
The AddSortOrder method sets the key/sort order for the VIEW. The SetSort method sets the
active sort order. The AddRange method adds range limits.
Example:
BuildFilter PROCEDURE(STRING filter)
FieldName CSTRING(100)
CODE
FieldName = MyView.GetFreeElementName() !get filterable field name
MyView.SetFilter(FieldName&'[1] = '''&filter[1]&'''')!set a filter expression
MyView.ApplyFilter() !apply the filter expression
The AddSortOrder method sets the key/sort order for the VIEW. The SetSort method sets the
active sort order. The AddRange method adds range limits.
Example:
BrowseClass.TakeKey PROCEDURE
!method code
IF SELF.Sort.Locator.TakeKey()
Handled = 1
SELF.Reset(SELF.GetFreeElementPosition())
SELF.ResetQueue(Reset:Done)
ELSE
SELF.ListControl{PROP:SelStart} = SELF.CurrentChoice
END
Implementation: The Init method sets the values of the Order, PagesAhead, PagesBehind,
PageSize, Primary, and View properties.
The order parameter allows derived classes, such as the BrowseClass, to add
additional sort information to their underlying views.
By passing the Order property from another ViewManager object or the Sort
property from a BrowseClass object as the order parameter, you can implement
several objects with similar sorts, filters, and range limits.
Example:
MyView.Init(OrderView,Relate:Order)!initialize the ViewManager
MyView.Open !open the view
!program code
MyView.Close !close the view
MyView.Kill !shut down the ViewManager
Example:
MyView.Init(OrderView,Relate:Order) !initialize the ViewManager
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
MyView.Open !open the view
!program code
MyView.Close !close the view
MyView.Kill !shut down the ViewManager
Implementation: The Next method uses the ValidateRecord method to validate records that are
not filtered out.
Example:
CASE MyView.Next() !try to get the next record
OF Level:Benign !& check for success
!process the record
OF Level:Notify !& check for failure
!write error log
OF Level:Fatal !& check for fatality
POST(Event:CloseWindow)
BREAK
END
Open, VIRTUAL
The Open method opens the managed VIEW.
Implementation: The Open method opens the view and applies the active sort order and filter with
the ApplyOrder and ApplyFilter methods. The Open method applies the buffering
specified by the PagesAhead, PagesBehind, PageSize, and TimeOut properties.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
MyView.Open !open the view
!program code
MyView.Close !close the view
Previous, VIRTUAL
The Previous method gets the previous VIEW element, subject to the applied sort order, range
limit, and filter, and returns a value indicating its success or failure.
The Previous method uses the ValidateRecord method to validate records that
are not filtered out.
Example:
CASE MyView.Previous() !try to get the previous record
OF Level:Benign !& check for success
!process the record
OF Level:Notify !& check for failure
!write error log
OF Level:Fatal !& check for fatality
POST(Event:CloseWindow)
BREAK
END
PrimeRecord Prepares the VIEW's primary file record buffer to add a new record.
suppress clear An integer constant, variable, EQUATE, or expression that indicates whether or
not to clear the record buffer. A value of zero (0 or False) clears the buffer; a
valueof one (1 or True) does not clear the buffer. If omitted, suppress clear
defaults to zero (0).
The PrimeRecord method prepares the VIEW's primary file record buffer with initial values to
add a new record.
Example:
CASE FIELD()
OF ?InsertButton !on insert button
CASE EVENT()
OF EVENT:Accepted !if insert clicked
MyView.PrimeRecord !prime the record for adding
!insert the new record
END
END
For example, consider a VIEW sorted by Customer where Customer's value is ten(10). If number
is omitted, Reset positions to the element with the lowest Customer value, regardless of
Customer's value. However, if number is one (1), Reset positions to the first element with a
Customer value of ten (10).
Implementation: The Reset method calls the Open method and SETs the managed VIEW. See
the Language Reference--SET for more information.
Example:
View:Customer.Init(Customer:View,Relate:CUSTOMER) !initialize View:Customer object
View:Customer.AddSortOrder( CUS:BYNUMBER ) !add sort BYNUMBER
View:Customer.AddRange(CUS:CUSTNO,Low,High) !add a range limit
View:Customer.SetFilter( 'CUS:ZIP=33064','1') !add filter #1
Relate:CUSTOMER.Open !open customer & related files
View:Customer.Reset !open view, apply range & filter
IF View:Customer.Next() !get first view record
HALT !if no records, stop
END
RestoreBuffers( ), VIRTUAL
The RestoreBuffers method restores the current file buffer’s contents specified by the view from
an internal queue as defined by the SavedBuffers property.
SaveBuffers( ), VIRTUAL
The SaveBuffers method saves the current file buffer’s contents specified by the view to an
internal queue defined by the SavedBuffers property.
The id parameter lets you specify multiple filter expressions or replace a specific expression by its
id. If you set several expressions, each with a unique id, then all those expressions must evaluate
to true to include an item in the result set.
The ApplyFilter and ApplyRange methods apply the active sort order's filter. The SetSort method
sets the active sort order.
Implementation: The ViewManager uses the id to indicate the priority of the expression. The
priority is implemented by sorting the list of filter expressions by the id. The id is
truncated after 30 characters. If omitted, id defaults to '5 Standard' which
specifies a medium priority filter that is replaced by any subsequent calls to
SetFilter with id omitted (or '5 Standard') and with the same active sort order.
Each call to SetFilter with a unique id parameter adds to the filter expression for
the active sort order. Multiple expressions added in this fashion are joined with
the boolean AND operator.
The SetFilter method adds the filter id and expression to the Order property.
1272 ABC Library Reference
Example:
MyView.AddSortOrder(ORD:ByOrder) !order no. sort (1)
MyView.SetFilter('(ORD:OrdNo=CUST:OrdNo)','1OrderNo')!filter on OrderNo
MyView.SetFilter('(ORD:Date='&TODAY()&')','1Date') !AND on date. Date test applied
!first because it sorts first
MyView.AddSortOrder(ORD:ByName) !customer name sort (2)
MyView.SetFilter('CUST:Name[1]=''A''') !filter on cust name
!program code
MyView.SetSort(2) !sort by customer name
MyView.SetFilter('CUST:Name[1]=''J''') !new filter on cust name
!replaces prior name filter
Implementation: The ViewManager implements sort orders with the VIEW's ORDER attribute. The
SetOrder method replaces the active sort order's expression list with the
expression list.
Example:
MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
!program code
MyView.SetOrder(CUST:CustName) !sort by customer name
Implementation: SetSort returns one (1) if the sortnumber changed; otherwise it returns zero (0).
Example:
CustSort = MyView.AddSortOrder(ORD:ByCustomer) !sort by customer no
MyView.AddRange(ORD:CustNo,Relate:Orders,Relate:Customer) !range limit by parent file
OrderSort = MyView.AddSortOrder(ORD:ByOrder) !sort by order no
MyView.AddRange(ORD:OrderNo) !range limit by current
!value of ORD:OrderNo
!program code
IF MyView.SetSort(CustSort) !set active sort order
MESSAGE('New Sort Order') !acknowledge new order
END
UseView, PROTECTED
The UseView method notifies ABC Library objects that the files in the managed view whose
opening was delayed by the LazyOpen property are about to be used.
Implementation: The Init and Open methods call the UseView method. The UseView method calls
FileManager.UseFile for each file in the managed view.
Example:
ViewManager.Open PROCEDURE
CODE
IF ~SELF.Opened
ASSERT(RECORDS(SELF.Order))
SELF.UseView() !really open files
OPEN(SELF.View)
IF ERRORCODE()
SELF.Primary.Me.Throw(Msg:ViewOpenFailed)
END
BUFFER(SELF.View,SELF.PageSize,SELF.PagesBehind,SELF.PagesAhead,SELF.TimeOut)
SELF.Opened = 1
SELF.ApplyOrder
SELF.ApplyFilter
END
ValidateRecord, VIRTUAL
The ValidateRecord method validates the current VIEW element and returns a value indicating
whether or not the data is valid. A return value of zero (0) indicates the item is valid; any other
value indicates the item is invalid.
Example:
ViewManager.Next PROCEDURE
CODE
LOOP
NEXT(SELF.View)
IF ERRORCODE()
IF ERRORCODE() = BadRecErr
RETURN Level:Notify
ELSE
SELF.Primary.Me.Throw(Msg:AbortReading)
RETURN Level:Fatal
END
ELSE
CASE SELF.ValidateRecord()
OF Record:OK
RETURN Level:Benign
OF Record:OutOfRange
RETURN Level:Notify
END
END
END
WindowComponent Interface
WindowComponent Overview
The WindowComponent interface is used with the WindowManager to provide an program
efficient way of the window’s components to communicate easily with the WindowManager.
Methods common to all components are included with the interface, including event handling
(TakeEvent), initialization and refreshing the components and window itself (Reset, Update),
and general housekeeping (Buffer Save and Restore, Kill).
WindowComponent Concepts
The WindowComponent interface defines a set of common methods an object must implement in
order for the object to plug into the window.
Although all of the classes that implement the WindowComponent interface must implement all of
the methods, that does not mean that all need to do something.
WindowComponent Methods
WindowComponent Methods
The WindowComponent interface defines the following methods.
Kill
The Kill method releases any memory allocated during the life of the object
and performs any other required termination code.
BrowseClass Implementation:
The Kill method calls the BrowseClass.Kill method to terminate the
BrowseClass object.
FileDropClass Implementation:
The Kill method calls the FileDropClass.Kill method to terminate the
FileDropClass object.
Implementation:
The PrimaryBufferRestored method is called after the
SELF.Primary.Me.RestoreBuffer() method to notify the Window Component
that the restore is completed.
Implementation:
The PrimaryBufferRestoreRequired method calls the
SELF.Primary.Me.RestoreBuffer method to restore the primary buffer in the
WindowManager’s ResetBuffers method.
PrimaryBufferRestored
1280 ABC Library Reference
Implementation:
The PrimaryBufferSaved method is called after the
SELF.Primary.Me.SaveBuffer() method to notify the Window Component that
the save is completed.
Implementation:
The PrimaryBufferSaveRequired method calls the
SELF.Primary.Me.SaveBuffer() method to save the primary buffer in the
WindowManager’s ResetBuffers method.
Reset(forcereset)
BrowseClass Implementation:
The Reset method calls the BrowseClass.ResetSort method to reapply the
active sort order to the BrowseClass object. For more information see the
BrowseClass.ResetSort section.
FileDropClass Implementation:
The Reset method calls the FileDropClass.ResetQueue method to fill or refill
the File Drop control template's display queue.
ResetRequired
The ResetRequired method determines whether the objects data needs to
be refreshed. A TRUE return value indicates a refresh occurred and a
screen redraw is necessary.
BrowseClass Implementation:
The ResetRequired method calls the BrowseClass.ApplyRange method to
apply the reset fields and range limits and refresh the Browse Box control list
if necessary. A TRUE return value indicates a screen redraw is needed.
FileDropClass Implementation:
The ResetRequired method calls the FileDropClass's ApplyRange method
inherited from the ViewManager. This method applies the range limits and
filters. A TRUE return value indicates a screen redraw is needed.
SetAlerts
The SetAlerts method alerts standard keystrokes for the control associated
with the window componet's object.
BrowseClass Implementation:
The SetAlerts method alerts standard keystrokes for the Browse Box control
and for any associated locator controls.
FileDropClass Implementation:
The SetAlerts method is not implemented for the FileDropClass window
component.
TakeEvent
The TakeEvent method processes the current ACCEPT loop event.
BrowseClass Implementation:
The TakeEvent method calls the BrowseClass.TakeEvent method to process
the current ACCEPT loop event for the BrowseClass object. The method
returns a Level:Benign value. For more information see the
BrowseClass.TakeEvent section.
FileDropClass Implementation:
The TakeEvent method processes the current ACCEPT loop event for the
FileDropClass object. The method returns a Level:Benign value. For more
information see the FileDropClass.TakeEvent section.
Update
The Update method regets the selected item from the VIEW in order to
update the record on disk.
BrowseClass Implementation:
The Update method calls the BrowseClass.UpdateViewRecord method to
reread the selected record from the VIEW. For more information see the
BrowseClass.UpdateViewRecord.
FileDropClass Implementation:
The Update method is not implemented for the FileDropClass window
component.
UpdateWindow
The UpdateWindow method updates the controls on the window based
upon certain conditions set by the WindowComponent object.
BrowseClass Implementation:
The UpdateWindow method calls the BrowseClass.UpdateWindow method
to refresh the window controls based upon determined conditions from the
BrowseBox. For more information see the BrowseClass.UpdateViewRecord.
FileDropClass Implementation:
The UpdateWindow method is not implemented for the FileDropClass
window component.
WindowResizeClass
WindowResizeClass Overview
The WindowResizeClass lets the end user resize windows that have traditionally been fixed in
size due to the controls they contain (List boxes, entry controls, buttons, nested controls, etc.).
The WindowResizeClass intelligently repositions the controls, resizes the controls, or both, when
the end user resizes the window.
WindowResizeClass Concepts
The intelligent repositioning is accomplished by recognizing there are many different types of
controls that each have unique repositioning and resizing requirements. The WindowResizeClass
also recognizes that controls are often nested, and considers whether a given control's
coordinates are more closely related to the window's coordinates or to another control's
coordinates. That is, intelligent repositioning correctly identifies each control's parent. See
SetParentControl for more information on the parent concept.
The intelligent repositioning includes several overall strategies that apply to all window controls,
as well as custom per-control strategies for resizing and repositioning individual controls. The
overall strategies include:
Surface Makes the most of the available pixels by positioning other controls to
maximize the size of LIST, SHEET, PANEL, and IMAGE controls. We
recommend this strategy for template generated windows.
Spread Maintains the design-time look and feel of the window by applying a
strategy specific to each control type. For example, BUTTON sizes are
not changed but their positions are tied to the nearest window edge. In
contrast, LIST sizes and positions are scaled in proportion to the window.
See SetStrategy for more information on resizing strategies for individual controls.
Note: To allow window resizing you must set the WINDOW's frame type to Resizable. We
also recommend adding the MAX attribute. See The Window Formatter--The
Window Properties Dialog in the User's Guide for more information on these
settings.
1286 ABC Library Reference
The WindowResizeClass is independent of the other Application Builder Classes. It does not rely
on other ABC classes, nor do other ABC classes rely on it.
The ABC Templates instantiate a WindowResizeClass object for each WindowResize template in
the application, typically one for each procedure that manages a window. The templates may also
derive a class from the WindowResizeClass. The derived class (and its object) is called Resizer.
The ABC Templates provide the derived class so you can use the WindowResize template
Classes tab to easily modify the Resizer's behavior on an instance-by-instance basis.
The object instantiated from the derived class is called Resizer. This object supports all the
functionality specified in the WindowResize template. See Other Templates--Window Resize for
more information on the template implementation of this class.
The WindowResizeClass source code is installed by default to the Clarion \LIBSRC folder. The
WindowResizeClass source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a WindowResizeClass object. This example illustrates the Surface strategy
plus some custom strategies for specific controls. The program does nothing except present a
window with a typical variety of controls.
PROGRAM
INCLUDE('ABRESIZE.INC') !declare WindowResizeClass
MAP
END
Resizer WindowResizeClass !declare Resizer object
WindowResizeClass Properties
The WindowResizeClass contains the following properties.
AutoTransparent BYTE
The AutoTransparent property indicates whether controls that support it are made transparent
(TRN attribute) during the resize process. Transparent controls result in less flicker and shadow
and smoother resizing, and avoids a Windows bug on some windows.
A value of one (1) makes controls transparent; a value of zero (0) does not.
DeferMoves BYTE
The DeferMoves property indicates whether to defer control movement until the end of the
ACCEPT loop (see PROP:DeferMove in the Language Reference). This lets the runtime library
perform all control movement at once, resulting in a cleaner, "snappier" resize, and avoids a
Windows bug on some windows.
A value of one (1) defers control movement; a value of zero (0) does not.
1290 ABC Library Reference
WindowResizeClass Methods
The WindowResizeClass contains the 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:
Mainstream Use:
ResizeV resize and reposition all controls
Occasional Use:
SetParentControl set control's parent
SetStrategy set control's resize strategy
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.
The SetParentDefaults method intelligently sets the appropriate parent for all the window
controls, and the SetParentControl method sets the parent for a single control. The Resize
method rescales the control based on the coordinates of the parent.
Example:
window WINDOW('Nested Controls'),AT(,,165,97),IMM,GRAY,MAX,RESIZE
GROUP('OuterGroup'),AT(5,3,154,92),USE(?OuterGroup),BOXED
BUTTON('Button 1'),AT(14,23),USE(?Button1)
ENTRY(@s20),AT(60,24),USE(Entry1)
GROUP('InnerGroup'),AT(11,49,141,38),USE(?InnerGroup),BOXED
CHECK('Check 1'),AT(32,64),USE(Check1)
CHECK('Check 2'),AT(91,64),USE(Check2)
. . .
CODE
OPEN(window)
Resizer.Init(AppStrategy:Spread) !initialize Resizer object
Resizer.SetParentDefaults !set parents for all controls
Resizer.SetParentControl(?Button1,?OuterGroup) !override parent for a control
Resizer.SetParentControl(?Check1,?InnerGroup) !override parent for a control
Resizer.SetParentControl(?Check2,?InnerGroup) !override parent for a control
GetPositionStrategy
Returns the repositioning strategy for a control type.
control type An integer constant, variable, EQUATE, or expression indicating the type of
control (BUTTON, ENTRY, LIST, etc.).
strategy An integer constant, variable, EQUATE, or expression indicating the overall
strategy for resizing and repositioning all the controls on the window. If omitted,
strategy defaults to the strategy specified by the Init method.
The GetPositionStrategy method returns the appropriate repositioning strategy for a particular
control type based on the overall strategy.
Implementation: The Reset method calls the GetPositionStrategy method to set the position
strategy for dynamically created controls.
EQUATEs for the control type parameter are declared in EQUATES.CLW. Each
control type EQUATE is prefixed with CREATE:.
EQUATEs for the return value are declared in ABRESIZE.INC. Each strategy
EQUATE is prefixed with Resize:.
Example:
GET(SELF.ControlQueue,SELF.ControlQueue.ID) !get control resize info
IF ERRORCODE() !if no control info, add it
SELF.ControlQueue.Type=FieldCounter{PROP:Type} ! set control type
SELF.ControlQueue.ParentID=0 ! set parent
SELF.ControlQueue.HasChildren=False ! set children
SELF.ControlQueue.ID=FieldCounter ! set ID
GetSizeInfo(FieldCounter,SELF.ControlQueue.Pos)! set coordinates
! set resize strategies
SELF.ControlQueue.PositionalStrategy=SELF.GetPositionStrategy(SELF.ControlQueue.Type)
SELF.ControlQueue.ResizeStrategy=SELF.GetResizeStrategy(SELF.ControlQueue.Type)
ADD(SELF.ControlQueue,SELF.ControlQueue.ID) ! add control info
ASSERT(~ERRORCODE())
END
GetResizeStrategy
Returns the resizing strategy for a control type.
control type An integer constant, variable, EQUATE, or expression indicating the type of
control (BUTTON, ENTRY, LIST, etc.).
strategy An integer constant, variable, EQUATE, or expression indicating the overall
strategy for resizing and repositioning all the controls on the window. If omitted,
strategy defaults to the strategy specified by the Init method.
The GetResizeStrategy method returns the appropriate resizing strategy for a particular control
type based on the overall strategy.
Implementation: The Reset method calls the GetResizeStrategy method to set the resizing
strategy for dynamically created controls.
EQUATEs for the control type parameter are declared in EQUATES.CLW. Each
control type EQUATE is prefixed with CREATE:.
EQUATEs for the return value are declared in ABRESIZE.INC. Each strategy
EQUATE is prefixed with Resize:.
Example:
GET(SELF.ControlQueue,SELF.ControlQueue.ID) !get control resize info
IF ERRORCODE() !if no control info, add it
SELF.ControlQueue.Type=FieldCounter{PROP:Type}! set control type
SELF.ControlQueue.ParentID=0 ! set parent
SELF.ControlQueue.HasChildren=False ! set children
SELF.ControlQueue.ID=FieldCounter ! set ID
GetSizeInfo(FieldCounter,SELF.ControlQueue.Pos)! set coordinates
! set resize strategies
SELF.ControlQueue.PositionalStrategy=SELF.GetPositionStrategy(SELF.ControlQueue.Type)
SELF.ControlQueue.ResizeStrategy=SELF.GetResizeStrategy(SELF.ControlQueue.Type)
ADD(SELF.ControlQueue,SELF.ControlQueue.ID) ! add control info
ASSERT(~ERRORCODE())
END
Implementation: The Init method adds the IMM attribute to the WINDOW.
If the strategy parameter is present, Init applies a strategy to each control based
on the parameter value. If the strategy parameter is absent, Init applies the
default strategy to each control. The default strategy is to rescale all control
coordinates (x, y, width, and height) proportionally with the parent.
The parent may be the WINDOW containing the control, or it may be another
control on the WINDOW. The SetParentControl and SetParentDefaults methods
determine the parent for a given control.
COMBO+DROP
Width, horizontal and vertical position are scaled
with the parent, but height is unchanged.
Tip: Even though LIST and COMBO controls may be resized, the column widths within
them are not resized. However, the right-most column does expand or contract
depending on the available space.
1296 ABC Library Reference
Example:
OPEN(window)
Resizer.Init(AppStrategy:Surface)!initialize Resizer object
ACCEPT
CASE EVENT()
OF EVENT:CloseWindow !on close window,
Resizer.Kill ! shut down Resizer object
OF EVENT:Sized !on sized window,
Resizer.Resize ! resize & reposition controls
END
END
Kill
The Kill method frees any memory allocated during the life of the object and performs any other
required termination code.
Example:
OPEN(window)
Resizer.Init(AppStrategy:Surface) !initialize Resizer object
ACCEPT
CASE EVENT()
OF EVENT:CloseWindow !on close window,
Resizer.Kill ! shut down Resizer object
OF EVENT:Sized !on sized window,
Resizer.Resize ! resize & reposition controls
END
END
1298 ABC Library Reference
Reset, VIRTUAL
The Reset method resets the WindowResizeClass object to conform to the window in its present
state.
Implementation: The Init method calls the Reset method. The Reset method stores the initial
coordinates for the window and its controls. The WindowResizeClass object uses
the stored coordinates to restore the window, establish parent-child relationships
between controls, etc.
Example:
ThisWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
!procedure code
Resizer.Init(AppStrategy:Surface,Resize:SetMinSize)
SELF.AddItem(Resizer)
Resizer.AutoTransparent=True
Resizer.SetParentDefaults
INIMgr.Fetch('BrowseMembers',QuickWindow)
Resizer.Resize !Resize needed if window altered by INIMgr
Resizer.Reset !Reset needed if window altered by INIMgr
SELF.SetAlerts()
RETURN ReturnValue
Resize returns Level:Benign to indicate processing of the event (typically EVENT:Sized) should
continue normally; it returns Level:Notify to indicate processing is completed for the event and the
ACCEPT loop should CYCLE; it returns Level:Fatal to indicate the event could not be processed
and the ACCEPT loop should BREAK.
The Init method and the SetStrategy method determine the strategies to apply to each control. All
resizing strategies consider the new coordinates of the each control's "parent." By default, the
WINDOW is the parent of each control. However, you may designate any control as the parent of
any other control with the SetParentControl method.
Example:
OPEN(window)
Resizer.Init(AppStrategy:Surface) !init Resizer-general strategy
Resizer.SetStrategy(?CloseButton, | !set control specific strategy:
Resize:FixRight+Resize:FixBottom,Resize:LockSize) ! at bottom right & fixed
size
ACCEPT
CASE EVENT()
OF EVENT:CloseWindow !on close window,
Resizer.Kill ! shut down Resizer object
OF EVENT:Sized !on sized window,
Resizer.Resize ! resize & reposition controls
END
END
RestoreWindow, VIRTUAL
The RestoreWindow method restores the window and all its controls to their sizes in effect when
the Init method executed.
Example:
OPEN(window)
Resizer.Init(AppStrategy:Surface) !init Resizer overall strategy
ACCEPT
CASE EVENT()
OF EVENT:CloseWindow
Resizer.Kill ! shut down Resizer object
OF EVENT:Sized
Resizer.Resize ! resize & reposition controls
END
CASE ACCEPTED()
OF ?RestoreButton
Resizer.RestoreWindow !restore window to original spec
END
END
This lets you rescale a particular control based upon a related control's coordinates rather than
on the window's coordinates. This is appropriate when the strategy applied to the parent control
causes it to be scaled disproportionately from the window. For example, controls within a GROUP
structure whose size is "locked" may be rescaled to fit the GROUP's coordinates rather than the
window's coordinates.
The SetParentDefaults method intelligently sets the appropriate parent for each window control
so you only need to use SetParentControl if SetParentDefaults sets an inappropriate parent. The
GetParentControl method returns the parent control number for a control.
Example:
window WINDOW('Nested Controls'),AT(,,165,97),IMM,GRAY,MAX,RESIZE
GROUP('OuterGroup'),AT(5,3,154,92),USE(?OuterGroup),BOXED
BUTTON('Button 1'),AT(14,23),USE(?Button1)
ENTRY(@s20),AT(60,24),USE(Entry1)
GROUP('InnerGroup'),AT(11,49,141,38),USE(?InnerGroup),BOXED
CHECK('Check 1'),AT(32,64),USE(Check1)
CHECK('Check 2'),AT(91,64),USE(Check2)
END
END
END
CODE
OPEN(window)
Resizer.Init(AppStrategy:Spread) !initialize Resizer object
Resizer.SetParentDefaults !set parents for all controls
Resizer.SetParentControl(?Button1,?OuterGroup) !override parent for a control
Resizer.SetParentControl(?Check1,?InnerGroup) !override parent for a control
Resizer.SetParentControl(?Check2,?InnerGroup) !override parent for a control
SetParentDefaults, VIRTUAL
The SetParentDefaults method intelligently sets the appropriate parent for each window control.
The Resize method rescales each control based on the coordinates of its parent.
This lets you rescale a particular control based upon a related control's coordinates rather than
on the window's coordinates. This is appropriate when the strategy applied to the parent control
causes it to be scaled disproportionately from the window. For example, controls within a GROUP
structure whose size is "locked" may be rescaled to fit the GROUP's coordinates rather than the
window's coordinates.
You may use the SetParentControl method to set the parent for a single control.
The Init method calls the SetParentDefaults method when the resize strategy is
AppStrategy:Surface.
Example:
window WINDOW('Nested Controls'),AT(,,165,97),IMM,GRAY,MAX,RESIZE
GROUP('OuterGroup'),AT(5,3,154,92),USE(?OuterGroup),BOXED
BUTTON('Button 1'),AT(14,23),USE(?Button1)
ENTRY(@s20),AT(60,24),USE(Entry1)
GROUP('InnerGroup'),AT(11,49,141,38),USE(?InnerGroup),BOXED
CHECK('Check 1'),AT(32,64),USE(Check1)
CHECK('Check 2'),AT(91,64),USE(Check2)
END
END
END
CODE
OPEN(window)
Resizer.Init(AppStrategy:Spread) !initialize Resizer object
Resizer.SetParentDefaults !set parents for all controls
Resizer.SetParentControl(?Button1,?OuterGroup) !override parent for a control
Resizer.SetParentControl(?Check1,?InnerGroup) !override parent for a control
Resizer.SetParentControl(?Check2,?InnerGroup) !override parent for a control
SetStrategy Sets the position strategy and the size strategy to apply to a control.
control An integer constant, variable, EQUATE, or expression containing a control
number. If omitted, the SetStrategy method applies position strategy and size
strategy to all controls on the WINDOW.
position strategy
An integer constant, variable, EQUATE, or expression indicating the position
strategy to apply to the control.
size strategy An integer constant, variable, EQUATE, or expression indicating the size strategy
to apply to the control.
source control An integer constant, variable, EQUATE, or expression identifying the control
whose position strategy and size strategy are applied to the target control.
target control An integer constant, variable, EQUATE, or expression identifying the control
whose position strategy and size strategy are copied from the source control.
The SetStrategy method sets the position strategy and the size strategy to apply to a window
control or controls. The Resize method applies the specified strategies.
Implementation: EQUATEs for the position strategy and the size strategy parameters are declared
in ABRESIZE.INC as follows. To apply two or more strategies, simply add them
together.
!Resize strategies
Resize:Resize EQUATE(0000b) !rescale height & width
Resize:LockWidth EQUATE(0001b) !locks width
Resize:LockHeight EQUATE(0010b) !locks height
Resize:LockSize EQUATE(0011b) !locks height & width
Resize:ConstantRight EQUATE(0100b) !locks right edge, moves left
Resize:ConstantBottom EQUATE(1000b) !locks bottom edge, moves top
Example:
window WINDOW('Client Information'),AT(,,185,100),IMM,GRAY,MAX,RESIZE
SHEET,AT(3,3,180,78),USE(?Sheet1)
TAB('Client List'),USE(?ListTab)
LIST,AT(10,20,165,55),USE(?List1),FROM(ClientQ),|
FORMAT('87L~Name~@s20@8L~State Code~@s2@')
END
TAB('Client Logo'),USE(?LogoTab)
IMAGE,AT(10,20,165,55),USE(?CLI:Logo)
END
END
PROMPT('Locate:'),AT(7,87),USE(?LocatorPrompt)
ENTRY(@s20),AT(33,86,61,12),USE(CLI:Name)
BUTTON('Close'),AT(150,84),USE(?Close)
END
CODE
OPEN(window)
Resizer.Init(AppStrategy:Surface) !init Resizer overall strategy
Resizer.SetStrategy(?LocatorPrompt, | !set control specific strategy:
Resize:FixLeft+Resize:FixBottom,Resize:LockSize) ! at bottom left & fixed size
Resizer.SetStrategy(?CLI:Name, | !set control specific strategy:
Resize:FixLeft+Resize:FixBottom,Resize:LockHeight)! at bottom left & fixed height
WindowManager
WindowManager Overview
The WindowManager class declares a Window Manager that provides highly structured,
consistent, flexible, and convenient processing for Clarion window procedures. The
WindowManager class is actually a window procedure manager. This includes almost every
template generated procedure, including Process and Report procedures.
WindowManager Concepts
The WindowManager object initializes the procedure, runs the procedure by handling all ACCEPT
loop events for the WINDOW, then shuts down the procedure. The WindowManager handles
events primarily by forwarding the events to other ABC Library objects for processing.
The WindowManager is a fairly generic base class and therefore handles events and processes
that are common across most Windows applications. For an example of a process-specific
WindowManager implementation, see Print Preview Class and Report Manager Class.
In addition to its function as a general purpose window procedure manager, the WindowManager
may be configured to implement a variety of options for update procedures--window procedures
that support record inserts, changes, and deletes. The WindowManager carries out the specified
options for these update procedures (forms).
The WindowManager is closely integrated with several other ABC Library objects; in particular,
the BrowseClass, ToolbarClass, FileDropClass, and FileDropComboClass objects. These objects
register their presence with each other, set each other's properties, and call each other's methods
to accomplish their goals.
These integrated objects could override the WindowManager's methods (such as TakeAccepted)
to perform their jobs; however, because the WindowManager is programmed to understand these
ABC objects, once they are registered (AddItem), the WindowManager drives them directly
according to their documented interfaces.
1306 ABC Library Reference
The WindowManager provides separate virtual methods to group the handling of all ACCEPT
loop events into logical, convenient containers (virtual methods), so that, should you need to
implement custom (non-default) event handling, you can implement your changes within the
relatively small scope of the specific virtual method that implements the default event handling
you wish to change. This logical grouping of window event handling is as follows:
The ABC Templates generate virtual methods as needed to provide procedure specific
initialization, event handling, and shut down.
The WindowManager is closely integrated with several other ABC Library objects--in particular,
the BrowseClass, FileDropClass, FileDropComboClass, and ToolbarClass objects. These objects
register their presence with the WindowManager, set each other's properties, and call each
other's methods as needed to accomplish their respective goals.
The BrowseClass uses the WindowManager to refresh the window as needed. Therefore, if your
program instantiates the BrowseClass, it must also instantiate the WindowManager. Much of this
is automatic when you INCLUDE the BrowseClass header (ABBROWSE.INC) in your program's
data section. See the Conceptual Example and see Browse Class for more information.
The WindowManager serves as the foundation of the PrintPreviewClass and the ReportManager.
That is, both the PrintPreviewClass and the ReportManager are derived from the
WindowManager, because both derived classes manage a window procedure.
WindowManager 1307
The PrintPreviewClass implements a full featured print preview window. See Print Preview Class
for more information.
The ReportManager implements a progress window that monitors and displays the status of a
report. See Report Manager Class for more information.
The WindowManager source code is installed by default to the Clarion \LIBSRC folder. The
WindowManager source code and its respective components are contained in:
The following example shows a typical sequence of statements to declare, instantiate, initialize,
use, and terminate a WindowManager and related objects. This example performs repetitive
inserts to a Customer file and also adds phone numbers for each customer to a related Phones
file. It uses the WindowManager to call a procedure to validate the customer's state code against
a States file.
Note that the WindowManager is aware of other ABC objects, such as BrowseClass objects,
Toolbar objects, FileDrop objects, etc. This example shows the interaction between the
WindowManager object and a FileManager object and a BrowseClass object.
AddCustomer PROGRAM
MAP
SelectState PROCEDURE !procedure to validate State
END
Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD
BYNUMBER KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
CUSTNO LONG
Name STRING(30)
State STRING(2)
END
END
Phones FILE,DRIVER('TOPSPEED'),PRE(PH),CREATE,THREAD
IDKEY KEY(PH:ID),DUP,NOCASE
Record RECORD,PRE()
ID LONG
NUMBER STRING(20)
END
END
State FILE,DRIVER('TOPSPEED'),PRE(ST),CREATE,THREAD
StateCodeKey KEY(ST:STATECODE),NOCASE,OPT
Record RECORD,PRE()
WindowManager 1309
STATECODE STRING(2)
STATENAME STRING(20)
END
END
Access:State CLASS(FileManager) !declare Access:State object
Init PROCEDURE
END
Relate:State CLASS(RelationManager) !declare Relate:State object
Init PROCEDURE
END
Access:Customer CLASS(FileManager) !declare Access:Customer object
Init PROCEDURE
END
Relate:Customer CLASS(RelationManager) !declare Relate:Customer object
Init PROCEDURE
END
Access:Phones CLASS(FileManager) !declare Access:Phones object
Init PROCEDURE
END
Relate:Phones CLASS(RelationManager) !declare Relate:Phones object
Init PROCEDURE
END
BUTTON('&Change'),AT(53,87),USE(?Change)
BUTTON('&Delete'),AT(103,87),USE(?Delete)
END
END
BUTTON('OK'),AT(68,110),USE(?OK),DEFAULT
BUTTON('Cancel'),AT(105,110),USE(?Cancel)
END
CODE
ThisWindow.Run() !run the program / procedure
!(Init, Ask, Kill)
ThisWindow.Init PROCEDURE() !setup and "program" ThisWindow
ReturnValue BYTE,AUTO
CODE
GlobalErrors.Init !initialize GlobalErrors object
Relate:Customer.Init !initialize Relate:Customer object
Relate:State.Init !initialize Relate:State object
Relate:Phones.Init !initialize Relate:Phones object
ReturnValue = PARENT.Init() !call base class WindowManager.Init
Relate:Customer.Open !open Customer & related files
Relate:State.Open !open State & related files
!Program ThisWindow object:
SELF.Request = InsertRecord ! insert records only
SELF.FirstField = ?CUSTNO:Prompt! CustNo is firstfield for ThisWindow
SELF.VCRRequest &= VCRRequest ! set VCRRequest for ThisWindow
SELF.Errors &= GlobalErrors ! set error handler for ThisWindow
SELF.HistoryKey = 734 ! set ditto key (CTRL')
SELF.AddHistoryFile(CUS:Record,CUS:Save) ! set ditto file
SELF.AddHistoryField(?CUS:CUSTNO,1) ! set ditto (restorable) field
SELF.AddHistoryField(?CUS:NAME,2) ! set ditto (restorable) field
SELF.AddHistoryField(?CUS:State,3) ! set ditto (restorable) field
SELF.AddUpdateFile(Access:Customer) ! register FileManager with ThisWindow
SELF.Primary &= Relate:Customer ! register RelationMgr with ThisWindow
SELF.AddItem(?Cancel,RequestCancelled) ! set action for Cancel button
SELF.InsertAction = Insert:Batch ! set insert action (repetitive)
SELF.OkControl = ?OK ! set OK button
WindowManager 1311
WindowManager Properties
The WindowManager contains the following properties.
AutoRefresh BYTE
The AutoRefresh property determines whether the WindowManager automatically resets the
window and its associated objects whenever it detects a change. The WindowManager checks
for changes after it processes each event. A value of one (1 or True) automatically resets the
window; a value of zero (0 or False) does not automatically reset the window.
AutoRefresh is particularly useful when resetting a BrowseClass object changes a field which is a
range-limit of another BrowseClass object.
Implementation: The Init method sets the AutoRefresh property to one. The TakeEvent method
implements the action specified by AutoRefresh by calling the Reset method only
if any registered BrowseClass objects have changed.
AutoToolbar BYTE
The AutoToolbar property determines how the WindowManager sets the ToolbarTarget. A value
of one (1 or True) uses the ToolbarClass object to set the appropriate ToolbarTarget whenever a
new TAB is selected; a value of zero (0 or False) uses the current ToolbarTarget.
Implementation: The Init method sets the AutoToolbar property to True. The TakeNewSelection
method implements the action specified by AutoToolbar by calling
ToolbarClass.SetTarget if the control selected is a SHEET.
CancelAction BYTE
The CancelAction property indicates the WindowManager action to take when the end user
"Cancels" the window with changes pending. Valid actions are:
Implementation: The Init method sets the CancelAction property to Cancel:Save + Cancel:Query.
The TakeCloseEvent method carries out the action specified by the CancelAction
property.
ChangeAction BYTE
The ChangeAction property whether change is a valid action for an update procedure. A value of
one (1 or True) indicates the procedure may change (write) records; a value of zero (0 or False)
indicates the procedure may not change records.
Implementation: The Init method sets the ChangeAction property to one (1).
DeleteAction BYTE
The DeleteAction property indicates the WindowManager action to take when the end user
requests to delete a record. Valid actions are:
Implementation: The Init method sets the DeleteAction property to Delete:Warn. The PrimeUpdate
method carries out the action specified by the DeleteAction property.
Errors &ErrorClass
The Errors property is a reference to the ErrorClass object that handles unexpected conditions
for the WindowManager. In an ABC Template generated program, the ErrorClass object is called
GlobalErrors.
Implementation: The WindowManagerClass does not initialize the Errors property. Your derived
Init method should initialize the Errors property. See the Conceptual Example.
Implementation: The FilesOpened property is set to TRUE in the Init method if there are files to be
opened by the procedure. This property is examined in the Kill method to
determine whether files need to be closed by the procedure.
FirstField SIGNED
The FirstField property contains the control number (field equate) of the window control that
initially receives focus when the window displays.
Implementation: The WindowManagerClass does not initialize the FirstField property. Your
derived Init method should initialize the FirstField property. See the Conceptual
Example.
1318 ABC Library Reference
ForcedReset BYTE
The ForcedReset property indicates whether the WindowManager should unconditionally reset
itself. A value of zero (0 or False) allows a conditional reset (reset only if circumstances demand,
for example, when the end user invokes a new BrowseBox sort order or invokes a BrowseBox
locator); a value of one (1 or True) forces an unconditional reset.
Implementation: The Reset method carries out the action specified by the ForcedReset property.
HistoryKey SIGNED
The HistoryKey property enables "save/restore field history" and sets the keystroke which
restores a form field's prior saved value. When the end user presses the specified key, the
WindowManager retores the field with focus from the previously processed record.
Implementation: The WindowManagerClass does not initialize the HistoryKey property. Your
derived Init method should initialize the HistoryKey property if your window uses
a history key. See the Conceptual Example.
The AddHistoryFile method names the file and record buffers from which fields
are saved and restored. AddHistoryField associates specific fields from the
history file with their corresponding WINDOW controls. The SaveHistory method
saves a copy of the history fields. The RestoreField method restores the contents
of a specific control.
InsertAction BYTE
The InsertAction property indicates the WindowManager action to take when the end user
"Inserts" a record. Valid actions are:
Implementation: The Init method sets the InsertAction property to Insert:Caller. The
TakeCompleted method carries out the action specified by the InsertAction
property.
The LastInsertedPosition property contains the position of the last record added.
OKControl SIGNED
The OKControl property contains the control number (field equate) of the window control that
indicates end user acceptance of the window--typically the OK button. The WindowManager uses
this property to close the window, or to initiate control and record validation if changes are
pending.
Implementation: The WindowManagerClass does not initialize the OKControl property. Your
derived Init method should initialize the OKControl property. See the Conceptual
Example.
Opened BYTE
The Opened property indicates whether the WindowManager's WINDOW has been opened. A
value of one (1 or True) indicates the WINDOW is open; a value of zero (0 or False) indicates the
WINDOW is not opened. You can use this property to control tasks (such as resizing, or saving
and restoring window coordinates) that require the WINDOW to be opened or closed.
Implementation: The WindowManagerClass does not set the Opened property. Your derived Init
method should set it. See the Conceptual Example.
OriginalRequest BYTE
The OriginalRequest property indicates the database action for which the procedure was
originally called. The WindowManager uses this property to make appropriate processing
decisions with regard to priming records, saving or abandoning changes, etc. Valid requests are:
InsertRecord
ChangeRecord
DeleteRecord
SelectRecord
Implementation: The Init method sets the OriginalRequest property to equal the Request property.
EQUATEs for the OriginalRequest and Request properties are declared in
\LIBSRC\TPLEQU.CLW as follows:
InsertRecord EQUATE (1) !Add a record
ChangeRecord EQUATE (2) !Change the current record
DeleteRecord EQUATE (3) !Delete the current record
SelectRecord EQUATE (4) !Select a record
Primary &RelationManager
The Primary property is a reference to the RelationManager object for the WindowManager's
primary file. The WindowManager uses this property to carry out inserts, changes and deletes.
Implementation: The WindowManagerClass does not initialize the Primary property. Your derived
Init method should initialize the Primary property if the procedure does database
updates. See the Conceptual Example.
1322 ABC Library Reference
Request BYTE
The Request property indicates the database acion the procedure is handling. The
WindowManager uses this property to make appropriate processing decisions with regard to
priming records, saving or abandoning changes, etc. Valid requests are:
InsertRecord
ChangeRecord
DeleteRecord
SelectRecord
Implementation: The WindowManagerClass does not set the Request property. Your derived Init
method should immediately set the Request property. The
WindowManagerClass.Init method sets the OriginalRequest property equal to the
Request property to preserve its initial value. See the Conceptual Example.
ResetOnGainFocus BYTE
The ResetOnGainFocus property indicates whether the WindowManager should unconditionally
reset itself when the window receives focus. A value of zero (0 or False) allows a conditional
reset (reset only if changes demand, for example, when the end user invokes a new BrowseBox
sort order or invokes a BrowseBox locator); a value of one (1 or True) forces an unconditional
reset (reset regardless of circumstances).
Resize &WindowResizeClass
The Resize property is a reference to the WindowResizeClass object that handles window
resizing events.
1324 ABC Library Reference
Response BYTE
The Response property indicates the WindowManager's response to the original database
request (indicated by the OriginalRequest property). The WindowManager uses this property to
make appropriate processing decisions with regard to priming records, saving or abandoning
changes, etc.
The SetResponse method sets the value of the Response property and exits the procedure.
Translator &TranslatorClass
The Translator property is a reference to the TranslatorClass object for the WindowManager.
The WindowManager uses this property to translate window text to the appropriate language.
Implementation: The WindowManagerClass does not initialize the Translator property. The
WindowManager only invokes the Translator if the Translator property is not null.
Your derived Init method should initialize the Translator property if translation is
needed. See the Conceptual Example.
VCRRequest &LONG
The VCRRequest property is a reference to a variable identifying a scroll request made
simultaneously with a database operation request. The WindowManager uses this property to
carry out the scroll request after it complets the database operation.
For example, when the end user changes fields on a form then presses the Insert button, he
simultaneously requests to save the changes and to scroll to the next record. The
WindowManager completes the change request , and only then does it handle the scroll request.
WindowManager Methods
The WindowManager 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:
None
Occasional Use:
RunV run another procedure
SaveHistory save history fields for later restoration
PostCompleted a virtual to prime fields
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 AddHistoryFile method names the file and record buffers from which fields
are saved and restored. The AddHistoryField method associates specific fields
from the history file with their corresponding WINDOW controls. The SaveHistory
method saves a copy of the history fields. The RestoreField method restores the
contents of a specific control.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
SELF.HistoryKey = CtrlR
SELF.AddHistoryFile(CLI:Record,History::CLI:Record)
SELF.AddHistoryField(?CLI:Name,2)
SELF.AddHistoryField(?CLI:StateCode,3)
Implementation: The AddHistoryFile method names the file and record buffers from which fields
are saved and restored. The AddHistoryField method associates specific fields
from the history file with their corresponding WINDOW controls. The SaveHistory
method saves a copy of the history fields. The RestoreField method restores the
contents of a specific control.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
SELF.HistoryKey = CtrlR
SELF.AddHistoryFile(CLI:Record,History::CLI:Record)
SELF.AddHistoryField(?CLI:Name,2)
SELF.AddHistoryField(?CLI:StateCode,3)
AddItem(| class |)
| WindowComponent |
| control, response |
Implementation: The TakeAccepted method assigns the response value to the Response property
when the control is accepted. EQUATEs for the response parameter are
declared in \LIBSRC\TPLEQU.CLW as follows:
RequestCompleted EQUATE (1) !Update Completed
RequestCancelled EQUATE (2) !Update Aborted
Implementation: The WindowManager uses the update file's FileManager to save and restore the
file's buffer.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
SELF.AddUpdateFile(Access:Client)
!procedure code
Implementation: The Run method calls the Ask method only if the Init method returns
Level:Benign. Ask RETURNs immediately if the Dead property is True. The Kill
method sets the Dead property to True, so calling the Kill method before the Ask
method has the effect of shutting down the window procedure before Ask
displays the WINDOW.
The Ask method implements the ACCEPT loop for the window and calls the
TakeEvent method to handle all events. The ACCEPT loop continues until
TakeEvent RETURNs Level:Fatal.
Tip: To shut down the window procedure while the Ask method is running, RETURN
Level:Fatal from any of the "Take" methods.
Tip: To immediately stop processing for an event (including stopping resizing and
alerted keys), RETURN Level:Notify from any of the "Take" methods.
Example:
WindowManager.Run PROCEDURE
CODE
IF ~SELF.Init()
SELF.Ask
END
SELF.Kill
WindowManager.Ask PROCEDURE
CODE
IF SELF.Dead THEN RETURN .
CLEAR(SELF.LastInsertedPosition)
ACCEPT
CASE SELF.TakeEvent()
OF Level:Fatal
BREAK
OF Level:Notify
CYCLE !Not as dopey at it looks, it is for 'short-stopping' certain events
END
END
ChangeRecord, VIRTUAL
The ChangeRecord method performs the necessary database change or update operations
when called. ChangeRecord returns Level:Benign to indicate successful a change operation.
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory()
CASE SELF.Request
OF InsertRecord
RETURN SELF.InsertAction()
OF ChangeRecord
RETURN SELF.ChangeAction()
OF DeleteRecord
RETURN SELF.DeleteAction()
OF SaveRecord
CASE SELF.OriginalRequest
OF InsertRecord
RETURN SELF.SaveOnInsertAction()
OF ChangeRecord
RETURN SELF.SaveOnChangeAction()
END
END
RETURN Level:Benign
See Also:
TakeCompleted
Request
InsertRecord
DeleteRecord
1334 ABC Library Reference
DeleteRecord, VIRTUAL
The DeleteRecord method performs the necessary database delete operations when called.
DeleteRecord returns Level:Benign to indicate successful a delete operation.
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory()
CASE SELF.Request
OF InsertRecord
RETURN SELF.InsertAction()
OF ChangeRecord
RETURN SELF.ChangeAction()
OF DeleteRecord
RETURN SELF.DeleteAction()
OF SaveRecord
CASE SELF.OriginalRequest
OF InsertRecord
RETURN SELF.SaveOnInsertAction()
OF ChangeRecord
RETURN SELF.SaveOnChangeAction()
END
END
RETURN Level:Benign
See Also:
TakeCompleted
Request
ChangeRecord
InsertRecord
WindowManager 1335
The Init method both "programs" the WindowManager object and initializes the overall procedure.
The WindowManager is closely integrated with several other ABC Library objects. You can use
the Init method to register these other objects with the WindowManager by calling the AddItem
method. The objects can then set each other's properties and call each other's methods as
needed to accomplish their respective goals.
Implementation: Typically, the Init method is paired with the Kill method, performing the converse
of the Kill method tasks.
Tip: To prevent the Ask method from starting, RETURN Level:Notify from the Init
method.
Example:
MyWindowManager.Run PROCEDURE
CODE
IF SELF.Init() = Level:Benign
SELF.Ask
END
SELF.Kill
ThisWindow.Init PROCEDURE()
CODE
SELF.Request = GlobalRequest
PARENT.Init()
SELF.FirstField = ?Browse:1
SELF.VCRRequest &= VCRRequest
1336 ABC Library Reference
InsertRecord, VIRTUAL
The InsertRecord method performs the necessary database insert operations when called.
InsertRecord returns Level:Benign to indicate successful a insert operation.
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory()
CASE SELF.Request
OF InsertRecord
RETURN SELF.InsertAction()
OF ChangeRecord
RETURN SELF.ChangeAction()
OF DeleteRecord
RETURN SELF.DeleteAction()
OF SaveRecord
CASE SELF.OriginalRequest
OF InsertRecord
RETURN SELF.SaveOnInsertAction()
OF ChangeRecord
RETURN SELF.SaveOnChangeAction()
END
END
RETURN Level:Benign
See Also:
TakeCompleted
Request
ChangeRecord
DeleteRecord
1338 ABC Library Reference
Implementation: Kill sets the Dead property to True and returns Level:Benign to indicate a normal
shut down. If the Dead property is already set to True, Kill returns Level:Notify to
indicate it is taking no additional action.
Typically, the Kill method is paired with the Init method, performing the converse
of the Init method tasks.
Example:
ThisWindow.Kill PROCEDURE()
CODE
IF PARENT.Kill() THEN RETURN Level:Notify.
IF FilesOpened
Relate:Defaults.Close
END
IF SELF.Opened
INIMgr.Update('Main',AppFrame)
END
GlobalResponse = CHOOSE(LocalResponse=0,RequestCancelled,LocalResponse)
Open, VIRTUAL
The Open method prepares the window for display. It is designed to execute on window opening
events such as EVENT:OpenWindow and EVENT:GainFocus.
Implementation: The Open method invokes the Translator if present and calls the Reset method
to reset the WINDOW.
Example:
ThisWindow.TakeWindowEvent PROCEDURE
CODE
CASE EVENT()
OF EVENT:OpenWindow
IF ~BAND(SELF.Inited,1)
SELF.Open
END
OF EVENT:GainFocus
IF BAND(SELF.Inited,1)
SELF.Reset
ELSE
SELF.Open
END
END
RETURN Level:Benign
ThisWindow.Open PROCEDURE
CODE
IF ~SELF.Translator&=NULL
SELF.Translator.TranslateWindow
END
SELF.Reset
SELF.Inited = BOR(SELF.Inited,1)
PostCompleted
The PostCompleted method initiates final or closedown processing for the window. This process
is typically initiated with an "OK" button. The actual processing depends on the type of window
defined.
Example:
WindowManager.TakeAccepted PROCEDURE
I LONG,AUTO
A SIGNED,AUTO
CODE
A = ACCEPTED()
IF ~SELF.Toolbar &= NULL
SELF.Toolbar.TakeEvent(SELF.VCRRequest,SELF)
IF A = Toolbar:History
SELF.RestoreField(FOCUS())
END
END
LOOP I = 1 TO RECORDS(SELF.Buttons)
GET(SELF.Buttons,I)
IF SELF.Buttons.Control = A
SELF.SetResponse(SELF.Buttons.Action)
RETURN Level:Notify
END
END
IF SELF.OkControl AND SELF.OkControl = A
SELF.PostCompleted
END
RETURN Level:Benign
PrimeFields, VIRTUAL
The PrimeFields method is a virtual placeholder method to prime fields for adding a record.
PrimeFields is called after the FileManager.PrimeRecord method to allow update form specific
field priming.
Example:
ThisWindow.PrimeFields PROCEDURE
CODE
CLI:StateCode = 'FL'
PARENT.PrimeFields
1342 ABC Library Reference
PrimeUpdate returns Level:Benign to indicate the record buffer is ready and the update form's
ACCEPT loop should execute.
PrimeUpdate returns Level:Fatal to indicate the ACCEPT loop should not execute, either because
the record buffer could not be primed, or because PrimeUpdate completed the requested
operation and no further action is necessary.
Implementation: The PrimeUpdate method primes the record buffer for inserts, deletes the record
for automatic deletes, and saves a copy of the record buffer in all cases.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
IF SELF.PrimeUpdate() THEN RETURN Level:Fatal .
OPEN(ClientFormWindow)
SELF.SetAlerts()
RETURN Level:Benign
WindowManager 1343
RemoveItem(WindowComponent)
Implementation: The Reset method calls the ResetSort and UpdateWindow methods for each
BrowseClass object registered by the AddItem method. It calls the ResetQueue
method for each FileDropClass object registered by the AddItem method.
The Open, TakeWindowEvent, and TakeNewSelection methods all call the Reset
method.
Example:
ThisWindow.TakeWindowEvent PROCEDURE
CODE
CASE EVENT()
OF EVENT:GainFocus
IF BAND(SELF.Inited,1)
SELF.Reset
ELSE
SELF.Open
END
OF EVENT:Sized
IF BAND(SELF.Inited,2)
SELF.Reset
ELSE
SELF.Inited = BOR(SELF.Inited,2)
END
END
RETURN Level:Benign
Implementation: The AddHistoryFile method names the file and record buffers from which fields
are saved and restored. The AddHistoryField method associates specific fields
from the history file with their corresponding WINDOW controls. The SaveHistory
method saves a copy of the history fields. The RestoreField method restores the
contents of a specific control.
Example:
WindowManager.TakeAccepted PROCEDURE
A SIGNED,AUTO
CODE
A = ACCEPTED()
IF ~SELF.Toolbar &= NULL
SELF.Toolbar.TakeEvent(SELF.VCRRequest,SELF)
IF A = Toolbar:History
SELF.RestoreField(FOCUS())
END
END
!procedure code
Run
Executes the normal WindowManager Init-Ask-Kill sequence.
Run(number, request)
A virtual placeholder method to execute a procedure identified by
number. This allows other objects and template generated code to invoke
subordinate WindowManager procedures by number rather than by
name. The procedure runs on the same thread as the calling procedure.
Example:
!procedure data
CODE
ThisWindow.Run !normal Init-Ask-Kill sequence
ThisWindow.TakeAccepted PROCEDURE()
CODE
!procedure code
IF SELF.Run(1,SelectRecord) = RequestCompleted !run a procedure on this thread
CLI:StateCode = ST:StateCode
ELSE
SELECT(?CLI:StateCode)
WindowManager 1347
CYCLE
END
SaveHistory, PROTECTED
The SaveHistory method saves a copy of the fields named by the AddHistoryField method for
later restoration by the RestoreField method.
Implementation: The AddHistoryFile method names the file and record buffers from which fields
are saved and restored. The AddHistoryField method associates specific fields
from the history file with their corresponding WINDOW controls. The SaveHistory
method saves a copy of the history fields. The RestoreField method restores the
contents of a specific control.
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory
CASE SELF.Request
OF InsertRecord
DO InsertAction
OF ChangeRecord
DO ChangeAction
OF DeleteRecord
DO DeleteAction
END
Implementation:
The SaveOnChangeAction method is called by the TakeCompleted
method when Request is set to SaveRecord and OriginalRequest is set to
ChangeRecord.
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory()
CASE SELF.Request
OF InsertRecord
RETURN SELF.InsertAction()
OF ChangeRecord
RETURN SELF.ChangeAction()
OF DeleteRecord
RETURN SELF.DeleteAction()
OF SaveRecord
CASE SELF.OriginalRequest
OF InsertRecord
RETURN SELF.SaveOnInsertAction()
OF ChangeRecord
RETURN SELF.SaveOnChangeAction()
END
END
RETURN Level:Benign
See Also:
TakeCompleted
Request
1350 ABC Library Reference
Example:
WindowManager.TakeCompleted PROCEDURE
CODE
SELF.SaveHistory()
CASE SELF.Request
OF InsertRecord
RETURN SELF.InsertAction()
OF ChangeRecord
RETURN SELF.ChangeAction()
OF DeleteRecord
RETURN SELF.DeleteAction()
OF SaveRecord
CASE SELF.OriginalRequest
OF InsertRecord
RETURN SELF.SaveOnInsertAction()
OF ChangeRecord
RETURN SELF.SaveOnChangeAction()
END
END
RETURN Level:Benign
See Also:
TakeCompleted
Request
WindowManager 1351
SetAlerts, VIRTUAL
The SetAlerts method alerts any required keystrokes for the window's controls, including
keystrokes required by the window's history key, browse lists, and locators.
Implementation: The SetAlerts method calls the BrowseClass.SetAlerts method for each
BrowseClass object added by the AddItem method. SetAlerts also ALRTs the
HistoryKey keystroke for each AddHistoryField control.
Note that the alerted keystrokes are associated only with the specific affected
controls, such as a LIST or ENTRY. The keystrokes are not alerted for the
WINDOW. See ALRT in the Language Reference for more information.
Example:
ThisWindow.Init PROCEDURE()
CODE
!procedure code
SELF.SetAlerts()
RETURN Level:Benign
Implementation: The TakeAccepted method calls the SetResponse method. SetResponse sets
the Response property and POSTs an EVENT:CloseWindow. If the response is
RequestCancelled, SetResponse also sets the VCRRequest property to
VCR:None.
Example:
WindowManager.TakeAccepted PROCEDURE
I LONG,AUTO
A SIGNED,AUTO
CODE
A = ACCEPTED()
!procedure code
LOOP I = 1 TO RECORDS(SELF.Buttons)
GET(SELF.Buttons,I)
IF SELF.Buttons.Control = A
SELF.SetResponse(SELF.Buttons.Action)
RETURN Level:Notify
END
END
!procedure code
RETURN Level:Benign
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
TakeCloseEvent implements the default processing when the end user cancels an update form
(presses the Cancel button). The actual process depends on the value of various
WindowManager properties, including Request, Response, CancelAction, OriginalRequest, etc.
TakeCloseEvent returns returns Level:Benign to indicate processing of this event should continue
normally; it returns Level:Notify to indicate processing is completed for this event and the
ACCEPT loop should CYCLE; it returns Level:Fatal to indicate the event could not be processed
and the ACCEPT loop should BREAK.
Implementation: The TakeEvent method calls the TakeCloseEvent method. The TakeCloseEvent
method undoes any processing rendered invalid by the form cancellation (for
example, deleting a dummy autoincremented record that is no longer needed).
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.
WindowManager 1355
IF FIELD()
RVal = SELF.TakeFieldEvent()
END
RETURN RVal
TakeCompleted implements the default processing when the end user accepts an update form
(presses the OK button). The actual process depends on the value of various WindowManager
properties, including Request, InsertAction, VCRRequest, etc.
Implementation: The TakeCompleted method calls the SaveHistory method, then completes the
requested action (insert, change, or delete), subject to various validation
constraints. That is the FileManager object validates form fields and does
concurrency checking, and the RelationManager object enforces any referential
constraints.
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()
WindowManager 1357
Example:
WindowManager.Ask PROCEDURE
CODE
IF SELF.Dead THEN RETURN .
CLEAR(SELF.LastInsertedPosition)
ACCEPT
CASE SELF.TakeEvent()
OF Level:Fatal
BREAK
OF Level:Notify
CYCLE !Not as dopey at it looks, it is for 'short-stopping' certain events
END
END
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
Implementation: TakeNewSelection resets the WindowManager when the end user selects a new
TAB.
Return values are declared in ABERROR.INC.
The TakeEvent method calls the TakeNewSelection method.
Return Data Type: BYTE
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
Implementation: TakeRejected sounds the audible alarm and returns focus to the offending
(rejected) control.
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
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
Example:
ThisWindow.TakeAccepted PROCEDURE()
Looped BYTE
CODE
LOOP
IF Looped
RETURN Level:Notify
ELSE
Looped = 1
END
PARENT.TakeAccepted()
CASE ACCEPTED()
OF ?Expand
ThisWindow.Update
?CusTree{PropList:MouseDownRow} = CHOICE(?CusTree)
DO REL1::ExpandAll
OF ?Contract
ThisWindow.Update
?CusTree{PropList:MouseDownRow} = CHOICE(?CusTree)
DO REL1::ContractAll
OF ?Insert
ThisWindow.Update
?CusTree{PropList:MouseDownRow} = CHOICE(?CusTree)
DO REL1::AddEntry
OF ?Change
ThisWindow.Update
?CusTree{PropList:MouseDownRow} = CHOICE(?CusTree)
DO REL1::EditEntry
OF ?Delete
ThisWindow.Update
?CusTree{PropList:MouseDownRow} = CHOICE(?CusTree)
DO REL1::RemoveEntry
END
RETURN Level:Benign
Index 1365
Index:
_Print (print rich text control contents).....305 AddItem (maintain the columninfo structure)
_Print print a Crystal Report ....................283 .............................................................316
ABC Template Implementation.......338, 957, AddItem (maintain the namequeue
1099, 1167 structure) ..............................................327
ACCEPT ................................................1332 AddItem (program the AsciiViewer object)
ActiveInvisible ..........................................150 .............................................................104
BrowseClass ........................................150 AddItem (program the WindowManager
ActiveInvisible (obscured browse list action) object).................................................1330
.............................................................150 AddItem(program the BrowseClass object)
AddBreak .................................................123 .............................................................176
AddControl...............................................463 AddItem(program the ReportManager
AddEditControl ........................................174 object).................................................1032
BrowseClass ........................................174 AddItemEvent ..........................................837
AddEditControl (specify custom edit-in-place PopupClass ..........................................837
class)....................................................174 AddItemEvent (set menu item action) .....837
AddErrors.................................................502 AddItemMimic ..........................................838
ErrorClass ............................................502 PopupClass ..........................................838
AddErrors (add or override recognized AddItemMimic (tie menu item to a button)
errors)...................................................502 .............................................................838
AddField...........................................175, 579 AddKey ....................................................605
BrowseClass ........................................175 FileManagerClass ................................605
FileDropClass ......................................579 AddKey (set the file's keys) .....................605
AddField (specify a FILE/QUEUE field pair) AddLocator...............................................176
.............................................................175 BrowseClass ........................................176
AddField (specify display fields) ..............579 AddLocator (specify a locator) ................758
AddField(track fields in a structure) .........604 AddLocator (specify a locator) .................176
AddHistory (update History structure) .....503 AddLogFile (maintain log file structure) ...317
AddHistoryField .....................................1328 AddMask ................................................1090
WindowManagerClass .......................1328 SelectFileClass ..................................1090
AddHistoryField (add restorable control and AddMask (add file dialog file masks) .....1090
field) ...................................................1328 AddMenu..................................................839
AddHistoryFile .......................................1329 PopupClass ..........................................839
WindowManagerClass .......................1329 AddPair ............................................238, 541
AddHistoryFile (add restorable history file) BufferedPairsClass ..............................239
...........................................................1329 FieldPairsClass ....................................541
AddItem ...... 104, 256, 540, 835, 1118, 1330 AddPair (add a field pair) .................238, 541
AsciiViewerClass .................................104 AddRange ..............................................1255
FieldPairsClass ....................................540 ViewManagerClass ............................1255
PopupClass..........................................835 AddRange (add a range limit)................1255
QueryClass ..........................................913 AddRecord (add a record filedrop queue)
StepCustomClass ..............................1118 .............................................................561
WindowManagerClass .......................1330 AddRelation ...........................................1000
AddItem (add a step marker).................1118 RelationManagerClass.......................1000
AddItem (add field to query) ....................913 AddRelation (set a file relationship) .......1000
AddItem (add menu item) ........................835 AddRelationLink.....................................1002
1366 ABC Library Reference
CreateControl.......................................438 EndReport..............................................1035
methods ...............................................435 Enter ........................................................455
properties .............................................434 Enter (edit-in-place action on enter key).455
Reset....................................................438 EnterAction ..............................................156
TakeAction ...................................439, 440 BrowseClass ........................................156
TakeEvent ............................................442 EnterAction (edit-in-place action on enter
Title ......................................................434 key).......................................................156
EditMultiSelectClass ABC Template Entries....................................................1117
Implementation ....................................428 StepCustomClass ..............................1117
EditMultiSelectClass Concepts ...............427 Entries (expected data distribution) .......1117
EditMultiSelectClass Conceptual Example EntryCompletion ......................................557
.............................................................429 FileDropComboClass ...........................557
EditMultiSelectClass Functional EntryCompletion (automatic fill-ahead flag)
Organization--Expected Use................435 .............................................................557
EditMultiSelectClass Methods .................435 EntryLocatorClass
EditMultiSelectClass Overview................427 methods................................................482
EditMultiSelectClass Properties ..............434 properties .............................................481
EditMultiSelectClass Relationship to Other EntryLocatorClass Methods.....................482
Application Builder Classes .................427 EntryLocatorClass Overview ...................477
EditMultiSelectClass Source Files...........428 EntryLocatorClass Properties ..................481
EditSpinClass ..........................................351 EQ............................................................455
EditSpinClass -- Relationship to Other Equal........................................................547
Application Builder Classes .................351 FieldPairsClass ....................................547
EditSpinClass Concepts ..........................351 Equal (return 1 if all pairs are equal) .......547
EditSpinClass Methods ...........................356 Equal(checks for equal before and after
EditSpinClass Properties.........................355 values)..................................................329
EditSpinClass Source Files .....................351 EqualBuffer ..............................................616
EditSpinClass--ABC Template FileManagerClass ................................616
Implementation ....................................351 EqualBuffer (detect record buffer changes)
EditSpinClass--Conceptual Example ......352 .............................................................616
EditSpinClass--Functional Organization— EqualLeftBuffer ........................................244
Expected Use.......................................356 BufferedPairsClass ..............................244
EditSpinClass--Overview.........................351 EqualLeftBuffer (compare "left" fields to
EditTextClass Overview .........................443 "buffer" fields) .......................................244
EditTextClass Methods............................446 EqualLeftRight .........................................548
EIP ...........................................................155 FieldPairsClass ....................................548
EIPManagerClass....................................449 EqualLeftRight (return 1 if all pairs are
EIPManagerClass Concepts ...................449 equal) ...................................................548
EIPManagerClass Source Files ..............450 EqualRightBuffer......................................245
EIPManagerClass--ABC Template BufferedPairsClass ..............................245
Implementation ....................................450 EqualRightBuffer (compare "right" fields to
EIPManagerClass--Conceptual Example 451 "buffer" fields) .......................................245
EIPManagerClass--Functional Organization- Err (errorclass object) .............................824
-Expected Use .....................................461 Err (errorclass obejct) ..............................765
EIPManagerClass--Overview ..................449 ErrorClass
EIPManagerClass--Relationship to Other methods........................................500, 501
Application Builder Classes .................449 properties .............................................495
Index 1373
InPageList................................................879 RelationManagerClass.......................1010
Insert................................................457, 629 ReportManagerClass .........................1037
FileManagerClass ................................629 StepClass ...........................................1109
Insert (add a new record) ........................629 StepCustomClass ..............................1122
Insert (placement of new record).............457 StepStringClass .................................1156
Insert(add entry to LIST queue) ..............223 ToolbarClass ......................................1181
InsertAction............................................1319 TranslatorClass ..................................1237
WindowManagerClass .......................1319 WindowManagerClass .......................1338
InsertAction (response to insert request) WindowResizeClass ..........................1297
...........................................................1319 Kill (perform any necessary termination
InsertButton ...........................................1207 code) ............................................507, 827
ToolbarTargetClass ...........................1207 Kill (shut down DbAuditManger object) ...319
InsertButton (insert control number)......1207 Kill (shut down DbChangeManger object)
InsertControl ............................................159 .............................................................330
BrowseClass ........................................159 Kill (shut down the ASCIIFileClass object) 73
InsertRecord ..........................................1337 Kill (shut down the ASCIIViewerClass
Interactive Database Operations object)...................................................109
FileManagerClass ................................601 Kill (shut down the BrowseClass object) .187
Interactivity...............................................735 Kill (shut down the
IsDirty (indicates modified data) ..............300 BrowseEIPManagerClass object) ........141
IsOverNode .............................................735 Kill (shut down the BufferedPairsClass
IsSkelActive .............................................761 object)...................................................247
KeepVisible............................................1024 Kill (shut down the ConstantClass object)
KeyToOrder .............................................630 .............................................................259
FileManagerClass ................................630 Kill (shut down the csRTF object) ............301
KeyToOrder (return ORDER expression for Kill (shut down the EIPManagerClass object) .............
a key) ...................................................630 Kill (shut down the FieldPairsClass object)
KeyValid (check for valid keystroke) .......565 .............................................................549
KeyWordLookup (lookup keyword) .......1163 Kill (shut down the FileDropClass object) 582
Kill .... 73, 109, 110, 141, 187, 247, 259, 467, Kill (shut down the PopupClass object) ...848
507, 549, 582, 632, 736, 848, 880, 901, Kill (shut down the PrintPreviewClass
966, 988, 1010, 1037, 1109, 1122, 1156, object)...................................................880
1181, 1237, 1265, 1297, 1338 Kill (shut down the ProcessClass object) 901
ASCIIViewerClass................................109 Kill (shut down the QueryClass object)....922
BrowseClass ........................................187 Kill (shut down the QueryFormClass object)
BufferedPairsClass ..............................247 .............................................................940
ConstantClass......................................259 Kill (shut down the QueryListClass object)
EditClass ..............................................347 .............................................................966
ErrorClass ............................................507 Kill (shut down the QueryVisual object)...988
FieldPairsClass ....................................549 Kill (shut down the RelationManager object)
FileDropClass ......................................582 ...........................................................1010
FileManagerClass ................................632 Kill (shut down the ReportManager object)
PopupClass..........................................848 ...........................................................1037
PrintPreviewClass................................880 Kill (shut down the StepClass object) ....1109
ProcessClass .......................................901 Kill (shut down the StepCustomClass object)
QueryClass ..........................................922 ...........................................................1122
QueryFormClass..................................940
Index 1379
Kill (shut down the StepStringClass object) ListControl (listbox control number).........458
...........................................................1156 ListLinkingFields ....................................1011
Kill (shut down the ToolbarClass object) RelationManagerClass.......................1011
...........................................................1181 ListLinkingFields (map pairs of linked fields)
Kill (shut down the TranslatorClass object) ...........................................................1011
...........................................................1237 ListQueue.................................................159
Kill (shut down the WindowManager object) BrowseClass ........................................159
...........................................................1338 Load .........................................................260
Kill (shut down the WindowResizeClass ConstantClass ......................................260
object) ................................................1297 Loaded .....................................................159
Kill (shutdown FuzzyClass object)...........688 BrowseClass ........................................159
Kill (shutdown TextWindow object) .......1169 Loaded (browse queue loaded flag) ........159
Kill (shutdown the FileManager object) ...632 LoadField (load rich text data from field) .302
Kill (shutdown the GridClass object) .......762 LocateButton(query control number) .....1207
Kill (shutdown the QueryListVisual object) LocatorClass ........................... 679, 811, 812
.............................................................976 methods................................................815
Kill (shutdown the TagHTMLHelp object) properties .............................................813
...........................................................1163 LocatorClass Methods .............................815
Kill shut down Crystal8 object ................281 LocatorClass Overview............................811
Kill(shutdown the parent object) ............1278 LocatorClass Properties ..........................813
LastColumn .............................................458 LockRecover ............................................599
LastColumn (previous edit-in-place column) FileManagerClass ................................599
.............................................................458 LockRecover (/RECOVER wait time
LastInsertedPosition ..............................1319 parameter)............................................599
WindowManager ................................1319 LookupMode ..........................................1150
LazyOpen ................................................599 StepStringClass .................................1150
FileManagerClass ................................599 Low ............................................. 1126, 1140
LazyOpen (delay file open until access)..599 StepLongClass ...................................1126
LBColumns (number of listbox columns).766 StepRealClass ...................................1140
LeftIndent (indent the current or selected Low (lower boundary) ................. 1126, 1140
paragraph) ...........................................301 Match (find query matches) .....................689
Level ........................................................490 Maximize
Benign ..................................................490 PrintPreviewClass ................................867
Cancel ..................................................490 MAXIMIZE................................................867
Fatal .....................................................490 Maximize (number of pages displayed
Notify ....................................................490 horizontally) ..........................................867
Program ...............................................490 Me ............................................................998
User......................................................490 RelationManagerClass.........................998
LFM (DbLogFileManager object).............315 Me (the primary file's FileManager object)
LimitTextSize (limit amount of text) .........302 .............................................................998
LineCounter ...............................................91 Message
ASCIISearchClass .................................91 ErrorClass ............................................508
List MESSAGE ...............................................508
FieldPairsClass ....................................538 MessageBox ............................................510
LIST .........................................................538 ErrorClass ............................................510
List (recognized field pairs)......................538 MessageBox (display error message to
ListControl................................................458 window) ................................................510
1380 ABC Library Reference
SetItemCheck (set toggle item status) ....852 SetParentDefaults (set default parent
SetItemEnable .........................................853 controls)..............................................1302
PopupClass..........................................853 SetPercentile .............................................76
SetItemEnable (set item status) ..............853 ASCIIFileClass .......................................76
SetKey .....................................................656 SetPercentile (set file to relative position) .76
FileManagerClass ................................656 SetPosition
SetKey (set current key) ..........................656 PrintPreviewClass ................................883
SetLevel...................................................854 SETPOSITION.........................................883
PopupClass..........................................854 SetPosition (set initial preview window
SetLevel (set menu item level) ................854 coordinates) .........................................883
SetLimit....................1110, 1129, 1143, 1157 SetProcedureName .................................519
QueryClass ..................................926, 927 SetProcedureName ( stores procedure
StepClass...........................................1110 names...................................................519
StepLongClass...................................1129 SetProgressLimits....................................903
StepRealClass ...................................1143 SetQueueRecord .............................206, 584
StepStringClass .................................1157 BrowseClass ........................................206
SetLimit (set search values) ....................926 FileDropClass.......................................584
SetLimit (set smooth data distribution) .1110, SetQueueRecord (copy data from file buffer
1129, 1143, 1157 to queue buffer)............................206, 584
SetLimitNeeded ...........................1111, 1158 SetQuickPopup ........................................928
StepClass...........................................1111 SetQuickPopup ( add QuickQBE to browse
StepStringClass .................................1158 popup ) .................................................928
SetLimitNeeded (return static/dynamic SetQuickScan ........................................1014
boundary flag) ....................................1158 RelationManagerClass.......................1014
SetLine...............................................75, 114 SetQuickScan (enable QuickScan on a file
ASCIIFileClass .......................................75 and any related files)..........................1014
ASCIIViewerClass................................114 SetReadOnly ...................................348, 394
SetLine (a virtual to position the file) .........75 SetReadOnly (set edit control to read-only
SetLine (position to specific line) .............114 EditDropClass) .....................................394
SetLineRelative .......................................115 SetReadOnly (set edit control to read-only)
ASCIIViewerClass................................115 .............................................................348
SetLineRelative (move n lines)................115 SetReportTarget ....................................1043
SetLocatorField .......................................205 SetResponse .........................................1352
SetLocatorFromSort ................................205 WindowManagerClass .......................1352
SetMask.................................................1093 SetResponse (OK or Cancel the window)
SelectFileClass ..................................1093 ...........................................................1352
SetMask (set file dialog file masks) .......1093 SetShadow...............................................485
SetName..................................................657 SetShadow (update shadow value) .........819
FileManagerClass ................................657 SetShadow(set shadow value) ................485
SetName (set current filename) ..............657 SetSort .......................................... 207, 1274
SetOption (set fuzzymatch options) ........690 BrowseClass ........................................207
SetOrder ................................................1273 ViewManagerClass ............................1274
ViewManagerClass ............................1273 SetSort (apply a sort order to the browse)
SetOrder (replace a sort order) ............1273 .............................................................207
SetParentControl ...................................1301 SetSort (set the active sort order)..........1274
SetParentDefaults .................................1302 SetStaticControlsAttributes....................1043
WindowResizeClass ..........................1302 SetStrategy ............................................1303
1388 ABC Library Reference
TakeOther................................................525 TerminatorField........................................253
ErrorClass ............................................525 TerminatorInclude....................................253
TakeOther (process other error)..............525 TerminatorValue (end of data marker) ....254
TakeProgram ...........................................526 TestLen ..................................................1152
ErrorClass ............................................526 StepStringClass .................................1152
TakeProgram (process program error)...526 TestLen (length of the static step portion)
TakeRecord .............................................904 ...........................................................1152
ProcessClass .......................................904 TextWindowClass Concepts..................1167
TakeRecord (a virtual to process each report TextWindowClass Methods ...................1169
record)..................................................904 TextWindowClass Overview ..................1167
TakeRecord(process each record)........1046 TextWindowClass Properties.................1168
TakeRejected ........................................1361 TextWindowClass Source Files .............1167
WindowManagerClass .......................1361 Throw ...............................................528, 659
TakeRejected (a virtual to process EVENT ErrorClass ............................................528
Rejected)............................................1361 FileManagerClass ................................659
TakeScroll................................................212 Throw (process specified error) ..............528
BrowseClass ........................................212 Throw (pass an error to the error handler for
TakeScroll (process a scroll event) .........212 processing)...........................................659
TakeSelected.........................................1362 ThrowFile .................................................529
WindowManagerClass .......................1362 ErrorClass ............................................529
TakeSelected (a virtual to process EVENT ThrowFile (set value of %File
Selected) ............................................1362 then process error)...............................529
TakeToolbar ......................1202, 1213, 1227 ThrowMessage ................................530, 660
ToolbarListBoxClass ..........................1193 ErrorClass ............................................530
ToolbarReltreeClass ..........................1202 FileManagerClass ................................660
ToolbarTargetClass ...........................1213 ThrowMessage (pass an error and text to
ToolbarUpdateClass ..........................1227 the error handler) .................................660
TakeToolbar (assume contol of the toolbar) TimeOut .................................................1252
...........................................................1193 ViewManagerClass ............................1252
TakeToolbar (assume control of the toolbar) TimeOut (buffered pages freshness).....1252
.......................................1202, 1213, 1227 TimeSlice ...............................................1029
TakeUser .................................................527 ReportManagerClass .........................1029
ErrorClass ............................................527 TimeSlice (report resource usage) ........1029
TakeUser (process user error) ................527 Title ..........................................................445
TakeVCRScroll ........................................213 EditColorClass .....................................373
BrowseClass ........................................213 EditFileClass ........................................412
TakeVCRScroll (process a VCR scroll EditFontClass .......................................423
event) ...................................................213 EditMultiSelectClass ............................434
TakeWindowEvent.......889, 992, 1047, 1363 Title (color dialog title text).......................373
PrintPreviewClass................................889 Title (font dialog title text).................423, 434
ReportManager ..................................1047 Title (text dialog title text).........................445
TakeWindowEvent (process non-field Toolbar
events) .................................................889 BrowseClass ........................................169
TakeWindowEvent (a virtual to process non- TOOLBAR................................................169
field events)........................................1047 Toolbar (browse Toolbar object)..............169
TargetSelector .......................................1028 ToolbarClass. 1171, 1172, 1173, 1174, 1176
TargetSelectorCreated ..........................1028 methods..............................................1178
1392 ABC Library Reference