ABC Library Reference
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.
This publication supports Clarion. It is possible that it may contain technical or typographical errors. SoftVelocity
Incorporated provides this publication ―as is,‖ without warranty of any kind, either expressed or implied.
SoftVelocity Incorporated
P.O. Box 510190
Melbourne Beach, Florida 32951
(866) 783-4320
www.softvelocity.com
Trademark Acknowledgements:
Contents:
Foreword 36
Welcome .................................................................................................................................................................. 36
Documentation Conventions .................................................................................................................................... 37
Keyboard Conventions ................................................................................................................................ 37
Other Conventions ...................................................................................................................................... 37
ABC Library Overview 38
About This Book ....................................................................................................................................................... 38
Application Builder Class (ABC) Library .................................................................................................................. 38
Class Libraries Generally ............................................................................................................................ 38
Application Builder Classes—The ABCs of Rapid Application Development ............................................. 38
ABC Library and the ABC Templates ......................................................................................................... 42
ABC Coding Conventions ........................................................................................................................................ 44
Method Names ............................................................................................................................................ 44
Where to Initilize & Kill Objects ................................................................................................................... 45
Return Values ............................................................................................................................................. 45
PRIVATE (undocumented) Items ................................................................................................................ 46
PROTECTED, VIRTUAL, DERIVED, and PROC Attributes ....................................................................... 47
Documentation Conventions .................................................................................................................................... 48
Reference Item and Syntax Diagram .......................................................................................................... 48
Property (short description of intended use) ............................................................................................... 48
Method (short description of what the method does) .................................................................................. 48
Conceptual Example ................................................................................................................................... 49
ASCIIFileClass 50
ASCIIFileClass Overview .................................................................................................................................. 50
AsciiFileClass Properties ................................................................................................................................... 53
ASCIIFile (the ASCII file)............................................................................................................................. 53
ErrorMgr (ErrorClass object) ....................................................................................................................... 53
OpenMode (file access/sharing mode) ....................................................................................................... 53
AsciiFileClass Methods ..................................................................................................................................... 54
ASCIIFileClass Functional Organization--Expected Use ............................................................................ 54
FormatLine (a virtual to format text) ............................................................................................................ 55
GetDOSFilename (let end user select file) ................................................................................................. 56
GetFilename (return the filename) .............................................................................................................. 57
GetLastLineNo (return last line number) ..................................................................................................... 58
GetLine (return line of text) ......................................................................................................................... 59
GetPercentile (convert file position to percentage:ASCIIFileClass) ........................................................... 60
Init (initialize the ASCIIFileClass object) ..................................................................................................... 61
Kill (shut down the ASCIIFileClass object).................................................................................................. 62
Reset (reset the ASCIIFileClass object) ..................................................................................................... 63
SetLine (a virtual to position the file) ........................................................................................................... 64
SetPercentile (set file to relative position) ................................................................................................... 65
ValidateLine (a virtual to implement a filter) ................................................................................................ 66
ASCIIPrintClass 68
ASCIIPrintClass Overview ................................................................................................................................. 68
AsciiPrintClass Properties ................................................................................................................................. 71
FileMgr (AsciiFileClass object:AsciiPrintClass) .......................................................................................... 71
PrintPreview (print preview switch) ............................................................................................................. 71
Translator (TranslatorClass object:AsciiPrintClass) ................................................................................... 71
AsciiPrintClass Methods .................................................................................................................................... 72
Ask (solicit print specifications) ................................................................................................................... 72
Init (initialize the ASCIIPrintClass object).................................................................................................... 73
4 ABC Library Reference
Interactivity (process mouse location data to tool tip or control ................................................................ 697
IsOverNode ( is mouse over node location).............................................................................................. 697
Kill (shut down the GraphClass object) ..................................................................................................... 698
MouseText (creates text and mouse coordinate information)................................................................... 698
MouseXText (generate X coordinate text only) ........................................................................................ 698
MouseYText (generate Y coordinate text only) ........................................................................................ 699
NodeNameText (generate current node name identifier) ......................................................................... 699
NodeText (generate label, name, and node value) .................................................................................. 700
NodeTipText (generate node information for tool tip) ............................................................................... 700
NodeValueText (generate current node value text) .................................................................................. 701
NodeXText (generate X node text value).................................................................................................. 701
NodeYText (generate Y node text value).................................................................................................. 702
Popup (GraphClass object popup menu manager) .................................................................................. 702
PopupAsk (Display popup menu for graph object) ................................................................................... 703
PostEvent (send an event to the GraphClass object) ............................................................................... 704
PrintGraph (send graph object to printer) ................................................................................................. 706
Refresh (refresh drawing of GraphClass object) ...................................................................................... 707
Resize (conditional refresh when size changed) ...................................................................................... 707
ReturnFromDrillDown ( transfer control to graph object after drilldown) .................................................. 708
SaveAsGraph (save graph to WMF file selected) ..................................................................................... 709
SaveGraph (auto-save graph to WMF file) ............................................................................................... 709
SetDefault (initialize selected graph properties) ....................................................................................... 710
ShowOnField (show text contents to specified field) ................................................................................ 710
ShowOnStatusBar (show text to status bar zone) .................................................................................... 711
TakeEvent (process graph control events) ............................................................................................... 711
TakeEventofParent (process all graph events) ......................................................................................... 712
ToolTip (show all text to tool tips) ............................................................................................................. 712
ToShowValues (show all composite text to all graph targets) .................................................................. 713
GridClass 714
GridClass Overview ......................................................................................................................................... 714
Relationship to Other Application Builder Classes .......................................................................................... 714
GridClass ABC Template Implementation ....................................................................................................... 714
GridClass Source Files .................................................................................................................................... 714
GridClass Properties ....................................................................................................................................... 715
GridClass Properties ................................................................................................................................. 715
Children (reference to child group controls) .............................................................................................. 715
Chosen (current browse queue element).................................................................................................. 715
ClickPress (forward control) ...................................................................................................................... 716
ControlBase (base control number) .......................................................................................................... 716
ControlNumber (number of controls) ........................................................................................................ 716
GroupColor (background color of group fields) ......................................................................................... 717
GroupControl (GROUP control number) ................................................................................................... 717
GroupTitle (title of group element) ............................................................................................................ 717
SelColor (color of selected element) ......................................................................................................... 718
Selectable (element selectable flag) ......................................................................................................... 718
UpdateControl (file update trigger) ............................................................................................................ 718
UpdateControlEvent .................................................................................................................................. 718
GridClass Methods .......................................................................................................................................... 719
AddLocator (specify a locator) ................................................................................................................. 719
FetchRecord (retrieve selected record) .................................................................................................... 719
GetAcross (number of horizontal grids) .................................................................................................... 720
GetClickPress (forward click control) ........................................................................................................ 720
GetDown (number of vertical grids ) ......................................................................................................... 720
GetPosition (retrieve group control position)............................................................................................. 721
IfGroupField (determine if current control is a GROUP) ........................................................................... 721
Init (initialize the GridClass object) ............................................................................................................ 722
IsSkelActive ............................................................................................................................................... 722
Kill (shutdown the GridClass object) ......................................................................................................... 723
Contents and Forward 21
TransactionManagerClass 1157
Overview ........................................................................................................................................................ 1157
TransactionManager Concepts ..................................................................................................................... 1157
TransactionManager ABC Template Implementation ................................................................................... 1157
TransactionManager Relationship to Other Application Builder Classes ...................................................... 1158
TransactionManager Source Files................................................................................................................. 1158
TransactionManager Conceptual Example ................................................................................................... 1159
TransactionManager Properties .................................................................................................................... 1161
TransactionManager Methods ....................................................................................................................... 1161
AddItem (add a RelationManager to transaction list) .............................................................................. 1162
Finish (rollback or commit transaction) ................................................................................................... 1163
Process (a virtual to process transaction) ............................................................................................... 1164
Reset (remove all RelationManagers from transaction list) .................................................................... 1165
RestoreLogout (restore all RelationManagers in transaction list to previous logout status) ................... 1166
Run (initiates transaction sequence) ....................................................................................................... 1167
SetLogoutOff (turn off logout for all RelationManagers in transaction list) ............................................. 1168
SetTimeout (set timeout used in transaction) ......................................................................................... 1169
Start (start the transaction) ..................................................................................................................... 1170
TransactionCommit (commit the transaction) ......................................................................................... 1172
TransactionRollBack (rollback the transaction) ...................................................................................... 1173
TranslatorClass 1174
TranslatorClass Overview ............................................................................................................................. 1174
TranslatorClass Properties ............................................................................................................................ 1178
ExtractText (identify text to translate) ..................................................................................................... 1178
TranslatorClass Methods ............................................................................................................................... 1179
AddTranslation (add translation pairs) .................................................................................................... 1179
Init (initialize the TranslatorClass object) ................................................................................................ 1181
Kill (shut down the TranslatorClass object)............................................................................................. 1181
TranslateControl (translate text for a control) ......................................................................................... 1182
TranslateControls (translate text for range of controls) .......................................................................... 1183
TranslateString (translate text) ................................................................................................................ 1184
TranslateWindow (translate text for a window) ....................................................................................... 1185
ViewManager 1186
ViewManager Overview ................................................................................................................................. 1186
ViewManager Properties ............................................................................................................................... 1190
Order (sort, range-limit, and filter information) ........................................................................................ 1190
PagesAhead (buffered pages) ................................................................................................................ 1191
PagesBehind (buffered pages) ............................................................................................................... 1191
PageSize (buffer page size) ................................................................................................................... 1192
Primary (the primary file RelationManager ) ........................................................................................... 1192
SavedBuffers (saved record buffers) ...................................................................................................... 1193
TimeOut (buffered pages freshness) ...................................................................................................... 1194
View (the managed VIEW) ...................................................................................................................... 1194
ViewManager Methods .................................................................................................................................. 1195
ViewManager Functional Organization--Expected Use .......................................................................... 1195
AddRange (add a range limit) ................................................................................................................. 1197
AddSortOrder (add a sort order) ............................................................................................................. 1198
AppendOrder (refine a sort order) ........................................................................................................... 1199
ApplyFilter (range limit and filter the result set)....................................................................................... 1200
ApplyOrder (sort the result set) ............................................................................................................... 1201
ApplyRange (conditionally range limit and filter the result set) ............................................................... 1202
Close (close the view) ............................................................................................................................. 1203
GetFirstSortField (return first field of current sort) .................................................................................. 1203
GetFreeElementName (return free key element name) ......................................................................... 1204
GetFreeElementPosition (return free key element position) ................................................................... 1205
Init (initialize the ViewManager object) ................................................................................................... 1206
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.
Contents and Forward 37
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.
CAPS Indicates keystrokes to enter at the keyboard such as ENTER or ESCAPE, and mouse
operations such as RIGHT-CLICK.
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.
38 ABC Library Reference
It provides an overview of each class or related group of classes. Then it provides specific information on the
public properties and methods of each class, plus examples for using them. It also shows you the source files for
each class and describes some of the relationships between the classes.
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.
ABC Library Overview 39
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.
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.
40 ABC Library Reference
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')
ABC Library Overview 41
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’)
42 ABC Library Reference
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
ABC Library Overview 43
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
44 ABC Library Reference
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.
Throw[Item]
The method ―throws‖ the item to another object or method for handling. The item is usually an error condition.
ABC Library Overview 45
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.
A return value of Level:Benign indicates processing of this event should continue normally. A return value of
Level:Notify indicates processing is completed for this event and the ACCEPT loop should CYCLE. A return value
of Level:Fatal indicates the event could not be processed and the ACCEPT loop should BREAK.
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
46 ABC Library Reference
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
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.
48 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 discussion of specific implementation issues. The implementation may change with each release /
version of Internet Connect.
ComplexDataType STRUCTURE !actual structure declaration
END
| alternate |
| parameters |
parameter1 A complete description of parameter1, along with how it relates to parameter2 and the Method.
parameter2 A complete description of parameter2, along with how it relates to parameter1 and the Method.
Brackets [ ] indicate optional parameters.
Implementation: A description of how the method currently accomplishes its objective. The implementation may change
with each release / version of Clarion.
Example:
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
50 ABC Library Reference
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
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
52 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
58 ABC Library Reference
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
ASCIIFileClass 59
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
ASCIIFileClass 61
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
ASCIIFileClass 63
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.
SetPercentile calculates the position by dividing percentile by 100 then multiplying the resulting
percentage times the file size.
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
ASCIIFileClass 67
68 ABC Library Reference
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.
ASCIIPrintClass 69
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.
70 ABC Library Reference
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
ASCIIPrintClass 71
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
ASCIIPrintClass 73
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
74 ABC Library Reference
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
ASCIISearchClass 77
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
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,GlobalErro rs)
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
78 ABC Library Reference
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
ASCIISearchClass 79
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
82 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
ASCIISearchClass 83
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.
ASCIIViewerClass 87
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 ABC Templates declare a local ASCIIViewer class and object for each instance of the ASCIIViewControl template.
The ABC Templates automatically include all the classes necessary to support the functionality specified in the
ASCIIViewControl template.
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.
Implementation: The ASCIIViewerClass invokes the AskGotoLine method from a RIGHT-CLICK popup menu. The
AskGotoLine method calls the SetLine method to position to the requested record.
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
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
100 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 101
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
Implementation: The AskGotoLine method, the ASCIIFileClass.SetPercentile method, and the ASCIISearchClass.Ask
method all use the SetLine method to position to the required text line.
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
104 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 105
Implementation: The TakeEvent method handles resizing, RIGHT-CLICKS, LEFT-CLICKS, and scrolling events.
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
106 ABC Library Reference
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.
Each break inherits a set of methods and properties defined by an internal LevelManager. An internal break
queue stores a unique break and level id which triggers the appropriate break logic.
ReportManagerClass
LevelManagerClass
Each ReportManagerClass utilizing embedded breaks declares a LevelManagerClass to manage the nesting
and execution of the embedded break logic.
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
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
108 ABC Library Reference
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
!|
!---------------------------------------------------------------------------
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 113
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()
114 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 115
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)
116 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.
BreakManagerClass 117
118 ABC Library Reference
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
BrowseClass 119
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
120 ABC Library Reference
BrowseClass
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.
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
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
122 ABC Library Reference
BrowseClass 123
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
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)
124 ABC Library Reference
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.
BrowseClass 125
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 closely integrated with several other ABC Library objects--in particular the WindowManager and
ToolbarClass objects. 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 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.
132 ABC Library Reference
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)
BrowseClass 135
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.
Implementation: The ResetQueue method implements the behavior specified by the ActiveInvisible property.
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.
Implementation: Because it directly references the PopupClass, the BrowseClass header INCLUDEs the PopupClass
header. That is, the BrowseClass's implementation of the PopupClass is automatic. You need take no
action.
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.
148 ABC Library Reference
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.
Note: The RelationManager.SetQuickScan method does not set the BrowseClass.QuickScan property. However
if you set the BrowseClass.QuickScan property to 1, the BrowseClass uses the
RelationManager.SetQuickScan method to SEND the QUICKSCAN driver string to the appropriate files.
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.
Implementation: In select mode, a DOUBLE-CLICK or ENTER selects the item; otherwise, a DOUBLE-CLICK or ENTER
updates the item.
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.
Implementation: The BrowseClass.Sort property mimics or shadows the inherited ViewManager.Order property. The Sort
property is a reference to a QUEUE declared in ABBROWSE.INC as follows:
BrowseSortOrder QUEUE(SortOrder),TYPE !browse sort information
Locator &LocatorControl !locator for this sort order
Resets &FieldPairsClass !reset fields for this sort order
Thumb &ThumbClass !ThumbClass for this sort order
END
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
And the SortOrder queue contains a reference to the FilterQueue declared in ABFILE.INC as follows:
FilterQueue QUEUE,TYPE !VIEW filter information
ID STRING(30) !filter ID
Filter &STRING !filter expression
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 AddToolbarTarget method registers a ToolbarTarget, such as a ToolbarListBoxClass object, as a potential target of a
ToolbarClass object.
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 AddToolbarTarget method registers a ToolbarTarget, such as a ToolbarListBoxClass object, as a potential target of a
ToolbarClass object.
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.
The WindowManager.AddItem method registers the BrowseClass object with the WindowManager object, so the
WindowManager object can forward events.
Implementation: The WindowManager object calls the BrowseClass.TakeEvent method so the BrowseClass object can
handle the events as needed.
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.
Use ResetSort followed by UpdateWindow to refresh and redisplay your ABC BrowseBoxes. Or, use the
WindowManager.Reset method.
BrowseClass 159
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.
The autofree parameter defaults to zero (0). The BrowseClass.Kill method DISPOSEs the editclass
objects only if autofree contains a non-zero value.
The BrowseClass.Ask method instantiates the editclass objects as needed, then creates and deletes the
edit-in-place control upon the end user's insert or change request.
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
BrowseClass 161
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.
The WindowManager.Reset method also initiates an evaluation of the reset fields and a subsequent
browse reset if needed for any browse objects registered with the WindowManager.
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
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
Implementation: Fetch is called by the ResetQueue, ScrollOne, ScrollPage, and ScrollEnd methods. A page of items is as
many items as fits in the LIST control.
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:
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
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)
The Next method is called by the Fetch and ResetThumbLimits(PRIVATE) methods. Among other things,
Next calls the PARENT.Next (ViewManager.Next) method. See ViewManager for more information.
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
Implementation: The NotifyUpdateError is called from the BrowseClass UpdateViewRecord method, which is used to
retrieve the VIEW record that corresponds to a chosen listbox record.
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
174 ABC Library Reference
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)
The Previous method is called by the Fetch and ResetThumbLimits methods. Among other things,
Previous calls the PARENT.Previous (ViewManager.Previous) method. See ViewManager for more
information.
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.
ResetFromAsk FLUSHes the BrowseClass object's VIEW if needed, calls the appropriate "reset" method
(ResetQueue, ResetFromFile, or ResetFromView) to refill the QUEUE, then carries out any pending scroll
request made concurrently with the update. See WindowManager.VCRRequest.
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.
Implementation: ResetFromBuffer succeeds even if there is no exactly matching record and is typically used to locate the
appropriate record after a thumb movement.
ResetFromBuffer calls the ViewManager.Reset method for positioning, then calls the ResetQueue
method to fill the browse queue.
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 179
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.
The ResetFromView method readjusts the scrollbar thumb if necessary. The ABC Templates override the
BrowseClass.ResetFromView method to recalculate totals if needed.
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()
180 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
A hexadecimal scrollevent value of EVENT:ScrollTop scrolls to the first list item. A value of
EVENT:ScrollBottom scrolls to the last list item. Corresponding scroll event EQUATEs are declared in
EQUATES.CLW:
EVENT:ScrollTop EQUATE (07H)
EVENT:ScrollBottom EQUATE (08H)
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
A hexadecimal scrollevent value of EVENT:PageUp scrolls up one page of browse list items. A value of
EVENT:PageDown scrolls down one page of browse list items. Corresponding scroll event EQUATEs are
declared in EQUATES.CLW:
EVENT:PageUp EQUATE (05H)
EVENT:PageDown EQUATE (06H)
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.
Implementation: The BrowseClass.SetAlerts method alerts the mouse DOUBLE-CLICK, the INSERT, DELETE and
CTRL+ENTER keys for the browse's list control and calls the LocaorClass.SetAlerts method for each
associated locator control. Corresponding keycode EQUATEs are declared in KEYCODES.CLW.
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
188 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.
Implementation: The BrowseClass.Fetch and BrowseClass.Ask methods call the SetQueueRecord method.
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 191
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: The WindowManager.TakeEvent method calls the TakeEvent method. The TakeEvent method calls the
TakeScroll or TakeKey method as appropriate.
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: TakeKey returns one (1) if any action is taken, otherwise it returns zero (0).
The TakeEvent method calls the TakeKey method as appropriate. The BrowseClass.TakeKey method
calls the Locator.TakeKey method as appropriate.
Example:
IF FIELD() = ?MyBrowseList !focus on browse list
IF EVENT() EVENT:AlertKey !if alerted keystroke
MyBrowse.TakeKey !BrowseClass object handles it
END
END
Implementation: TakeNewSelection returns one (1) if a window redraw is needed, otherwise it returns zero (0).
The TakeEvent method calls the TakeNewSelection method when appropriate. The
BrowseClass.TakeNewSelection method calls the appropriate Locator.TakeNewSelection method.
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
194 ABC Library Reference
Implementation: A scrollevent value of EVENT:ScrollUp scrolls up one item; EVENT:ScrollDown scrolls down one item;
EVENT:PageUp scrolls up one page; EVENT:PageDown scrolls down one page; EVENT:ScrollTop
scrolls to the first list item; EVENT:ScrollBottom scrolls to the last list item. Corresponding scrollevent
EQUATEs are declared in EQUATES.CLW.
EVENT:ScrollUp EQUATE (03H)
EVENT:ScrollDown EQUATE (04H)
EVENT:PageUp EQUATE (05H)
EVENT:PageDown EQUATE (06H)
EVENT:ScrollTop EQUATE (07H)
EVENT:ScrollBottom EQUATE (08H)
The TakeScroll method calls the ScrollEnd, ScrollOne, or ScrollPage method as needed.
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
200 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 201
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.
Imlementation: The UpdateViewRecord method uses WATCH and REGET to implement optimistic concurrency
checking; see the Language Reference for more information.
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
202 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
BrowseClass 203
204 ABC Library Reference
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 object uses this property to enable or disable a toolbar control.
Implementation: The BrowseToolbarClass.Init method sets the value of the Window property.
BrowseToolbarClass Methods
Init(WindowManager, BrowseClass)
InitMisc(history, help)
ResetButton Sync Toolbar control properties with its corresponding Browse control.
toolbutton An integer constant, variable, EQUATE, or expression that identifies a particular
toolbar control.
browsebutton An integer constant, variable, EQUATE, or expression that identifies a specific
browse control.
The ResetButton method enables/disables, hides/unhides a toolbar control based on the current properties of its
corresponding browse control.
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.
The BufferedPairsClass is derived from the FieldPairsClass. The BrowseClass, ViewManager, and RelationManager use
the FieldPairsClass and BufferedPairsClass to accomplish various tasks.
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.
Implementation: During initialization, the BufferedPairsClass initialization 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.
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
220 ABC Library Reference
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.
BufferedPairsClass 221
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
Fields &= NEW BufferedPairsClass !instantiate BufferedPairs object
Fields.Init !initialize BufferedPairs 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
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.
ConstantClass 231
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).
232 ABC Library Reference
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
ConstantClass 235
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:
Term:Ushort The GROUP declares a USHORT containing the item count--stops reading when item
count reached.
Term:Byte The GROUP declares a BYTE containing the item count--stops reading when item count
reached.
Term:EndGroup The GROUP does not declare an item count—stops reading at end of GROUP structure.
Term:FieldValue The GROUP does not declare an item count—stops reading when it finds the
TerminatorValue within the constant data.
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)
!Describe constant structure and variables to accept the values
Const.AddItem(ConstType:PString, LangQ.Repl)
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
240 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
ConstantClass 243
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 |)
Allowpromptflag An integer constant, variable, EQUATE, or expression that specifies whether the report will
prompt for runtime parameter fields. A value of one (1) is used to allow prompting; a value of zero
(0) is used to disallow field prompting.
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)
246 ABC Library Reference
CanDrillDown(| candrilldown |)
candrilldown An integer constant, variable, EQUATE, or expression that specifies whether the report make use
of Crystal‘s drill down feature. A value of one (1) allows drill down to be used; a value of zero (0)
removes the ability to drill down.
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 247
HasCancelButton (| hascancelbutton |)
hascancelbutton An integer constant, variable, EQUATE, or expression that specifies whether a cancel button will
appear on the report‘s preview window. A value of one (1) displays the cancel button; a value of
zero (0) does not display the cancel button.
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)
248 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 249
HasExportButton (| hasexportbutton |)
hasexportbutton An integer constant, variable, EQUATE, or expression that specifies whether an export button will
appear on the reports preview window. A value of one (1) displays the export button; a value of
zero (0) does not display the export button.
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)
250 ABC Library Reference
HasLaunchButton (| haslaunchbutton |)
HasLaunchButton Allow a launch button on the report preview window.
haslaunchbutton An integer constant, variable, EQUATE, or expression that specifies whether a launch button will
appear on the reports preview window. A value of one (1) displays the launch button; a value of
zero (0) does not display the launch button.
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 251
HasNavigationControls (| hasnavigationcontrols |)
hasnavigationcontrols An integer constant, variable, EQUATE, or expression that specifies whether the
navigation controls will appear on the report‘s preview window. A value of one (1)
displays the navigation controls; a value of zero (0) does not display the navigation
controls.
The HasNavigationControls method is used to optionally display navigation controls on the report preview
window. This method returns a BYTE representing the value of hasnavigationcontrols. Navigation controls are
used to navigate through a report, immediately to the beginning, end or anywhere in between.
Example:
oCrystal8.HasNavigationControls(1)
252 ABC Library Reference
HasPrintButton (| hasprintbutton |)
Hasprintbutton An integer constant, variable, EQUATE, or expression that specifies whether a print button will
appear on the report‘s preview window. A value of one (1) displays the print button; a value of
zero (0) does not display the print button.
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 253
HasPrintSetupButton (| hasprintsetupbutton |)
hasprintsetupbutton An integer constant, variable, EQUATE, or expression that specifies whether a print setup button
will appear on the reports preview window. A value of one (1) displays the print setup button; a
value of zero (0) does not display the print setup button.
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)
254 ABC Library Reference
HasProgressControls (| hasprogresscontrols |)
Hasprogresscontrols An integer constant, variable, EQUATE, or expression that specifies whether the progress
controls will appear on the reports preview window. A value of one (1) displays the progress
controls; a value of zero (0) does not display the progress controls.
The HasProgressControls method is used to optionally display progress controls on the report preview window.
This method returns a BYTE representing the value of hasprogresscontrol. The Progress controls display the
progress of the report when it is running. It displays records read, records selected, etc.).
Example:
oCrystal8.HasProgressControls(1)
Crystal8Class 255
HasRefreshButton (| hasrefreshbutton |)
hasrefreshbutton An integer constant, variable, EQUATE, or expression that specifies whether a refresh button will
appear on the report‘s preview window. A value of one (1) displays the refresh button; a value of
zero (0) does not display the refresh button.
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)
256 ABC Library Reference
HasSearchButton (| hassearchbutton |)
hassearchbutton An integer constant, variable, EQUATE, or expression that specifies whether a search button will
appear on the reports preview window. A value of one (1) displays the search button; a value of
zero (0) does not display the search button.
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 257
HasZoomControl (| haszoomcontrol |)
haszoomcontrol An integer constant, variable, EQUATE, or expression that specifies whether a zoom button will
appear on the report‘s preview window. A value of one (1) displays the zoom control; a value of
zero (0) does not display the zoom control.
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)
258 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 259
Kill
The Kill method shuts down the Crystal8 object, releasing any memory allocated durring the lifetime of the object.
Example:
oCrystal8.Kill()
260 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.
initstate A string constant, variable, EQUATE, or expression containing an N, M, or I. Use N (Normal) to display
the preview window at the default size. Use M (Maximized) to display the preview window in a maximized
state. Use I (Iconized) to display the preview window in an iconized state. This parameter is optional.
frame A string constant, variable, EQUATE, or expression containing an S, D, R, or N. Use S to give the preview
window a single pixel frame. Use D to give the preview window a thick frame. Use R to give the preview
window a thick but resizeable frame. Use N to give the preview window no frame under Windows 3.1 or a
single pixel frame under Window 95/98. This parameter is optional.
icon A string constant, variable, EQUATE, or expression containing an icon filename. By specifiying an icon
file, a minimize button is automatically placed on the preview window. 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 )
262 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 |)
Formulastring A string constant, variable, EQUATE, or expression containing the Crystal formula. This
parameter is optional.
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 |)
showdocumenttips An integer constant, variable, EQUATE, or expression that specifies whether to enable tooltips on
the document in the report preview window. A value of one (1) indicates that tooltips will be
shown. A value of zero (0) indicates that tooltips will not be displayed on the document in the
preview window. This is the default if the parameter is omitted.
The ShowDocumentTips method is used to enable tooltips on the document being previewed in the report
preview window. This method returns a BYTE representing the value of showdocumenttips.
Example:
oCrystal8.ShowDocumentTips(1)
Crystal8Class 265
ShowReportControls (| showreportcontrols |)
showreportcontrols An integer constant, variable, EQUATE, or expression that specifies whether the print controls
are displayed. A value of one (1) will cause the print controls to be displayed. A value of zero (0)
indicates that will hide the print controls. This parameter is optional and defaults to TRUE if
omitted.
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)
266 ABC Library Reference
ShowToolbarTips(| showtooltips |)
showtooltips An integer constant, variable, EQUATE, or expression that specifies whether to enable tooltips on
the toolbar in the report preview window. A value of one (1) indicates that tooltips will be shown.
This is the default if the parameter is omitted. A value of zero (0) indicates that tooltips will not be
displayed in the report preview window.
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)
Crystal8Class 267
268 ABC Library Reference
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.
270 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 271
ChangeFontStyle(fontstyle)
fontstyle An integer constant, variable, EQUATE, or expression that contains a value that
represents a fontstyle. Valid fontstyle equates can be found in EQUATES.CLW.
The ChangeFontStyle method is used to set the current font style. The style of a font represents the strike weight and
style of the font.
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
272 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 273
Example:
oRTF_RTFTextBox.Cut() !Cut text to clipboard
findtext A string constant, variable, EQUATE, or expression containing the text for search
for. If this is omitted the Find dialog is presented.
The Find method is used to search the Rich Text field for the text specified in findtext. If no findtext is specified, the Find
dialog is presented. The user can type in the text to search for as well as specify other search options such as Whoe
Words Only, Case Sensitive Search, and Search Direction (up or down).
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
274 ABC Library Reference
FlatButtons(buttonstatus)
FlatButtons Set the FormatBar and Toolbar buttons to appear in a flat or raised mode.
Example:
oRTF_RTFTextBox.FlatButtons(1 ) !Flat buttons
oRTF_RTFTextBox.FlatButtons(0 ) !Raised buttons
cwRTFClass 275
fontsize An integer constant containing the size (in points) of the font.
fontcolor An integer constant containing the red, green, and blue values for the color of the
font in the low-order three bytes, for an EQUATE for a standard Windows color
value.
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()
276 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.
startpos An integer constant or variable that specifies the starting character position to
copy text from.
endpos An integer constant or variable that specifies the ending character position to
copy text from.
The GetText method is used to copy the specified text to a string or variable. The method can return a result that
specifies the length (number of characters) of the copied text.
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 )
278 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 279
Kill([isdirty])
isdirty A numeric constant, variable, EQUATE, or expression that indicates whether the
rich text control's modified data should be saved to disk.
The Kill method shuts down the cwRTF object, releasing any memory allocated during the life of the obejct. Passing a
one (1 or True) value to this method will force the modified data to be saved upon termination of the method; a value of
zero (0 or False) will not save the modified data to the table.
Example:
oRTF_RTFTextBox.Kill( TRUE )
LeftIndent(indentsize)
indentsize A REAL numeric constant, variable, or expression that indicates the number of
inches to indent. A negative value will reverse the indent.
The LeftIndent method is used to indent the current or selected paragraph. The indentation size is specified in inches and
may also be a negative number to reverse the indentation.
Example:
oRTF_RTFTextBox.LeftIndent(.5) !Indent 1/2 inch from left
280 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 281
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()
offsetsize A REAL numeric constant, variable, or expression that indicates the number of
inches to offset. A negative value will reverse the offset.
The Offset method is used to offset the second and subsequent lines of the current or selected paragraph. The offsetsize
is specified in inches and may also be a negative number to reverse the offset.
Example:
oRTF_RTFTextBox.Offset(1 ) !Offset by 1 inch
Example:
oRTF_RTFTextBox.PageSetup()
282 ABC Library Reference
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 283
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
284 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])
findtext A string constant, variable, EQUATE, or expression containing the text for search
for. If this is omitted the Find dialog is presented.
replacetext A string constant, variable, EQUATE, or expression containing the text for search
for. If this is omitted the Find dialog is presented.
The Replace method is used to do a Find and Replace search option within the rich text control. If the findtext and
replacetext parameters are omitted the Find and Replace dialog will appear.
Example:
!Using Variables
loc:replace =oRTF_RTFTextBox.Replace(loc:find,loc:replace )
!Replace dialog
loc:replace =oRTF_RTFTextBox.Replace()
cwRTFClass 285
RightIndent(indentsize)
indentsize A REAL numeric constant, variable, or expression that indicates the number of
inches to indent. A negative value will reverse the indent.
The RightIndent method is used to indent the current or selected paragraph from the right side of the rich text control.
The indentation size is specified in inches and may also be a negative number to reverse the indentation.
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 )
286 ABC Library Reference
SaveFile(filename)
filename A string constant, variable, EQUATE, or expression containing the .RTF filename
to save the data to.
The SaveFile method is used to save rich text data to a .RTF file.
Example:
oRTF_RTFTextBox.SaveFile(loc:Filename )
oRTF_RTFTextBox.SaveFile('0101SS.RTF ' )
SelectText(startpos, endpos)
startpos An integer constant or variable that specifies the starting character position to
select text from.
endpos An integer constant or variable that specifies the ending character position to
select text from.
The SelectText method is used select a specific set of characters by character position. The text is highlighted when it is
selected.
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 287
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
288 ABC Library Reference
text A string constant or variable containing the text to place in the rich text control.
startpos An integer constant or variable that specifies the starting character position to
place the text to.
endpos An integer constant or variable that specifies the ending character position to to
place the text to.
The SetText method is used to place the text to a specified position within the a rich text control. The text to place comes
from the specified string or variable. If the start and end positions are not available the current cursor position is used.
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 289
ShowControl(showstate)
showstate A numeric constant, variable, EQUATE, or expression that indicates whether the
RTF control is displayed or hidden. A one (1 or True) unhides the control; a zero
(0 or False) hides the control.
The ShowControl method is used hide or unhide the RTF control. When hidden, the ruler bar is also hidden.
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
290 ABC Library Reference
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:
AddItem Adds fields to the columninfo structure so they can be monitored in the audit log
file.
filename A string constant, variable, EQUATE, or expression containing the label of the file
that is to be audited.
fieldname A string constant, variable, EQUATE, or expression containing the label of the
field that is to be audited.
fieldheader A string constant, variable, EQUATE, or expression containing the field header
(title) field that is to be audited. This is the column header that will appear in the
audit log file.
fieldpicture A string constant, variable, EQUATE, or expression containing the picture of the
field that is to be audited. This defines how the column in the audit log file will be
formatted.
The AddItem method maintains the ColumnInfo queue by updating it with field information needed to create and update
the log file.
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.
DbAuditManager 297
OnChange Initiates an update to the audit log file after a Change to the file.
filename A string constant, variable, EQUATE, or expression containing the label of the file
that is to be audited.
file The label of the FILE being auditied.
The OnChange method initiates the update to the audit log file after a Change action.
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:
Implementation: The NameQueue structure is updated in the DbChangeManager.AddItem method. This queue
contains a pointer into the TriggerQueue.
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.
DbChangeManager 307
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)
SetThread Reads the TriggerQueue for the specified file and current thread.
filename A string constant, variable, EQUATE, or expression containing the label of the file
that is audited.
The SetThread method reads the TriggerQueue for the specified file and current thread. If a matching entry is found in
the queue a one (1 or True) is returned; if an entry is not found in the TriggerQueue a zero (0 or False) is returned.
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.
312 ABC Library Reference
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.
EditClass 315
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.
If you use custom (Configure EditInPlace) edit-in-place behavior, the BrowseUpdateButtons template generates the
code to instantiate the requested object (derived from the EditClass) and register the object with the BrowseClass object.
The BrowseClass object then calls the registered EditClass object's methods as needed. See Control Templates--
BrowseUpdateButtons for more information.
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
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
318 ABC Library Reference
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)
SELF.Feq{PROP:Text}='Hide ' !set EIP check box text
SELF.Feq{PROP:Value,1}='Y' !set EIP check box true value
SELF.Feq{PROP:Value,2}='N' !set EIP check box false value
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
SetReadOnly The SetReadOnly method places the edit-in-place control in a read-only state.
state An integer constant, variable, EQUATE, or expression that indicates whether to
disable a droplist control's dropdown button. A value of one (1 or True) disables the
button. A value of zero (0 or False) has no effect on the control.
Implementation: The SetReadOnly method uses PROP:ReadOnly to place the edit-in-place conrol in a read-only
state. After the parent call in the Init method of the EditInPlace object is the recommended place to
call SetReadonly.
Example:
EditInPlace::CUS:Number.SetReadOnly()
Implementation: The BrowseClass.AskRecord method calls the TakeEvent method. The TakeEvent method process
an EVENT:AlertKey for the edit-in-place control and returns a value indicating the user requested
action. The BrowseClass.AskRecord method carries out the user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABBROWSE.INC as
follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
END
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 EditClass is managed by the BrowseEIPManagerClass. The BrowseEIPManagerClass depends on the EditClass
operating according to it's documented specifications; however, the EditClass may be called by non-BrowseClass
procedures and objects.
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.
Note: The EditSpinClass requires values for PROP:RangeLow, PROP:RangeHigh, and PROP:Step to function
correctly. The EditSpinClass.Init method is the proper place to set these properties. See SPIN in the
Language Reference for more information.
PROGRAM
_ABCDllMode_ EQUATE(0)
_ABCLinkMode_ EQUATE(1)
INCLUDE('ABWINDOW.INC'),ONCE
INCLUDE('ABEIP.CLW'),ONCE
INCLUDE('ABBROWSE.CLW'),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
ViewActions VIEW(Actions)
END
ActQ QUEUE
ACT:Action LIKE(ACT:Action)
ACT:Priority LIKE(ACT:Priority)
ACT:Completed LIKE(ACT:Completed)
ViewPosition STRING(1024)
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 = ?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()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Actions.Close
END
RETURN ReturnValue
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.
330 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
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
334 ABC Library Reference
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
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
CODE
PARENT.Init(FieldNumber,ListBox,UseVar)
SELF.Feq{PROP:Text}='Hide ' !set EIP check box text
SELF.Feq{PROP:Value,1}='Y' !set EIP check box true value
SELF.Feq{PROP:Value,2}='N' !set EIP check box false value
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 337
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
342 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 343
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
Implementation: The BrowseClass.AskRecord method calls the TakeEvent method. The TakeEvent method processes an
EVENT:AlertKey for the edit-in-place control. On EVENT:DroppingDown, TakeEvent invokes the
Windows color dialog and stores the color selection in the edited field specified by the Init method. Finally,
TakeEvent returns a value indicating the user requested action. The BrowseClass.AskRecord method
carries out the user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABBROWSE.INC as
follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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
348 ABC Library Reference
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
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.
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
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
350 ABC Library Reference
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
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
EditDropComboClass 351
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.
352 ABC Library Reference
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
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
PARENT.Init(FieldNumber,ListBox,UseVar)
SELF.Feq{PROP:From}='ENTRY|SPIN|TEXT|STRING'!set ControlType droplist choices
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 359
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
SetReadOnly The SetReadOnly method places the edit-in-place control in a read-only state.
state An integer constant, variable, EQUATE, or expression that indicates whether to
disable the droplist control's dropdown button. A value of one (1 or True) disables
the button. A value of zero (0 or False) has no effect on the control.
Implementation: The SetReadOnly method uses PROP:ReadOnly to place the edit-in-place conrol in a read-only
state. After the parent call in the Init method of the EditInPlace object is the recommended place to
call SetReadonly.
Example: EditInPlace::CUS:Number.SetReadOnly()
Implementation: The TakeEvent method is called by the WindowManager.TakeEvent method. The TakeEvent method
processes an EVENT:AlertKey for the edit-in-place control. TakeEvent returns a value indicating the
user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABEIP.INC as follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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).
EditEntryClass 365
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)
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)
366 ABC Library Reference
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
EditEntryClass 367
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
Relate:Property.Close
RETURN ReturnValue
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 369
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.
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
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
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.
378 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
Implementation: The BrowseClass.AskRecord method calls the TakeEvent method. The TakeEvent method
processes an EVENT:AlertKey for the edit-in-place control. On EVENT:DroppingDown, TakeEvent
invokes the Windows file dialog and stores the pathname selection in the edited field specified by the
Init method. Finally, TakeEvent returns a value indicating the user requested action. The
BrowseClass.AskRecord method carries out the user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABBROWSE.INC as
follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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
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
386 ABC Library Reference
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
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)
EditFontClass 387
Relate:Property.Init PROCEDURE
CODE
Access:Property.Init
PARENT.Init(Access:Property,1)
Relate:Property.Kill PROCEDURE
CODE
Access:Property.Kill
PARENT.Kill
388 ABC Library Reference
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
Implementation: The BrowseClass.AskRecord method calls the TakeEvent method. The TakeEvent method
processes an EVENT:AlertKey for the edit-in-place control. On EVENT:DroppingDown, TakeEvent
invokes the Windows font dialog and stores the font specification in the edited field specified by the
Init method. Finally, TakeEvent returns a value indicating the user requested action. The
BrowseClass.AskRecord method carries out the user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABEIP.INC as follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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.
_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
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
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
396 ABC Library Reference
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
Relate:Property.Init PROCEDURE
CODE
Access:Property.Init
PARENT.Init(Access:Property,1)
Relate:Property.Kill PROCEDURE
CODE
Access:Property.Kill
PARENT.Kill
398 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 399
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.
AddValue Primes the Available and Selected items lists in the MultiSelect dialog.
item A string constant, variable, EQUATE, or expression that contains the value to
add to the item list.
selected An integer constant, variable, EQUATE, or expression that indicates which list to
update. A value of zero (0 or False) adds the item to the Available Items list; a
value of one (1 or True) adds the item to the Selected Items list. If omitted,
selected defaults to zero and AddValue adds the item to the Available Items list.
The AddValue method primes the Available and Selected items lists in the MultiSelect dialog.
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
402 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.
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
404 ABC Library Reference
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]
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=''
Implementation: The BrowseClass.AskRecord method calls the TakeEvent method. The TakeEvent method
processes an EVENT:AlertKey for the edit-in-place control. On EVENT:DroppingDown, TakeEvent
invokes the MultiSelect dialog. Finally, TakeEvent returns a value indicating the user requested
action. The BrowseClass.AskRecord method carries out the user requested action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABEIP.INC as follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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
406 ABC Library Reference
EditTextClass 407
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.
408 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
Implementation: The EIPManager.TakeFieldEvent method calls the TakeEvent method. The TakeEvent method
processes an EVENT:AlertKey for the edit-in-place control. On EVENT:DroppingDown, TakeEvent
invokes a Windwo with a text control. Finally, TakeEvent returns a value indicating the user requested
action.
Corresponding EQUATEs for the possible edit-in-place actions are declared in ABEIP.INC as follows:
EditAction ITEMIZE(0),PRE
None EQUATE ! no action
Forward EQUATE ! next field
Backward EQUATE ! previous field
Complete EQUATE ! OK
Cancel EQUATE ! cancel
Next EQUATE ! next record
Previous EQUATE ! previous record
Ignore EQUATE ! no action
END
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.
BrowseClass
Each BrowseClass utilizing edit-in-place requires an BrowseEIPManager to manage the events and processes that are
used by each edit-in-place field in the browse.
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.
414 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
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
416 ABC Library Reference
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
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
EIPManagerClass 417
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 EQ property should be treated as a PROTECTED property except during initialization.
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.
Note: The FocusLoss property should be treated as a PROTECTED property except during initialization.
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.
Note: The ListControl property should be treated as a PROTECTED property except during initialization.
Implementation: The LastColumn method is assigned the value of the Column property in the ResetColumn method.
422 ABC Library Reference
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.
AutoFree A numeric constant, variable, EQUATE, or expression that indicates whether the
BrowseClass.Kill method DISPOSEs of the editclass object. A zero (0) value
leaves the object intact. A non-zero value DISPOSEs the object.
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.
Implementation: The InitControls and BrowseClass.AddEditControl methods call the AddControl method. The
BrowseClass.AddEditControl method defines the editclass for a column not utilizing the default editclass.
The AddControl method ADDs a record containing the values of EditClass, Column, and AutoFree, to the
EditQueue which is declared in ABEdit.INC as follows:
EditQueue QUEUE,TYPE
Field UNSIGNED
FreeUp BYTE
Control &EditClass
END
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 clicks
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)
SetColumnEditType(ColumnNumber,<EditClass>)
ColumnNumber An integer constant or variable that contains the column number to process.
EditClass The label of the EditClass. If omitted, the specified columnnumber is disabled for EIP operations.
SetColumnEditType allows you to change the EditClass used for a column at runtime. If the EditClass parameter is
omitted, then that column will be disabled on EIP actions.
Implementation: SetColumnEditType should be called prior to the BrowseClass AskRecord parent call.
Example:
BRW1.AskRecord PROCEDURE(BYTE Request)
ReturnValue BYTE,AUTO
CODE
IF GLO:AccessLevel < Level:Supervisor !If not a supervisor
self.eip.SetColumnEditType(1) !Disable edit of 1st column
ELSE
!for docs only (not really needed here):
self.eip.SetColumnEditType(1,EditInPlace::PUB:PubID)
END
ReturnValue = PARENT.AskRecord(Request)
RETURN ReturnValue
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.
Implementation: The BrowseEIPManager.TakeCompleted method calls the TakeCompleted method via PARENT syntax.
TakeFocusLoss and TakeAction also call 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
TakeFieldEvent 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.
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
440 ABC Library Reference
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.
Implementation: TakeEvent and TakeFieldEvent methods conditionally call the TakeFocusLoss method.
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.
444 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
CODE
ThisWindow.Run() !run the window procedure
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.
By default, only the StepLocatorClass and FilterLocatorClass use the browseclass. The other locator
classes do not.
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.
In the first release (Clarion 6.0), the ErrorClass was changed to a THREADed Class. This change made it safe to be
used in a preemptive thread environment.
There are other possible designs that could have been used. Another approach that could have been taken would be to
add thread synchronization to the class. Yet another design approach is to divide the class into two classes: one class
contains thread dependent data and the other contains thread independent data. This is the design approach that has
been implemented in version 6.1.
If a class has some data that needs to be thread specific and other data that does not, there are several design options
that need to be considered.
For thread independent data, a solution is to add some kind of synchronization to the class (e.g., CriticalProcedure) in
order to prevent two different threads from accessing these values at the same time. Of course, care must be used in that
the data and scope where we use it should maintain this synchronization.
For the thread dependent data, one solution is to move the threaded data to a synchronized queue that stores the data,
using the thread number as the queue's key. Another solution (and the one used with Clarion 6.1) is to create a new class
(ErrorStatusClass) that is specifically used as a container for the thread dependent data. This second option is equivalent
to working with only one class (the ErrorClass) that has threaded and non-threaded parts. The thread dependent part will
create and destroy a new instance for each thread and the thread independent part stores the "thread independent ID" of
the thread dependent part so it can use it with the associated thread number in order to get the correct reference to the
threaded class for a specific thread.
Because any access to the threaded class parts will need to be done using some function that first retrieves the correct
class reference, the changes made in the ErrorClass for version 6.1 emulates this implementation, where all access to the
key property attributes are now done through an associated pair of GETpropertyname and SETpropertyname methods,
where propertyname is the property that is affected.
Sometimes these GET/SET methods are used to wrap the synchronized object, and other times they control the access to
the specific threaded class‘ properties or queues.
Also, these changes to the ErrorClass simplify its use in multi DLL applications, because the global ErrorClass is
consistent for each thread, and synchronization is straightforward.
454 ABC Library Reference
Also, this change maintains the ability to customize errors in only one place and use them throughout the application. A
single queue is used to store the error list, so extra memory is not required by additional threads. All methods are
declared in the non-threaded class, so only a single instance of these methods is loaded in memory. Access to the global
class is implemented in such a way that the addition of the synchronization methods will not slow down the application‘s
performance.
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 455
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 457
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.
458 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 459
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.
This property is private, but can be accessed through the SetDefaultCategory and GetDefaultCategory methods.
See Also:
ErrorClass.Init, ErrorClass.SetCategory, ErrorClass.GetCategory, SetDefaultCategory, GetDefaultCategory
460 ABC Library Reference
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.
Implementation: Errors is a reference to a queue declared in ABERROR.INC as follows. For each recognized error, the
Errors property includes an ID number, error message text, window title text, and a severity indicator.
ErrorEntry QUEUE,TYPE !List of all error definitions
Id USHORT !Error message identifier
Message &STRING !Message text
Title &STRING !Error window caption bar text
Fatality BYTE !Severity of error
END
This property is now private, and is set through the SetHistoryResetOnView and GetHistoryResetOnView ErrorClass
methods.
This property is now private, and is set through the SetHistoryThreshold and GetHistoryThreshold methods.
Use the following equates to set the error level. You can also set this property in the Application Generator Global Classes
dialog:
Level:Benign no action, returns Level:Benign
Level:User displays message, returns Level:Benign or Level:Cancel
Level:Notify displays message, returns Level:Benign
Level:Fatal displays message, halts the program
Level:Program treated as Level:Fatal
Level:Cancel used to confirm no action taken by User
This property is now private, and is set through the SetHistoryViewLevel and GetHistoryViewLevel methods.
This property is now private, and is set through the SetLogErrors and GetLogErrors methods.
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.
This property is now private, and is set through the SetSilent and GetSilent methods.
464 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
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 erro rs
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] )
GetFieldName Returns the name of the field that produced the error.
GetFieldName returns the name of the file that produced the error. The SetField method sets the value of the
ErrorStatusGroup FieldName private property. The FieldName value then replaces any %Field symbols within the error
message text.
GetFileName Returns the name of the file that produced the error.
GetFileName returns the name of the file that produced the error. The SetFile and ThrowFile methods both set the value
of the ErrorStatusGroup FileName private property. The FileName value then replaces any %File symbols within the
error message text.
GetHistoryResetOnView Retrieves the current status of clearing the error history on view.
If the value returned is one (1 or True), this indicates that the History structure will be reset after each error is
viewed. If the value returned is zero (0 or False) this indicates that the errors are queued in the History structure
after viewing.
GetHistoryThreshold retrieves the value of the of the ErrorClass private property, which sets the number of
items to store in the error log file.
A value of -1 keeps all errors. A value of 0 means the error history logging is currently off.
GetHistoryViewLevel Returns the active error level set for error history viewing.
This value is used to set the error level that will trigger error history viewing. This value is only valid if the
HistoryThreshold property is set to any value other than 0.
GetKeyName Returns the name of the key that produced the error.
GetKeyName returns the name of the key that produced the error. The SetKey method sets the value of the
ErrorStatusGroup KeyName private property. The KeyName value then replaces any %Key symbols within the error
message text.
A value of one (1 or True) means that error logging is active. A value of zero (0 or False) means that error logging
is inactive (off).
GetMessageText returns the text to substitute for any %Message symbols within the error message text. This value then
replaces any %Message symbols within the error message text.
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.
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.
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
476 ABC Library Reference
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 if 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.
ErrorClass 479
SetCategory([id], category)
The SetCateogry method sets the error category in the ErrorEntry structure. If the id is omitted the DefaultCategory is
used.
The SetCategory method sets the default error category contained in the property.
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
SetFieldName Sets the name of the field that replaces any %Field symbols within the active error message text.
fieldname A STRING constant, variable, EQUATE, or expression that sets the field name to use in the current error
message text.
The fieldname value replaces any %Field symbols within the current error message text.
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
SetFileName Sets the name of the file that replaces any %File symbols within the active error message text.
filename A STRING constant, variable, EQUATE, or expression that sets the file name to use in the current error
message text.
The filename value replaces any %File symbols within the current error message text.
flag An integer constant, variable, EQUATE, or expression that sets the current reset status of
the error history view.
The flag value determines if the error history view structure should be cleared upon viewing an error message. If
flag is set to one (1 or True), the History structure will be reset after each error is viewed. Setting flag to zero (0 or
False) will cause the errors to be queued in the History structure.
number An integer constant, variable, EQUATE, or expression that sets the number of items to store in the error
log file.
SetHistoryThreshold sets the value of the ErrorClass private property, which sets the number of items to store in
the error log file.
Setting the number to -1 keeps all errors. Setting number to 0 switches off error history logging.
errorlevel An integer constant, variable, EQUATE, or expression that sets the current error level of error
history.
The errorlevel value sets the error level for viewing error history. The errorlevel value is only valid if the property
is set to any value other than 0. Valid errorlevels are as follows:
Activating this property will pop up a list box of error messages when the designated error level is posted.
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
SetKeyName Sets the name of the key that replaces any %key symbols within the active error message text.
keyname A STRING constant, variable, EQUATE, or expression that sets the key name to use in the current error
message text.
The keyname value replaces any %Key symbols within the current error message text.
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
flag An integer constant, variable, EQUATE, or expression that sets the current status of error logging.
The flag value turns the error history logging on or off. Setting this value to one (1 or True) turns on the error
logging. Setting this value to zero (0 or False) turns off the error logging.
A file with the name ―ABCErrors.Log‖ will be generated in the program folder.
Example:
GlobalErrors.Msg PROCEDURE(STRING Txt,<STRING Caption>,<STRING Icon>,|
LONG Buttons = Button:Ok,LONG DefaultButton = 0,LONG Style = 0)
ReturnValue LONG,AUTO
CODE
SELF.SetLogErrors(TRUE) !Turn on Error Logging
SELF.SetSilent(TRUE)
ReturnValue = PARENT.Msg(Txt,Caption,Icon,Buttons,DefaultButton,Style)
RETURN ReturnValue
SetMessageText Sets the message text that replaces any %Message symbols within the active error message
text.
message A STRING constant, variable, EQUATE, or expression that sets the message text to use in the
current error message text.
The message value replaces any %Message symbols within the current error message text. The ThrowMessage method
sets the value of the MessageText property. The MessageText value then replaces any %Message symbols within the
error message text.
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')
flag An integer constant, variable, EQUATE, or expression that sets the status of the Silent property.
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.
Example:
GlobalErrors.Msg PROCEDURE(STRING Txt,<STRING Caption>,<STRING Icon>,|
LONG Buttons = Button:Ok,LONG DefaultButton = 0,LONG Style = 0)
ReturnValue LONG,AUTO
CODE
SELF.SetLogErrors(TRUE) !Turn on Error Logging
SELF.SetSilent(TRUE) !Set Error Logging to Silent Mode
ReturnValue = PARENT.Msg(Txt,Caption,Icon,Buttons,DefaultButton,Style)
RETURN ReturnValue
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:
See Also: Errors, SetErrors, TakeBenign, TakeNotify, TakeUser, TakeFatal, TakeProgram, TakeOther, Throw
496 ABC Library Reference
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.
504 ABC Library Reference
ErrorLogInterface 505
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.
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).
510 ABC Library Reference
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. Let's assume you have a Customer file declared as:
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)
Zip DECIMAL(5)
END
END
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
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
518 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.
The current implementation of the FileDropComboClass is a place-holder implementation. In the future the
FileDropComboClass, or its replacement, will be derived from the BrowseClass.
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.
524 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 derived FileDropComboClass is local to the procedure, is specific to a single FileDropCombo and relies on the global
ErrorClass object and the file-specific RelationManager and FileManager objects for the displayed lookup file.
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
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
FileDropComboClass 525
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)
526 ABC Library Reference
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
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)
FileDropComboClass 527
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.
Implementation: The RemoveDuplicatesFlag is set by the ABC templates when the FileDropCombo control template is
used. The 'Remove Duplicates' checkbox controls this setting.
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
FileDropComboClass 533
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.
FileDropComboClass 535
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.
FileDropComboClass 537
ResetFromItem(ItemNumber)
ResetFromItem Locates the search value within the first field of the display queue.
ItemNumber A string constant, variable, EQUATE, or expression containing the position of the target list box
item.
The ResetFromItem method resets the File Drop Combo‘s entry field value based on the current record in the
FileDropCombo list control. The target item in the list control is also selected.
If the ItemNumber is a negative value it will select and display the top item in the list box. If the ItemNumber is greater
than the records in the queue, then it will select and display the last item in the list box. If ItemNumber is zero (0), the top
of the list is selected and populated in the entry control.
Implementation: The ResetFromItem method ideally can be called by the FileDropComboClass.TakeEvent method and
the FileDropComboClass.TakeNewSelection method.
Implementation: The ResetFromList method is called by the FileDropComboClass.TakeAccepted method and the
FileDropComboClass.TakeNewSelection method.
See Also:
FileDropComboClass.TakeAccepted, FileDropComboClass.TakeNewSelection
538 ABC Library Reference
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.
FileDropComboClass 539
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the FileDropComboClass object.
Implementation: The WindowManager.TakeEvent method calls the TakeEvent method. On a new item selection, the
TakeEvent method calls the TakeNewSelection method.
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.
Implementation: The UniquePosition method is called by the FileDropComboClass.AddRecord method which checks for
duplicate values before adding the record to the filedropcombo's queue.
FileDropClass
FileDropClass Overview
Future FileDropClasses
The current implementation of the FileDropClass is a place-holder implementation. In the future the FileDropClass, or its
replacement, will be derived from the BrowseClass.
FileDropClass Concepts
The FileDropClass is a ViewManager that supports a file-loaded scrollable list on a window. By convention, a FileDrop
provides a "pick list" for the end user. A pick list is a finite list of mutually exclusive or alternative choices--the end user
may choose only one of several items, but need not memorize the choices, because all the choices are displayed.
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.
544 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)
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
FileDropClass 545
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)
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
546 ABC Library Reference
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)
FileDropClass 547
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
I These methods are inherited from the ViewManager Class.
V These methods are also virtual.
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)
550 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
Implementation: The TakeAccepted method is a placeholder for the derived FileDropComboClass. The
FileDropClass.TakeEvent calls the TakeAccepted method.
TakeEvent, VIRTUAL
The TakeEvent method processes the current ACCEPT loop event for the FileDropClass object.
Implementation: The WindowManager.TakeEvent method calls the TakeEvent method. The TakeEvent method calls the
TakeNewSelection method.
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.
560 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.
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
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
562 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 autoinc key
SELF.AddKey(CLI:NameKey,'Client Name') !describe another key
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.
564 ABC Library Reference
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.
The RestoreBuffer method releases memory allocated by the SaveBuffer method. Therefore, to prevent a
memory leak, each call to SaveBuffer should be paired with a corresponding call to RestoreBuffer.
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.
StopOperation BYTE
The StopOperation property contains a value that tells the file driver how to perform the next file operation. See the
Advanced Topics Reference Guide for more information on the FileCallBackInterface.
Implementation: The FunctionCalled method sets the StopOperation property to a value of FALSE (0).
The PreCreate, PreDelete, PreFetch, PreInsert, and PreUpdate methods can set this property to TRUE if
the file driver should not continue processing the operation.
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.
572 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
GetName return the name of the file
SetName set the file name
SaveBuffer save the current record buffer contents
RestoreBuffer restore previously saved buffer contents
SaveFile save the current file state
RestoreFile restore a previously saved file state
UseFile open a LazyOpen file
AddKey describe the soft KEYs
FileManager 573
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)
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
578 ABC Library Reference
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
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
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
580 ABC Library Reference
Implementation: The Close method returns a value of Level:Benign (EQUATE declared in ABERROR.INC). See Error
Class for more information on Level:Benign and other severity levels.
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
Access:Client.CancelPrimeAutoInc !restore the file
CYCLE !and start over
END
END
!more code
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.
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
586 ABC Library Reference
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)
FileManager 589
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
590 ABC Library Reference
|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
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 591
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
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.
Implementation: If Insert succeeds, it returns Level:Benign (declared in ABERROR.INC). If it fails, it returns the severity
level of the last 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(@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 597
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.
Implementation: If Next 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 get the next record. See Error Class for more
information on severity levels.
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
PostCreatePostDelete Returns confirmation that valid dictionary trigger activity has occurred after createdelete action,
and optionally sets an error code and message to be processed.
ErrCode An 80 character cstringA string constant, variable, EQUATE, or expression that can be set torepresents
an error code.
ErrMsg A 255 character cstring that can be set to an error message.
returncode Indicates if an error occurs.
The PostCreate 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 value to FALSE if any problem occurred in the post create trigger
activity code. When PostCreate 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 PostCreate method is accessible from a table‘s trigger properties located in the Dictionary Editor, or, in the Global
Embeds of a target application
Implementation: PostCreate 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 CREATE
action for a file.
Example:
CODE
!Push any pending errors on stack, to allow trigger error detection
PUSHERRORS()
ReturnValue = PARENT.PostCreate(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
PostFetch
PostInsert
PostUpdate
FileManager 601
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 An 80 character cstring that can be set to an error code.
ErrMsg A 255 character cstring that can be set tostring 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
PostCreate
PostFetch
602 ABC Library Reference
PostInsert
PostUpdate
FileManager 603
OpCode A SIGNED integer that indicates the type of record retrieval that was attempted.
Key The key that was used when retrieving the record.
Use the Equates provided in EQUATES.CLW (shown below) to test the OpCode.
DriverOp:ADD ADD(FILE)
DriverOp:Append APPEND(FILE)
DriverOP:AddLen ADD(FILE,LENGTH)
DriverOp:AppendLen APPEND(FILE,LENGTH)
DriverOp:GETfilekey GET(FILE,KEY)
DriverOp:GETfileptrlen GET(FILE,POINTER,LEN)
DriverOp:GETfileptr GET(FILE,POINTER)
DriverOp:GETkeyptr GET(KEY,POINTER)
DriverOp:REGETfile REGET(FILE,POSITION)
DriverOp:REGETkey REGET(FILE,POSITION)
DriverOp:Next NEXT(FILE)
DriverOp:Previous PREVIOUS(FILE)
The PostFetch method is accessible from a table‘s trigger properties located in the Dictionary Editor, or, in the Global
Embeds of a target application
Implementation: PostFetch 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 GET,
REGET, NEXT or PREVIOUS action for a file.
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 An 80 character cstring that can be set to an error code.
ErrMsg A 255 character cstring that can be set tostring 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
PostCreate
PostDelete
PostFetch
PostUpdate
FileManager 605
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 An 80 character cstringA string constant, variable, EQUATE, or expression that can be set torepresents
an error code.
ErrMsg A 255 character cstringstring constant, variable, EQUATE, or expression that can be set torepresents 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
PostCreatePostDelete
PostDelete
PostFetch
PostInsert
606 ABC Library Reference
PreCreate Returns confirmation that valid dictionary trigger activity has occurred before a create action is executed,
and optionally sets an error code and message to be processed.
ErrCode An 80 character cstring that can be set to an error code.
ErrMsg A 255 character cstring that can be set to an error message.
returncode Indicates if an error occurs.
The PreCreate method is a virtual method that returns a TRUE value by default if pre-create trigger activity was
processed normally. The developer must set the return value to FALSE if any problems occurred in the pre-create trigger
activity code. When PreCreate 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 PreCreate method can set SELF.StopOperation
to TRUE. If this is done the normal file operation will not be executed and ERRORCODE will be equal to the value it has
before returning from PreCreate.
The PreCreate method is accessible from a table‘s trigger properties located in the Dictionary Editor, or, in the Global
Embeds of a target application
Implementation: PreCreate 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.PreCreate(ErrCode,ErrMsg) !returns TRUE by defaul t
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PreDelete
PreFetch
PreInsert
PreUpdate
StopOperation
FileManager 607
PreCreatePreDelete 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 An 80 character cstringA string constant, variable, EQUATE, or expression that can be set torepresents
an error code.
ErrMsg A 255 character cstring that can be set tostring 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 valuelevel 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 can set
SELF.StopOperation to TRUE. If this is done the normal file operation will not be executed and ERRORCODE will be
equal to the value it has before returning from PreDelete.
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 defaul t
!trigger processing here – optionally set ErrCode, ErrMsg and ReturnValue
POPERRORS()
!restore errors saved on the stack
RETURN ReturnValue
PreDelete
PreFetch
Formatted: Indent: First line: 0"
PreInsert
PreUpdate
StopOperation
608 ABC Library Reference
PreFetch Returns confirmation that valid dictionary trigger activity has occurred before record retrieval action, and
optionally sets an error code and message to be processed.
OpCode A SIGNED integer that indicates the type of record retrieval that was attempted
Key The key that was used when retrieving the record.
Use the Equates provided in EQUATES.CLW (shown below) to test the OpCode.
DriverOp:ADD ADD(FILE)
DriverOp:Append APPEND(FILE)
DriverOP:AddLen ADD(FILE,LENGTH)
DriverOp:AppendLen APPEND(FILE,LENGTH)
DriverOp:GETfilekey GET(FILE,KEY)
DriverOp:GETfileptrlen GET(FILE,POINTER,LEN)
DriverOp:GETfileptr GET(FILE,POINTER)
DriverOp:GETkeyptr GET(KEY,POINTER)
DriverOp:REGETfile REGET(FILE,POSITION)
DriverOp:REGETkey REGET(FILE,POSITION)
DriverOp:Next NEXT(FILE)
DriverOp:Previous PREVIOUS(FILE)
The PreFetch method is accessible from a table‘s trigger properties located in the Dictionary Editor, or, in the Global
Embeds of a target application
Implementation: PreFetch 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 a GET, REGET,
NEXT or PREVIOUS action for a file.
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 An 80 character cstringA string constant, variable, EQUATE, or expression that can be set torepresents
an error code.
ErrMsg A 255 character cstringstring constant, variable, EQUATE, or expression that can be set torepresents 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 PreInsert method can set SELF.StopOperation to
TRUE. If this is done the normal file operation will not be executed and ERRORCODE will be equal to the value it has
before returning from PreInsert.
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.
PutLength An UNSIGNED integer that represents the number of bytes to write to the file when PUT
(File, Pointer, Length) is used.
ErrCode An 80 character cstringA string constant, variable, EQUATE, or expression that can be set torepresents
an error code.
ErrMsg A 255 character cstringstring constant, variable, EQUATE, or expression that can be set torepresents an
error message.
returncode Indicates if an error occurs.
returncode Indicates if an error occurs.
The PreUpdate method is a virtual method that returns a TRUE value by default if pre-update trigger activity was
processed normally. The developer must set the return level to FALSE if any problems occurred in the pre-update trigger
activity code. When PreUpdate 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 PreUpdate method can set SELF.StopOperation
to TRUE. If this is done the normal file operation will not be executed and ERRORCODE will be equal to the value it has
before returning from PreUpdate.
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
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.
Implementation: If Previous 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 get the previous record. See Error Class
for more information on severity levels.
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.
Implementation: The PrimeRecord method calls PrimeAutoInc if the file contains an autoincrementing key.
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)
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
FileManager 613
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'
FileManager 615
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
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 RestoreBuffer method releases memory allocated by the SaveBuffer method. Therefore, to prevent a
memory leak, each call to SaveBuffer should be paired with a corresponding call to RestoreBuffer. The
RestoreBuffer method retrieves and DISPOSEs the specified contents from the Buffers property.
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.
SaveBuffer allocates memory which is subsequently released by the RestoreBuffer method. Therefore, to
prevent a memory leak, each call to SaveBuffer should be paired with a corresponding call to
RestoreBuffer.
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)
FileManager 623
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
624 ABC Library Reference
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
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
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.
Implementation: TryPrevious tries to get the previous 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 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.
Implementation: TryPrimeAutoInc tries to prime 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 prime the
record. 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
IDKey KEY(CLI:ID),NOCASE,OPT,PRIMARY
Record RECORD,PRE()
ID LONG
Name STRING(20)
StateCode STRING(2)
END
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.
Implementation: TryUpdate tries to change 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 change the record. See
Error Class for more information on severity levels.
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.
Implementation: If Update 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 change the record. See Error Class for more
information on severity levels.
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.
The ValidateField and TryValidateField methods both call ValidateFieldServer to do their work, any global
editing functions added by deriving the FileManager Class should be placed in the ValidateFieldServer
method to assure that they will be executed by both the Validate and TryValidate methods.
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.
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:
644 ABC Library Reference
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)
ST:STATENAME LIKE(ST:STATENAME)
ViewPosition STRING(512)
END
CODE
ThisWindow.Run() !run the window procedure
FilterLocatorClass 645
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
FuzzyClass 649
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 651
Match(document, query)
query A string constant, variable, EQUATE, or expression that contains the value to
search on.
The Match method returns a value based on where an instance of the query is found within the document.
SetOption(whichoption, value)
whichoption An integer constant, variable, EQUATE, or expression that specifies which option
to set. The equates for these options are located in ABFUZZY.INC.
MatchOption:NoCase sets the Ignore Case option. MatchOption:WordOnly sets
the Word Only option.
value An integer constant, variable, EQUATE, or expression that specifies the value for
the option. A value of one (1 or True) will set the option on; a value of zero (0 or
False) will turn the option off. The default value is True.
The SetOption method logically sets one of the two options available for FuzzyMatching. These are Ignore Case and
Word Only. When Ignore Case is set the query is case insensitive. Word Only finds the query value only if it is a separate
word (denoted by a space directly before and directly after the text.
Example:
FuzzyMatcher.SetOption(MatchOption:NoCase, 1) !set for case insensitive search
FuzzyMatcher.SetOption(MatchOption:WordOnly, 0) !turn off word only search
652 ABC Library Reference
FormVCRClass 653
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.
654 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 655
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 AddToolbarTarget method registers a ToolbarTarget, such as a ToolbarListBoxClass object, as a potential target of a
ToolbarClass object.
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 AddToolbarTarget method registers a ToolbarTarget, such as a ToolbarListBoxClass object, as a potential target of a
ToolbarClass object.
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 657
FormVCRClass Methods:
AddToolbarTarget (set the FormVCR toolbar)
AddToolbarTarget( toolbar )
AddToolbarTarget Registers the FormVCR object as a potential target of the specified toolbar.
toolbar The label of the ToolbarClass object that directs toolbar events to this FormVCRClass object.
The AddToolbarTarget method registers the FormVCRClass 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 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
Implementation: The CheckBorders method is called from the UpdateWindow, ResetSort, TakeRequestChanged
methods, and set a number of private properties used to control the display state of the FormVCR
controls.
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
660 ABC Library Reference
Implementation: The GetAction method is called from the ToolbarFormVCRClass to detect an actionand enable/disable
buttons where appropriate.
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 661
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
662 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 663
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 BrowseClass.SetAlerts method alerts the INSERT, DELETE and CTRL+ENTER keys for the
browse's list control and calls the LocatorClass.SetAlerts method for each associated locator control.
Corresponding keycode EQUATEs are declared in KEYCODES.CLW.
664 ABC Library Reference
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.
Implementation: The WindowManager.TakeEvent method calls the TakeEvent method. The TakeEvent method calls the
TakeScroll or TakeKey method as appropriate.
668 ABC Library Reference
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.
Implementation: A scrollevent value of EVENT:ScrollUp scrolls back one item; EVENT:ScrollDown scrolls ahead one item;
EVENT:PageUp scrolls ahead one page; EVENT:PageDown scrolls back one page; EVENT:ScrollTop
scrolls to the first item; EVENT:ScrollBottom scrolls to the last item. Corresponding scrollevent EQUATEs
are declared in EQUATES.CLW.
EVENT:ScrollUp EQUATE (03H)
EVENT:ScrollDown EQUATE (04H)
EVENT:PageUp EQUATE (05H)
EVENT:PageDown EQUATE (06H)
EVENT:ScrollTop EQUATE (07H)
EVENT:ScrollBottom EQUATE (08H)
The TakeScroll method calls the ScrollEnd, ScrollOne, or ScrollPage method as needed.
FormVCRClass 669
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).
gShowDiagramName is used to determine where the diagram name information will be displayed in the graph control.
Diagram name (series name) is the label of each set of data points that you have defined for the graph control, with an
added ‗Diagram:‘ prompt.
gShowDiagramName 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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
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.
gShowDiagramNameV 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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
DiagramNameText, ShowOnField
GraphClass 675
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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
ToShowValues, ToolTip
676 ABC Library Reference
gShowMouseX is used to determine where mouse X coordinate information will be displayed in the graph control.
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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
ToShowValues, ToolTip
GraphClass 677
gShowMouseY is used to determine where mouse Y coordinate information will be displayed in the graph control.
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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
ToShowValues, ToolTip
678 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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
NodeText
GraphClass 679
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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
NodeNameText
680 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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
NodeValueText
GraphClass 681
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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
NodeXText
682 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.
eOnS A LONG integer Number of a zone of a status bar of a condition to show the text.
See Also:
NodeYText
GraphClass 683
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
CalcBestPositionNodeText Calculates the best position of the text used to describe the
selected node.
The CalcBestPositionNodeText method sets the best position of the node text to be displayed.
Implementation: The method is called if the eBestPositionNodeText property is set to TRUE. This property is set by
graph control‘s procedure template interface. Internally, each node in the graph stores the X and Y
position in a local queue.
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.
CalcGraph Calculates all positions, node values and cosmetic settings for a graph control.
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.
688 ABC Library Reference
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.
parBand A LONG that references the FEQ of the target detail band.
parBestFit A BYTE value that calculates a best fit when TRUE (Default is FALSE)
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.
NodeName The positional node name of the active graph control that is passed to the
drilldown graph control.
Xnode The positional X Node coordinate (in Physical Units) of the active graph control
that is passed to the drilldown graph control.
Ynode The positional Y Node coordinate (in Physical Units) of the active graph control
that is passed to the drilldown graph control.
The Drilldown method hides the current active graph control, and unhides the target (drilldown) graph control. The target
graph object‘s data points are calculated and drawn.
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 693
Implementation: The FindNearbyNodes method is called from the Interactivity method. It is also called in the
Drilldown method to accurately return the proper node id when the mouse is clicked.
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:
fieldequ An LONG integer that indicates the field equate label of the control the
text is to be retrieved.
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).
statuszone An LONG integer that indicates which status bar section the text is to be
retrieved from.
The GetValueFromStatusBar method is used to return the contents of a selected window‘s status bar zone 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.
Implementation: The Interactivity method calls several methods (FindNearbyNodes, SetSelectedNode and
ToShowValues) to gather node data. It is called during a MouseMove event.
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
NodeText Returns text of the active X and Y Node name and values.
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.
eventnumber A LONG value that passes the event number to the graph object
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: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.
Implementation: The PrintGraph method is called when graph events Event:Print, or Event:PrintBestFit are posted.
TakeEventOfParent
GraphClass 707
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
708 ABC Library Reference
ReturnFromDrilldown
Unhides, calculates and draws the original graph object
NodeID The positional node value of the drilldown graph control that is passed to the
active graph control.
NodeName The positional node name of the drilldown graph control that is passed to the
active graph control.
Xnode The positional X Node coordinate of the drilldown graph control that is passed to
the active graph control.
Ynode The positional Y Node coordinate of the drilldown graph control that is passed to
the active graph control.
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 709
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.
askSave A Boolean value that determines whether or not to prompt the user to save. The
default value is FALSE (save without asking)
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.
text A string constant or variable that contains the text to display on the control.
fieldequ An LONG integer that indicates the field equate label of the control the text is to
be displayed.
The ShowOnField method displays a text value into a given control, specified by its field equate (fieldequ). The control
must be a valid target (string, entry, text, or combo). Other types of controls are assigned the text value using the
PROP:Text property.
text A string constant or variable that contains the text to display on the status bar.
zone An LONG integer that indicates which status bar section the text is to be
displayed.
The ShowOnStatusBar method displays a text value into a given status bar zone, specified by zone.
Implementation: The ShowOnStatusBar method is called from the ToShowValues method. If a window has a
separate status bar defined, the eShowSBonFirstThread property determines the target.
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 713
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: This property is initialized in the GridClass.Init method. The QUEUE is loaded with data in
GridClass.CheckChildren which is a PRIVATE method.
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.
718 ABC Library Reference
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.
GridClass 719
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.
Implementation: The GetAcross method returns a value that is determined in the GridClass.GetDimensions PRIVATE
method.
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.
Implementation: The GridClass.TakeEvent method executes code that will post an EVENT:Accepted to
SELF.ClickPress, which is the value that this method returns.
GetDown( )
The GetDown method returns the number of GROUPs that fit into the designed listbox.
Implementation: The GetDown method returns a value that is determined in the GridClass.GetDimensions PRIVATE
method.
GetPosition Sets the XPosition and YPosition for the control instance.
instance A numeric constant, variable, EQUATE, or expression containing the control
number.
XPos An integer constant, variable, EQUATE, or expression that indicates the X
position of the specific GROUP control instance.
YPos An integer constant, variable, EQUATE, or expression that indicates the
Yposition of the specific GROUP control instance.
Implementation: The GetPosition method is called to set the X and Y positions of the GROUP control is created to
simulated the grid appearance. This control is created in the GridClass.CreateControls PRIVATE
method.
IfGroupField(field)
Implementation: This method is called by the GridClass.TakeEvent method when an event occurs on any control
defined as part of the BrowseGrid.
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.
HistHandlerClass 727
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.
rowindex An index used to determine information regarding the listbox and associated
history data.
colindex An index used to determine inforamtion regarding an actual error history record.
The VLBProc method returns various information regarding the LIST control and its data.
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.
OnChange Initiates an update to the audit log file after a Change to the file.
filename A string constant, variable, EQUATE, or expression containing the label of the file
that is to be audited.
file The label of the FILE being auditied.
The OnChange method initiates the update to the audit log file after a Change action.
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
IListControl Interface 735
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
736 ABC Library Reference
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
An IncrementalLocator is a multi-character locator, with no locator control required (but strongly recommended).
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.
IncrementalLocator Class 739
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:
The following example shows a typical sequence of statements to declare, instantiate, initialize, use, and terminate a
BrowseClass object and related objects, including a IncrementalLocatorClass 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
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.
742 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 743
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 ABC Templates generate code to instantiate a global INIClass object called INIMgr. If you request to Use INI file to
save and restore program settings in the Global Properties dialog, then each procedure based on the Window
procedure template (Frame, Browse, and Form) calls the INIMgr to save and restore its WINDOW's position and size.
INIClass 745
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
746 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
750 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
INIClass 751
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
INIClass 753
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
754 ABC Library Reference
| 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 occurred.
left,top
right,bottom A SHORT for each parameter identifying the respective boundaries of the page.
pagename A STRING variable or constant that identifies the name of the WMF file to be printed.
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.
760 ABC Library Reference
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.
762 ABC Library Reference
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.
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.
IReportGenerator Interface 765
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.
766 ABC Library Reference
Implementation: The strgrp group contains the position, alignment, styles, character set and other attributes of a STRING
control from the contents of the passed StringFormatGrp.
Implementation: Each txtque QUEUE entry contains the position, alignment, styles, character set and other attributes of
the TEXT control.
IReportGenerator Interface 767
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.
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.
Because the LocatorClass is abstract, the ABC Template generated code does not directly reference the LocatorClass.
The LocatorClass source code is installed by default to the Clarion \LIBSRC folder. The LocatorClass source code and its
respective components are contained in:
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 GetShadow method is a placeholder method for the EntryLocatorClass which is derived from
LocatorClass.
Implementation: The Init method sets the values of the Control, FreeElement, NoCase, and ViewManager properties.
A nocase value of zero (0 or False) produces case sensitive searches; a value of one (1 or True)
produces case insensitive searches.
By default, only the StepLocatorClass and FilterLocatorClass use the browseclass. The other locator
classes do not.
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
The SetAlerts method is a placeholder method for classes derived from LocatorClass--
IncrementalLocatorClass, etc.
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.
The UpdateWindow method is only a placeholder method for classes derived from LocatorClass--
EntryLocatorClass, FilterLocatorClass, etc.
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.
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 Init method initializes the MsgBoClass object.
Kill
The Kill method disposes any memory allocated during the object's lifetime and performs any other necessary
termination code.
MsgBoxClass 783
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.
PopupClass 785
The ABC Templates declare a local PopupClass class and object for each instance of the Popup code template.
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
PopupString=PopupMgr.Ask() !display popup menu
CASE PopupString !check for selected item
OF 'Disable' !if Disable item selected
IF PopupMgr.GetItemChecked('Disable')
PopupMgr.SetItemCheck('Disable',False) !toggle the menu check mark
ENABLE(?Save) !toggle ?Save button state
ELSE !which automatically toggles
PopupMgr.SetItemCheck('Disable',True) !the Save menu item, because
DISABLE(?Save) !it mimics the ?Save button
END
OF 'Restore' !if Restore item selected
POST(EVENT:Accepted,?Restore) !code your own functionality
ELSE !if any other item selected
END !Ask automatically handled it
PopupClass 787
END
END
CASE FIELD()
OF ?Save !Save button mimiced by Save item
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Save('MyPopup') !save menu definition to INI
RUN('NotePad '&INIFile) !display/edit menu definition
ENABLE(?Restore) !enable the Restore button
PopupMgr.SetItemEnable('Restore',True) !enable the Restore item
END
OF ?Restore
CASE EVENT()
OF EVENT:Accepted
PopupMgr.Restore('MyPopup') !restore/define menu from INI
END
OF ?Close !Close btn Accepted by Close item
CASE EVENT()
OF EVENT:Accepted
POST(Event:CloseWindow)
END
END
END
PopupMgr.Kill
788 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.
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 selec ted
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 803
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
806 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 811
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.
814 ABC Library Reference
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 PrintPreviewClass relies on the PopupClass and, optionally, the TranslatorClass to accomplish some of its tasks.
Therefore, if your program instantiates the PrintPreviewClass, it should also instantiate the PopupClass and may need the
Translator class as well. Much of this is automatic when you INCLUDE the PrintPreviewClass header (ABREPORT.INC)
in your program's data section. See the Conceptual Example.
The ASCIIPrintClass and the ReportManager use the PrintPreviewClass to provide a print preview facility.
PrintPreviewClass 815
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.
816 ABC Library Reference
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
PrintPreviewClass 817
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
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
818 ABC Library Reference
PrintPreviewClass 819
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)
820 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.
822 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)
Implementation: The PrintPreviewClass.TakeAccepted method calls the AskPrintPages method and returns TRUE (1)
when completed or FALSE (0) if the user presses the cancel button. The AskPrintPages method displays
a dialog that prompts for the page numbers to print.
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
OF EVENT:OpenWindow
! INIMgr code for FETCHing window settings
OF EVENT:CloseWindow
! INIMgr code for UPDATEing window settings
END
END
CLOSE(Window)
RETURN Rval
828 ABC Library Reference
Implementation: The PrintPreviewClass.Display method calls the AskThumbnails method. The AskThumbnails method
displays a dialog that prompts for the number of thumbnails to display horizontally, and the number of
thumbnails to display vertically.
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)
PrintPreviewClass 829
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
Implementation: The PrintPreviewClass.Init method instantiates a PopupClass object for the PrintPreviewClass object,
using the menu text defined in ABREPORT.TRN.
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
832 ABC Library Reference
InPageList( page )
Implementation: The PageManagerClass.Draw (which is PRIVATE) and SyncImageQueue methods call the InPageList
method to verify report pages for inclusion in the preview window and the printed report respectively.
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
Implementation: The SetZoomPercentile method assumes the AllowUserZoom property is True. If the zoom factor equals
a defined ZoomIndex choice, SetZoomPercentile sets the ZoomIndex property to that choice and sets the
UserPercentile property to zero. If the zoom factor does not equal a defined ZoomIndex choice,
SetZoomPercentile sets the UserPercentile property to the zoom factor and sets the ZoomIndex property
to zero.
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
Implementation: The TakeEvent method calls the TakeWindowEvent method. The TakeWindowEvent method calls the
WindowManager.TakeWindowEvent method for all events except EVENT:GainFocus.
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
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
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)
846 ABC Library Reference
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.
This property is PROTECTED, therefore, it can only be referenced by a ProcessClass method, or a method in a class
derived from ProcessClass.
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.
848 ABC Library Reference
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.
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
Implementation: The SetProgressLimits method assumes a StepClass object is specified. The Reset method conditionally
calls the SetProgessLimits method. The SetProgressLimits method calls the StepClass.SetLimits method.
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
Implementation: The ReportManager.TakeAccepted method calls the TakeLocate method for each report record.
Example:
ProcessClass.TakeLocate PROCEDURE
CODE
IF ~SELF.Query&=NULL AND SELF.Query.Ask()
SELF.SetFilter(SELF.Query.GetFilter())
END
ProcessClass 853
Implementation: The ReportManager.TakeWindowEvent method calls the TakeRecord method for each report record. For
a report, the TakeRecord method typically implements any DETAIL specific filters and PRINTs the
unfiltered DETAILs for the ReportManager. For a process, the TakeRecord method typically implements
any needed record action for the Process.
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.
856 ABC Library Reference
Tip: Use the BrowseQBEButton control template to add a QueryFormClass object to your template generated
BrowseBoxes.
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
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
858 ABC Library Reference
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
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 BRW1 field queryable
Query.AddItem('CUS:State','') !make State field queryable too
SELF.SetAlerts()
RETURN ReturnValue
QueryClass 859
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
860 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.
QKSupport BYTE
The QKSupport property indicates that QuickQBE support is enabled.
Window &Window
The Window property is a reference to the QBE dialog window.
QueryClass 861
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.
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
Ask A virtual to accept query criteria (search values) from the end user.
uselast An integer constant, variable, EQUATE, or expression that determines whether
the QueryClass 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 is a virtual to display a query dialog, process its events, and return a value indicating whether to apply
the query or abandon it. A return value of Level:Notify indicates the QueryClass object should apply the query criteria; a
return value of Level:Benign indicates the end user cancelled the query input dialog and the QueryClass object should not
apply the query criteria.
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.
Implementation: The ClearQuery method is called by the Take, Restore, and QueryVisual.TakeAccepted methods.
This mehtod is used by the QuickQBE functionality.
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 )
Restore The Restore method retrieves a saved query from the INI file.
queryname A string constant, variable, EQUATE or expression containing the name of a
saved query.
Implementation: The Restore method is called by the Take, QueryVisual.TakeAccepted, and
QueryVisual.TakeFieldEvent methods.
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:
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
Implementation: The SetQuickPopup method adds a submenu to the BroweClass popup object, and an item to clear
the current query and an item for every saved query for the current procedure.
Note: TheSetQuickPopup method is primarily designed for use by the QuickQBE functionality.
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.
878 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.
Tip: Use the BrowseQBEButton control template to add a QueryFormClass object to your template generated
BrowseBoxes.
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
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
880 ABC Library Reference
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
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
QueryFormClass 881
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
882 ABC Library Reference
QueryFormClass Properties
The QueryFormClass inherits all the properties of the QueryClass from which it is derived.
QueryFormClass 883
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.
The Init method sets the value of the QueryFormClass 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 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.
Tip: Use the BrowseQBEButton control template to add a QueryFormClass object to your template generated
BrowseBoxes.
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
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
BUTTON('&Query'),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(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)
890 ABC Library Reference
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
QueryFormVisual Class 891
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.
Implementation: The QueryFormClass.Ask method (indirectly) calls the Init method to configure the QueryFormClass
WINDOW.
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
TakeCompleted 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: 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
The TakeFieldEvent method is a virtual placeholder to process all field-specific/control-specific events for the window. It
returns a value indicating whether window process is complete and should stop. TakeFieldEvent 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: 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.
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
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
QueryListClass 903
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
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
904 ABC Library Reference
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
QueryListClass 905
QueryListClass Properties
The QueryListClass inherits all the properties of the QueryClass from which it is derived. See QueryClass Properties for
more information.
906 ABC Library Reference
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
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
QueryListVisual Class 913
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
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
914 ABC Library Reference
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
QueryListVisual Class 915
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.
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
TakeCompleted 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: 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: The EIPManager.TakeFieldEvent method calls the TakeEvent method. The TakeEvent method process
an EVENT:AlertKey for the edit-in-place control and returns a value indicating the user requested action.
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
The TakeFieldEvent method is a virtual placeholder to process all field-specific/control-specific events for the window. It
returns a value indicating whether window process is complete and should stop. TakeFieldEvent 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: 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)
Implementation: The UpdateControl method is called from the QEIPManager.TakeEvent, when the MouseRight button is
clicked.
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 931
The TakeFieldEvent method is a virtual placeholder to process all field-specific/control-specific events for the window. It
returns a value indicating whether window process is complete and should stop. TakeFieldEvent 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: 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
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.
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 derive a class from the RelationManager class for each file the application processes. The derived
classes are called Hide:Relate:filename, but may be referenced as Relate:filename. These derived classes and their
methods are declared and implemented 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 enforce
the file relationships and referential integrity constraints specified in the data dictionary.
934 ABC Library Reference
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
RelationManager 935
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
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
936 ABC Library Reference
END
CASE Process.Next()
OF Level:Notify
?Progress:Text{Prop:Text} = 'Process Completed'
DISPLAY(?Progress:Text)
POST(EVENT:CloseWindow)
BREAK
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 )
RelationManager 937
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).
The EQUATEs for updatemode and deletemode are declared in FILE.INC as follows:
ITEMIZE(0),PRE(RI)
None EQUATE !no action on related files
Clear EQUATE !clear the linking fields in related files
Restrict EQUATE !disallow the operation if linked records exist
Cascade EQUATE !update the linking fields in related files, or
END !delete the linked records in related files
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
940 ABC Library Reference
END
RelationManager 941
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
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 GetRelationType method returns a –1 when whichrelation is not a valid relation number. It returns a
one (1) if the relationship is determined to be a one-to-many relationship. It returns a zero (0) for all other
relation types.
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
RelationManager 949
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
RelationManager 951
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.
Implementation: The Save method uses the BufferedPairsClass.AssignLeftToBuffer method to Save each record. See
Field Pairs Classes for more information.
952 ABC Library Reference
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.
Corresponding EQUATEs for the valid propagate options are declared in FILE.INC as follows:
ITEMIZE(0),PRE(Propagate)
None EQUATE !do primary file only, no related files
OneMany EQUATE !do 1-Many relations only
ManyOne EQUATE !do Many-1 relations only
All EQUATE !do all related files
END
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
954 ABC Library Reference
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 is derived from the WindowManager because it supports a progress window to provide appropriate
visual feedback to the end user (see WindowManager for more information).
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.
ReportManager Class 957
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)
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
ReportManager Class 959
Access:Customer.Init PROCEDURE
CODE
PARENT.Init(Customer,GlobalErrors)
960 ABC Library Reference
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)
ReportManager Class 961
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.
Implementation: The TakeWindowEvent method implements the behavior specified by the DeferWindow property.
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 TakeCloseEvent method implements the behavior specified by the KeepVisible property.
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
964 ABC Library Reference
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.
The ABC ProcessReportQBEButton template generates code to declare and support a QBE
button.
966 ABC Library Reference
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
974 ABC Library Reference
It checks to see if any final break logic needs to be processed by the BreakManager, then issues an
ENDPAGE statement. You can use the method‘s embed point to perform any post processing needed
prior to closing the report and accessing the Preview window.
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 975
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.
The OpenReport method resets the DeferOpenReport property to zero so that if deferred, the
OpenReport only happens with the first timer event.
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
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.
Implementation: The ProcessResultFiles method is called by the ReportManager‘s PrintReport method. By default, the
method returns Level:Benign. If any other value is returned, the report‘s printing will be aborted.
Return Data Type: BYTE
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
982 ABC Library Reference
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.
Implementation: The SetStaticControlsAttributes method is a vrtual method called by the ReportManager‘s Open
method.
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
ReportManager Class 983
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)
The TakeWindowEvent method processes EVENT:Timer events for the report. The TakeWindowEvent
method either calls OpenReport (if DeferOpenReport is True) or begins processing a "cycle" of report
records. Each timer event begins a "cycle" of report record processing which ends about TimeSlice later.
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.
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.
The RulesCollection CLASS manages a collection of related rules, and provides methods for defining those
rules, testing them singly or jointly, counting and/or displaying broken rules, and hiding or disabling controls when
one or more rules is broken.
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
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
RuleManager 991
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')
SELF.Request = GlobalRequest
ReturnValue = PARENT.Init()
!Define RulesManager
CustomerRules &= New(RuleManager)
CustomerRules.SetErrorImage('~SMCROSS.ICO')
CustomerRules.SetDescription('Rules for the customer')
CustomerRules.CheckAllRules(1)
SELF.SetAlerts()
RETURN ReturnValue
ThisWindow.Kill PROCEDURE
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
GlobalErrors.SetProcedureName
RETURN ReturnValue
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
RuleManager 993
ELSE
Looped = 1
END
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
994 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
BIND('Cus:Address',Cus:Address)
!A small button with the icon SMCROSS.ICO' will be displayed 3 pixels to the left
of !?CusName when the expression evaluates to false
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
!If a description is provided with the corresponding error, a !message with the
corresponding error will appear
RuleManager 995
?OK{Prop:Disable} = CustomerRules.BrokenRuleCount()
!The ?OK button is disabled when there are broken rules
(CustomerRules.GetDescription(),CustomerRules.GetErrorImage()))
!Call a popup listbox of broken rules, and use the default RulesManager icon as an i con. !If
the user double clicks one of the broken rules, the corresponding control will be !selected.
996 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
SetName( string ) sets the Name property
SetExpression( string ) sets the Expression property
SetControlNum( value ) sets the ControlNum property
SetDescription( string ) sets the Description property
SetErrorIndicator( value ) sets the ErrorIndicator property
SetErrorImage( string ) sets the ErrorImage property
SetIsBroken( value ) sets the IsBroken property
SetOffsetRight( value ) sets the OffestRight property
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.
The RuleIsBroken method calls SELF.SetGlobalRule before evaluating the expression and
SELF.ResetGlobalRule immediately after evaluating the expression. During the EVALUATE process,
then, a called procedure can use the address posted to call back to the current Rule instance.
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
Construct
Construct Initializes the RulesCollection object. The Construct method is executed automatically when the object is
instantiated.
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()
RuleManager 1003
Example:
CustomerRules RulesCollection
CODE
... code omitted ...
BrokenRules = CustomerRules.BrokenRuleCount()
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,3)
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)
1004 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,3)
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 1005
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,3)
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.
1006 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 1007
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)
1008 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
SetControlsStatus Sets the hidden or disabled status of a control or controls managed by this RulesCollection
object.
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)
control A numeric constant, variable, EQUATE, or expression that contains a field equate value.
The SetControlsStatus method sets the status of controls managed by this RulesCollection object depending on the
parameters supplied. If control is supplied, only status changes involving that control are processed. If action is supplied,
only status changes involving that action are processed. If neither is supplied, then all changes for all controls are
processed.
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
1012 ABC Library Reference
NeedChangeControlStatus Examines the conditions under which the hidden or disabled status of control needs to
change and returns information about whether the change is needed now.
control A numeric constant, variable, EQUATE, or expression that contains a field equate value.
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)
found A numeric variable which will be updated with an action code.
The NeedChangeControlStatus method returns True if the status of control needs to change, False if not. On return, the
found variable is set to the action that needs to be taken.
Example:
lActionExist = RuleAction:None
lChange = SELF.NeedChangeControlStatus(pControlFeq,pAction,lActionExist)
IF lActionExist<>pAction THEN RETURN.
RuleManager 1013
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()
1014 ABC Library Reference
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()
AddRulesCollection( RulesCollection )
AddRulesCollection Adds a RulesCollection instance to the collection being managed by this RulesManager object
RulesCollection The label of a RulesCollection object.
The AddRulesCollection method adds the specified RulesCollection object to the RuleManager and adds it to the Rules
queue.
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.
RuleManager 1015
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
1016 ABC Library Reference
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.
RuleManager 1019
1020 ABC Library Reference
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 ABC DOSFileLookup control template generates code to declare a local SelectFileClass class and object for each
instance of the SelectFile Control Template.
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
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
1022 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 1023
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 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.
Implementation: The Init method is called by the BrowseClass.Init method. The BrowseClass.Init method creates an
instance of the StandardBehavior object before the Init method is called.
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 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.
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.
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.
The GetPercentile method is a placeholder method for classes derived from StepClass--StepLongClass,
StepRealClass, StepStringClass, StepCustomClass, etc.
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.
The GetValue method is a placeholder method for classes derived from StepClass--StepLongClass,
StepRealClass, StepStringClass, StepCustomClass, etc.
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.
The SetLimit method is a placeholder method for classes derived from StepClass--StepLongClass,
StepRealClass, StepStringClass etc.
The SetLimitNeeded method is a placeholder method for classes derived from StepClass, such as
StepStringClass.
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.
1044 ABC Library Reference
By default, the Process and Report templates declare a StepStringClass, StepLongClass, or StepRealClass called
ProgressMgr. However, you can use the Report Properties Classes tab (the Progress Class button) to declare a
StepCustomClass (or derive from the StepCustomClass) instead. Similarly, you can use the Process Properties General
tab (the Progress Manager button) to declare a StepCustomClass (or derive from the StepCustomClass). The templates
provide the derived class so you can modify the ProgressMgr behavior on an instance-by-instance basis.
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)
CLEAR(GlobalResponse)
Relate:Customer.Open
FilesOpened = True
OPEN(ProgressWindow)
SELF.Opened=True
END
LOOP i# = 9010 TO 10000 BY 11 !90% of customerids between 9000 & 10000
Step"=i#
ProgressMgr.AddItem(Step")
END
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 1047
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 1053
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
StepLongClass 1055
ThisWindow.Kill PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Kill()
IF ReturnValue THEN RETURN ReturnValue.
IF FilesOpened
Relate:Customer.Close
END
RETURN ReturnValue
1056 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
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.
The ABC BrowseBox template generates code to instantiate the StepLocatorClass for your BrowseBoxes. The
StepLocatorClass 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 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.
1062 ABC Library Reference
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
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 1065
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
1066 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.
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')
1068 ABC Library Reference
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
StepRealClass 1069
END
RETURN ReturnValue
1070 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.
1076 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
ThisWindow CLASS(WindowManager)
Init PROCEDURE(),BYTE,PROC,VIRTUAL
Kill PROCEDURE(),BYTE,PROC,VIRTUAL
END
CODE
ThisWindow.Run() !run the window procedure
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)
StepStringClass 1079
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
1080 ABC Library Reference
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
1086 ABC Library Reference
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.
AlinkLookup Look up one or more Associative link (Alink) names within a compiled help (.chm)
file.
keywords A string constant, variable, EQUATE, or expression containing the Associative
link (keyword) to search for. Multiple keywords can be used by concatenating
them with semicolons (;).
messagetext A string constant, variable, EQUATE, or expression containing the message to
display in a message box if the Alink is not found.
messagetitle A string constant, variable, EQUATE, or expression containing the title of the
message box dialog.
The AlinkLookup method looks up one or more Associative link (Alink) names within a compiled help (.chm) file.
Associative links are used to link related help topics to each other. When a link that contains an Alink is clicked, a popup
window appears with the list of related topics.
Example:
oHH.ALinkLookUp(sSearch,sMsg,sTitle )!Find sSearch Alink
TagHTMLHelp Class 1091
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
1092 ABC Library Reference
AlinkLookup Look up one or more Associative link (Alink) names within a compiled help (.chm)
file.
helpfile A string constant, variable, EQUATE, or expression containing the help file
name. This should be enclosed in single quotes.
keycode A numeric keycode or keycode EQUATE. If omitted, the default value is 123,
F12Key. Keycode equates can be found in KEYCODES.CLW.
The Init method initializes the TagHTMLHelp object and opens the specified help file. This method also aliases the F1 key
to the F12 (keycode 123) key by default in order for the rest of the methods to be able to check for this keystroke. If F12 is
used by some other function in the application this may be changed to whatever keystroke is unused in the application.
Example:
oHH.Init( 'cwhh.chm' )
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 1095
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
1096 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 1097
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:
Implementation: The EditTextClass.TakeEvent method calls the TextWindowClass.Init method and initiates the
ACCEPT loop for the text window.
Implementation: The TakeAccepted method calls the WindowManager.SetResponse to register the methods' result
(complete or cancelled) and triggers the normal procedure shutdown.
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, 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.
1102 ABC Library Reference
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
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
1104 ABC Library Reference
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)
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
1106 ABC Library Reference
ToolBarClass 1107
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
1108 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.
Implementation: The DisplayButtons method calls the ToolbarTarget.DisplayButtons method 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
1112 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.
Implementation: The WindowManager.TakeEvent method calls the TakeEvent method. The TakeEvent method calls the
ToolbarTarget.TakeEvent method for the active toolbar target.
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 ToolbarClass keeps a list of ToolbarTarget objects (including ToolbarListboxClass objects) so it can forward events
and method calls to a particular target.
The ToolbarListboxClass is completely encapsulated within the BrowseClass and is not referenced in the template-
generated code.
The ToolbarListboxClass source code is installed by default to the Clarion \LIBSRC folder. The ToolbarListboxClass
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 ToolbarListboxClass objects.
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.
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
1116 ABC Library Reference
Frame.TakeAccepted PROCEDURE()
ReturnValue BYTE,AUTO
Looped BYTE
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()
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()
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
1118 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.
Implementation: The BrowseClass.AddToolbarTarget method sets the value of the Browse property.
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.
Implementation: The ToolbarClass.SetTarget method calls the TryTakeToolbar method. The TryTakeToolbar method calls
the TakeToolbar method if the ToolbarListboxClass object's LIST is visible.
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
ToolbarReltreeClass objects implement the event handling specific to a RelationTree control LIST. The LIST specific
events are primarily scrolling events, but may include other events. There may be zero or several ToolbarTarget objects
within a procedure; however, only one is active at a time.
The ToolbarClass keeps a list of ToolbarTarget objects (including ToolbarReltreeClass objects) so it can forward events
and method calls to a particular target.
The RelationTree control template derives a ToolbarReltreeClass object called REL#::Toolbar, where # is the
RelationTree template's instance number. The template generates code to register the REL#::Toolbar object with the
Toolbar object for the procedure that contains the RelationTree control template. Finally, the template generates the
REL#::Toolbar.TakeEvent method to convert toolbar events into actions specific to the RelationTree LIST control.
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
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
1126 ABC Library Reference
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
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()
ToolBarReltreeClass 1127
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.
1130 ABC Library Reference
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).
1134 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.
Each template that requests global toolbar control instantiates a ToolbarTarget object. The FormVCRControls template's
ToolbarTarget object is called ToolBarForm; the RelationTree template's ToolbarTarget object is called REL#::Toolbar,
where # is the RelationTree template's instance number; and the BrowseBox's ToolbarTarget object is completely
encapsulated within the BrowseClass object and is not referenced in the template generated code. 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 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 1137
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 1139
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.
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.
The ToolbarClass keeps a list of ToolbarTarget objects (including ToolbarUpdateClass objects) so it can forward events
and method calls to a particular target.
The FormVCRControls extension template generates code to declare a ToolbarUpdateClass object called ToolbarForm,
and to register the ToolbarForm object with the procedure's WindowManager.
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
KeyCompany KEY(CUS:Company),DUP,NOCASE
Record RECORD,PRE()
CustNumber LONG
Company STRING(20)
ZipCode LONG
END
END
1146 ABC Library Reference
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()
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()
ToolBarUpdateClass 1147
BrowseWindow.Init PROCEDURE()
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.Init()
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
1148 ABC Library Reference
OrderView VIEW(Orders)
END
OrderQ QUEUE
ORD:OrderNumber LIKE(ORD:OrderNumber)
ORD:InvoiceAmount LIKE(ORD:InvoiceAmount)
ViewPosition STRING(1024)
END
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
! (and with FormWindow's Toolbar)
OrderBrowse.AddToolbarTarget(Toolbar)!Instantiate a ToolbarListboxClass object,
SELF.SetAlerts() ! and register with FormWindow's Toolbar
RETURN ReturnValue
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
PARENT.Init(Access:Orders,1)
SELF.AddRelation(Relate:Customer)
Relate:Orders.Kill PROCEDURE
CODE
Access:Orders.Kill
1150 ABC Library Reference
PARENT.Kill
ToolBarUpdateClass 1151
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.
Implementation: The ToolbarClass.SetTarget method calls the TryTakeToolbar method. The TryTakeToolbar method calls
the TakeToolbar and returns True because, by default, a ToolbarUpdateClass object may always assume
toolbar control.
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
TransactionManagerClass
Overview
The TransactionManager class is used to manage a transaction processing ―frame‖. It wraps all of the classic operations
normally used in a typical transaction process, including LOGOUT, COMMIT, and ROLLBACK operations, and allows you
to control them through a simple set of methods. Nearly all ISAM and SQL tables support transaction processing. Please
refer to the Database Drivers Help topic for more specific information regarding each individual driver.
TransactionManager Concepts
Override and Control of one or all of the Template-Based Transaction Frames
In a standard application created in the Application Generator, transaction processing of data elements is handled by the
target RelationManagers for each primary table. The ABC Templates set the RelationManager‘s UseLogout property
based on the Enclose RI code in transaction frame check box in the Global Properties dialog. You can use the
TransactionManager (with the help of the supporting templates) to turn off the RelationManager support for transaction
framing, and specifically customize the tables that you need to enclose in a transaction frame in a target Form or Process
procedure.
All of your hand-coded transaction processing frames can now be encapsulated in the TransactionManager. Using its
available methods ensures that proper initialization, processing, and error checking will be performed.
The Process Transaction Frame Checkpoint code template is used in any process procedure to specify and control
transaction processing over a specific batch of records instead of the normal default processing of individual records.
1158 ABC Library Reference
MyTransaction TransactionManager
ReturnValue BYTE
CODE
Relate:Invoice.Open()
MyTransaction.AddItem(Relate:Invoice)
MyTransaction.AddItem(Relate:Items)
ReturnValue = Level:Benign
IF MyTransaction.Start()=Level:Benign !Initialize, begin LOGOUT
!......
!Work with the Tables here and set the ReturnValue to Level:Fatal
!if there are any errors.
!......
MyTransaction.Finish(ReturnValue) !Commit or rollback based on errorlevel
END
!--------------------------------------------------------------------
!This next partial code example demonstrates how to execute the transaction
!in a process. It uses the SetLogoutOff\RestoreLogout methods. This is used !when you need a longer
transaction in a process where you don't need to !continually set the Uselogout to TRUE/FALSE
repeated times (via Start)
...........
MyTransaction.AddItem(Relate:Invoice)
MyTransaction.AddItem(Relate:Items)
MyTransaction.SetLogoutOff()
...........
ReturnValue = MyTransaction.Start()
...........
...........
MyTransaction.Finish(ReturnValue)
ReturnValue = MyTransaction.Start()
...........
...........
MyTransaction.Finish(ReturnValue)
...........
MyTransaction.RestoreLogout()
...........
! --------------------------------------------------------------------
!This example shows the use of the Process virtual method.
PROGRAM
MAP.
MyTransaction CLASS(TransactionManager)
Process PROCEDURE(),BYTE,VIRTUAL
END
ReturnValue BYTE
CODE
Relate:Invoice.Open()
MyTransaction.AddItem(Relate:Invoice)
MyTransaction.AddItem(Relate:Items)
MyTransaction.Run()!This will all the work for you
MyTransaction.Process PROCEDURE()
ReturnValue BYTE
CODE
ReturnValue = Level:Benign
!Work with the Tables here and set the ReturnValue to Level:Fatal
1160 ABC Library Reference
TransactionManager Properties
The TransactionManager class contains no public properties.
TransactionManager Methods
Implementation: To include a primary table and its associated children in an impending TransactionManager process, you
should call AddItem and specify the appropriate RelationManager object in the Init method of the
WindowManager or ProcessManager.
Example:
Finish completes the TransactionManager process. Using the errorlevel value it will rollback or commit the transaction.
An errorlevel of Level:Benign will commit (complete) the transaction, where any other errorlevel set will force a rollback
(cancellation) of the transaction.
Implementation: The Finish method should be called in the TakeCompleted method to validate a transaction. During a
process, it can be called at any time to commit or rollback a batch of records processed. The method calls
either the TransactionCommit or TransactionRollback methods in order to complete the transaction
process.
Example:
ReturnValue = PARENT.TakeCompleted()
! A ReturnValue other than Level:Benign will rollback the transaction
IF SELF.Request<>ViewRecord
Transaction.Finish(ReturnValue)
END
RETURN ReturnValue
END
Process is a virtual placeholder method used to work with any tables affected by the transaction process, and can return
the correct error level to control if the transaction should be completed or aborted (COMMIT or ROLLBACK respectively).
Implementation: The Process method is a virtual method that will be called from the Run method only if the Start method
first returns a Level:Benign error level. After that, if the Process method returns any error level other than
Level:Benign, the transaction will rollback.
Example:
MyTransaction.Process PROCEDURE()
ReturnValue BYTE
CODE
ReturnValue = Level:Benign
!Work with the Tables and set the ReturnValue
!to Level:Fatal here if there are any errors.
RETURN ReturnValue
TransactionManagerClass 1165
Reset is used to remove all RelationManager objects that have been added to the TransactionManager‘s protected
TransactionManagerQueue. In effect, the queue is freed, and any impending transaction processing will not occur. If a
transaction is already in progress, the Reset method is ignored.
Implementation: Use the Reset method at any time prior to starting a transaction process if you need to cancel the entire
operation for any reason.
1166 ABC Library Reference
RestoreLogout Restores all RelationManager objects in the TransactionManager list queue to their original
transaction status.
RestoreLogout will restore the respective UseLogout property set in each RelationManager involved in the transaction to
its previous status.
Implementation: The Init method of the respective RelationManager 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. RestoreLogout sets this property to its
previous status. Normally, this follows a call to the SetLogoutOff method.
timeout A numeric constant or variable specifying the number of seconds to attempt to begin the transaction for
files contained in the target RelationManager objects before aborting the transaction and posting an error.
Run is used to initiate the TransactionManager transaction process. If the timeout value is not exceeded, the
Start\Process\Finish-TransactionCommit or TransactionRollBack methods will be subsequently called.
Implementation: The Run method is not used by the ABC template chain. It is a method provided for developers who are
writing custom source code using the TransactionManager.
1168 ABC Library Reference
SetLogoutOff Turn off default logout setting in all RelationManagers stored in TransactionManager list queue
SetLogoutOff is used to set the default logout setting in the appropriate RelationManager objects contained in the
protected TransactionManagerQueue to OFF. This allows the TranactionManager to control the tranaction process
through its own properties and methods.
Implementation: The SetLogoutOff method loops through the list of RelationManager objects listed by the
TranactionManager, saves the appropriate status of the RelationManager‘s UseLogout property, and sets
the UseLogout property to FALSE. It is internally called by the Start method, or may be called explicitly in
a process where multiple transactions with batches of records may occur, and the continued call to the
Start method for each batch does not need to continually reset the UseLogout property.
Example:
TransactionManager.Start PROCEDURE()
I LONG,AUTO
RetVal BYTE,AUTO
CODE
IF SELF.TransactionRunning THEN RETURN Level:Fatal.
IF SELF.AutoLogoutOff
FREE(SELF.UselogoutList)
SELF.LogoutOff = True
END
FREE(SELF.RMList)
LOOP I=1 TO RECORDS(SELF.Files)
GET(SELF.Files,I)
IF NOT ERRORCODE()
IF SELF.AutoLogoutOff
SELF.SetLogoutOff(SELF.Files.RM)
END
RetVal = SELF.AddFileToLogout(SELF.Files.RM,SELF.Files.Cascade)
IF RetVal<>Level:Benign
BREAK
END
END
END
TransactionManagerClass 1169
timeout A numeric constant or variable specifying the number of seconds to attempt to begin the transaction for files
contained in the target RelationManager objects before aborting the transaction and posting an error.
SetTimeout is used to set the TransactionManager‘s LOGOUT timeout value. The internal default value is 2 seconds.
1170 ABC Library Reference
Start is a virtual method used to begin the TransactionManager transaction process. Start makes sure that a transaction
is not already running, clears the target RelationManager‘s internal UseLogout property, manages and issues a LOGOUT
for all active tables contained in the target RelationManagers maintained by the TransactionManager.
If the initialization and LOGOUT statement are successful, Start returns a Level:Benign error level. If the Start method is
for any reason unsuccessful, a Level:Fatal error level is returned.
Implementation: In a form (update) procedure, the Start method is called just prior to the Window Manager‘s
TakeCompleted method. In a process procedure that implements the TransactionManager, the Start
method can be called for each individual method processed, or can be called for a specified number of
records processed.
Example:
!In a Form procedure
IF SELF.Request<>ViewRecord
ReturnValue = Transaction.Start()
IF ReturnValue<>Level:Benign THEN RETURN ReturnValue.
END
ReturnValue = PARENT.TakeCompleted()
! A ReturnValue other than Level:Benign will rollback the transaction
IF SELF.Request<>ViewRecord
Transaction.Finish(ReturnValue)
END
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.OpenReport()
IF ReturnValue = Level:Benign
ReturnValue = Transaction.Start()
END
RETURN ReturnValue
TransactionManagerClass 1171
ReturnValue BYTE,AUTO
CODE
ReturnValue = PARENT.TakeRecord()
! ----------------------------------------------------
!
! Transaction Check Point
! The transaction will be saved till this point
! and a new one will be started
!
IF SELF.RecordsProcessed % 100 = 0
Transaction.Finish(ReturnValue)
IF ReturnValue = Level:Benign
ReturnValue = Transaction.Start()
END
END
! ----------------------------------------------------
PUT(Process:View)
IF ERRORCODE()
GlobalErrors.ThrowFile(Msg:PutFailed,'Process:View')
ThisWindow.Response = RequestCompleted
ReturnValue = Level:Fatal
END
RETURN ReturnValue
1172 ABC Library Reference
TransactionCommit is a virtual method used to complete the TransactionManager‘s transaction process by issuing a
COMMIT statement. In addition, the UseLogout property of each RelationManager used in the transaction is restored to
its previous state. It also checks to make sure if the transaction has already been completed.
Implementation: The TransactionCommit method is called by the Finish method if a Level:Benign error level has been
posted.
Example:
TransactionRollback is a virtual method used to abort the TransactionManager‘s transaction process by issuing a
ROLLBACK statement. In addition, the UseLogout property of each RelationManager used in the transaction is restored
to its previous state. It also checks to make sure if the transaction has already been completed.
Implementation: The TransactionRollback method is called by the Finish method if a Level:Fatal error level has been
posted.
Example:
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.
TranslatorClass 1175
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 WindowManager, PopupClass, and PrintPreviewClass optionally use the TranslatorClass to translate text at runtime.
These classes do not require the TranslatorClass; however, if you want them to do runtime translation, you must include
the TranslatorClass in your program. See the Conceptual Example.
1176 ABC Library Reference
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
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:
| 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.'
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
1180 ABC Library Reference
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
1182 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.
The TranslateString method implements the TranslatorClass macro substitution by translating any
percent sign (%) delimited text it detects within its own return value.
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.
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.
ViewManager 1187
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
ViewManager 1189
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
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)
1190 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.
The RestoreBuffers method releases memory allocated by the SaveBuffers method. Therefore, to prevent
a memory leak, each call to SaveBuffers should be paired with a corresponding call to RestoreBuffers.
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.
AddRange ignores the field parameter when the primaryrelation parameter is present.
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. Prepending the expression list with a "*" completely
replaces a previously appended sort order..
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.
Implementation: The BrowseClass uses the GetFirstSortField method to prime the BrowseClass.SetLocatorField method.
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.
Implementation: The FilterLocatorClass uses the GetFreeElementName method to refresh the window.
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.
Implementation: The BrowseClass.TakeKey method uses the GetFreeElementPosition method to reposition the VIEW
based on the fixed key elements. The GetFreeElementName method uses the GetFreeElementPosition
method to find the free element name.
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
If Next succeeds, it returns Level:Benign (declared in ABERROR.INC). If it fails, it returns Level:Notify or Level:Fatal
depending on the error encountered. See Error Class for more information on severity levels.
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.
Implementation: If Previous succeeds, it returns Level:Benign (declared in ABERROR.INC). If it fails, it returns Level:Notify
or Level:Fatal depending on the error encountered. See Error Class for more information on severity
levels.
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.
Implementation: The PrimeRecord method uses the primary file's FileManager.PrimeRecord method to prime the record.
Then it uses any applicable range limit information to prime other fields. The suppress clear parameter
lets you clear or retain any other values in the record buffer.
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 ViewManager evaluates the expressions in id order, so it is efficient to prioritize expressions most likely to fail; for
example:
MyView.SetFilter('TaxPayer=True','9Tax') !low priority expression
MyView.SetFilter('LotteryWinner=True','1Lot') !high priority expression
!evaluates as: (LotteryWinner=True) AND (TaxPayer=True)
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.
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
ThisWindow.OpenReport PROCEDURE
ReturnValue BYTE,AUTO
CODE
SELF.Process.SetFilter(CHOOSE(CHOICE(?List1),'','PEO:Gender=''M''',|
'PEO:Gender=''F'''))
SELF.Process.SetOrder(CHOOSE(CHOICE(?List2),'PEO:Id','PEO:LastName',|
'PEO:FirstName','PEO:Gender'))
EXECUTE(CHOICE(?List3))
SELF.Report &= Report
BEGIN
SELF.Report &= Report1
RecordsPrinted = 0
SELF.PrePass = 1 - SELF.PrePass
END
SELF.Report &= Report2
END
ReturnValue = PARENT.OpenReport()
RETURN ReturnValue
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
WindowComponent Interface 1221
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.
WindowResizeClass 1227
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.
1230 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.
Resize Scales all window coordinates by the same amount as the parent, thus
preserving the relative sizes and positions of all controls. This is the default
strategy.
Surface Makes the most of the available pixels by positioning other controls to
maximize the size of LIST, SHEET, PANEL, and IMAGE controls.
Spread Preserves the design-time look and feel of the window by applying the
following strategies by control type:
BUTTON Horizontal and Vertical position (X and Y coordinates) are "fixed" relative to
the nearest parent border; width and height are unchanged.
RADIO Horizontal and vertical position are scaled with the parent, but width and
height are unchanged.
CHECK Horizontal and vertical position are scaled with the parent, but width and
height are unchanged.
ENTRY Width, horizontal and vertical position are scaled with the parent, but height
is unchanged.
COMBO+DROP
Width, horizontal and vertical position are scaled with the parent, but height
is unchanged.
LIST+DROP Width, horizontal and vertical position are scaled with the parent, but height
is unchanged.
SPIN 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.
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
WindowResizeClass 1237
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.
Implementation: The SetParentDefaults method considers each control's coordinates. If the control's coordinates fall within
the coordinates of another control, the SetParentDefaults method sets the "outer" control as the parent of
the "inner" 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.
WindowManager 1245
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 derive a class from the WindowManager class for each procedure that drives an interactive window,
including Report and Process procedures. The derived class is called ThisWindow, and its methods and behavior can be
modified on the Window Behavior Classes tab.
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.
1246 ABC Library Reference
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()
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
1248 ABC Library Reference
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
CODE
ThisWindow.Run() !run the program / procedure
!(Init, Ask, Kill)
ThisWindow.Init PROCEDURE() !setup and "program" ThisWindow
ReturnValue BYTE,AUTO
WindowManager 1249
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
IF SELF.PrimeUpdate() THEN RETURN Level:Notify. !prepare record for add
OPEN(CUSWindow) !open the window
SELF.Opened=True ! flag it as open
!Program PhBrowse object, including
! registering ThisWindow (SELF)
PhBrowse.Init(?PhoneList,PhoneQ.ViewPos,PhoneView,PhoneQ,Relate:Phones,SELF)
PhBrowse.Q &= PhoneQ
PhBrowse.AddSortOrder(,PH:IDKEY)
PhBrowse.AddRange(PH:ID,Relate:Phones,Relate:Customer)
PhBrowse.AddField(PH:ID,PhBrowse.Q.PH:ID)
PhBrowse.AddField(PH:NUMBER,PhBrowse.Q.PH:NUMBER)
PhBrowse.InsertControl=?Insert
PhBrowse.ChangeControl=?Change
PhBrowse.DeleteControl=?Delete
SELF.SetAlerts() !alert keys for ThisWindow
RETURN ReturnValue
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.
WindowManager 1257
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.
Implementation: The WindowManagerClass clears the LastInsertedPosition property in the Ask method. The property is
updated by the File Manager‘s Position method after a Insert:Batch update.
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.
WindowManager 1261
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.
EQUATEs for the OriginalRequest and Request properties are declared in \LIBSRC\TPLEQU.CLW as
follows:
InsertRecord EQUATE (1) ! Add a record to table
ChangeRecord EQUATE (2) ! Change the current record
DeleteRecord EQUATE (3) ! Delete the current record
SelectRecord EQUATE (4) ! Select the current record
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).
Implementation: The ResetOnGainFocus property defaults to zero (0). The TakeWindowEvent method carries out the
action specified by the ResetOnGainFocus property by optionally setting the ForcedReset property to
True when the window loses focus.
Resize &WindowResizeClass
The Resize property is a reference to the WindowResizeClass object that handles window resizing events.
WindowManager 1263
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.
Implementation: EQUATEs for the Response property are declared in \LIBSRC\TPLEQU.CLW as follows:
RequestCompleted EQUATE (1) ! Update Completed
RequestCancelled EQUATE (2) ! Update Aborted
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.
Implementation: EQUATEs for the VCRRequest property are declared in \LIBSRC\ABTOOLBA.INC as follows:
ITEMIZE,PRE(VCR)
Forward EQUATE(Toolbar:Down) !EQUATE(1)
Backward EQUATE(Toolbar:Up) !EQUATE(2), etc..
PageForward EQUATE(Toolbar:PageDown)
PageBackward EQUATE(Toolbar:PageUp)
First EQUATE(Toolbar:Top)
Last EQUATE(Toolbar:Bottom)
Insert EQUATE(Toolbar:Insert)
None EQUATE(0)
END
WindowManager 1265
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.
Implementation: The ChangeRecord method is called by the TakeCompleted method when Request 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
InsertRecord
DeleteRecord
WindowManager 1273
DeleteRecord, VIRTUAL
The DeleteRecord method performs the necessary database delete operations when called. DeleteRecord returns
Level:Benign to indicate successful a delete operation.
Implementation: The DeleteRecord method is called by the TakeCompleted method when Request is set to
DeleteRecord.
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
1274 ABC Library Reference
The Init method both "programs" the WindowManager object and initializes the overall procedure.
The WindowManager may be configured to implement a variety of options regarding update windows (forms). You can
use the Init method to configure form behavior by setting the Request, InsertAction, ChangeAction, and DeleteAction
properties.
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
SELF.Errors &= GlobalErrors
SELF.AddItem(Toolbar)
CLEAR(GlobalRequest)
CLEAR(GlobalResponse)
SELF.AddItem(?Close,RequestCancelled)
Relate:Client.Open
FilesOpened = True
OPEN(QuickWindow)
SELF.Opened=True
Resizer.Init(AppStrategy:Surface,Resize:SetMinSize)
SELF.AddItem(Resizer)
Resizer.AutoTransparent=True
BRW1.Init|
(?Browse:1,Queue:Browse:1.Position,BRW1::View:Browse,Queue:Browse:1,Relate:Client,SELF)
BRW1.Q &= Queue:Browse:1
BRW1::Sort1:StepClass.Init(+ScrollSort:AllowAlpha,ScrollBy:Runtime)
WindowManager 1275
BRW1.AddSortOrder(BRW1::Sort1:StepClass,CLI:NameKey)
BRW1.AddLocator(BRW1::Sort1:Locator)
BRW1::Sort1:Locator.Init(,CLI:Name,1,BRW1)
BRW1.AddField(CLI:Name,BRW1.Q.CLI:Name)
BRW1.AddField(CLI:StateCode,BRW1.Q.CLI:StateCode)
BRW1.AddField(CLI:ID,BRW1.Q.CLI:ID)
BRW1.InsertControl=?Insert:2
BRW1.ChangeControl=?Change:2
BRW1.DeleteControl=?Delete:2
BRW1.AddToolbarTarget(Toolbar)
BRW1.AskProcedure = 1
SELF.SetAlerts()
RETURN Level:Benign
InsertRecord, VIRTUAL
The InsertRecord method performs the necessary database insert operations when called. InsertRecord returns
Level:Benign to indicate successful a insert operation.
Implementation: The TakeCompleted method calls the InsertRecord method when Request is set to InsertRecord.
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
WindowManager 1277
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)
ownerwindow The label of the owner window, if applicable. This is the label of the APPLICATION or WINDOW structure
which "owns" the mainwindow being opened.
The Open method, when called with the mainwindow and optional ownerwindow parameters, is used to open a window
for processing. A mainwindow with an ownerwindow always appears on top, and is automatically hidden if the
ownerwindow is minimized or hidden. If the ownerwindow is closed, all owned windows are also automatically closed.
The Open method when called without parameters, prepares the window for display. It is designed to execute on window
opening events such as EVENT:OpenWindow and EVENT:GainFocus, and can optionally translate a window if
necessary.
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(Window)
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.
Implementation: The TakeAccepted method calls the PostCompleted method. The ToolbarUpdateClass.TakeEvent also
calls PostCompleted. The PostCompleted method initiates AcceptAll mode for update Forms (see
SELECT in the Language Reference for more information) and POSTs an EVENT:Completed for all other
windows.
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
WindowManager 1281
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
1282 ABC Library Reference
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)
CYCLE
END
RETURN GlobalResponse
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
WindowManager 1289
Implementation: The SaveOnInsertAction method is called by the TakeCompleted method when Request is set to
SaveRecord and OriginalRequest is set to InsertRecord.
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
1290 ABC Library Reference
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.
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.
TakeCompleted 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 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.
TakeCompleted sets the Response property and POSTs an EVENT:CloseWindow when appropriate.
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:
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.
thread an optional SIGNED variable that receives the number of the sender's thread parameter.
parameter a LONG variable that receives the parameter passed by the sender with a NOTIFY statement.
TakeNotify is a virtual method used to process valid EVENT:Notify events for the window's controls and returns a
Level:Benign value by default. This method is called if EVENT:Notify is received by the window, and the NOTIFICATION
function (and subsequently this method) returns TRUE if the parameter values match the values from the NOTIFY
function that posted the event.
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
Implementation: The Update method calls BrowseClass.UpdateViewRecord for each BrowseClass object added by the
AddItem method.
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 1303
Index:
_Print (print rich text control contents) ........................280 AddLocator (specify a locator) ................................... 708
_Print print a Crystal Report ........................................258 AddLocator (specify a locator) .................................... 158
ABC Template Implementation ...... 312, 889, 1019, 1083 AddLogFile (maintain log file structure) ...................... 291
ACCEPT .................................................................... 1253 AddMask ................................................................... 1011
ActiveInvisible..............................................................132 SelectFileClass...................................................... 1011
BrowseClass ............................................................132 AddMask (add file dialog file masks) ........................ 1011
ActiveInvisible (obscured browse list action) ..............132 AddMenu ..................................................................... 782
AddBreak .....................................................................108 PopupClass ............................................................. 782
AddControl .................................................................. 422 AddPair ............................................................... 218, 510
AddEditControl ............................................................156 BufferedPairsClass.................................................. 218
BrowseClass ............................................................156 FieldPairsClass ....................................................... 510
AddEditControl (specify custom edit-in-place class) ... 156 AddPair (add a field pair) .................................... 218, 510
AddErrors .................................................................... 461 AddRange ................................................................. 1180
ErrorClass ................................................................461 ViewManagerClass ............................................... 1180
AddErrors (add or override recognized errors) ...........461 AddRange (add a range limit) ................................... 1180
AddField ..............................................................157, 545 AddRecord (add a record filedrop queue) .................. 528
BrowseClass ............................................................157 AddRelation ................................................................ 927
FileDropClass ..........................................................545 AddRelationLink .......................................................... 929
AddField (specify a FILE/QUEUE field pair) ...............157 AddResetField ............................................................ 159
AddField (specify display fields) .................................. 545 BrowseClass ........................................................... 159
AddField(track fields in a structure).............................569 AddResetField (set a field to monitor for changes) .... 159
AddHistory (update History structure) .........................462 AddSortOrder .................................................... 160, 1181
AddHistoryField .........................................................1249 BrowseClass ........................................................... 160
WindowManagerClass ...........................................1249 ViewManagerClass ............................................... 1181
AddHistoryField (add restorable control and field) .... 1249 AddSortOrder (add a sort order) ............................... 1181
AddHistoryFile ...........................................................1250 AddSortOrder (specify a browse sort order) ............... 160
WindowManagerClass ...........................................1250 AddSubMenu .............................................................. 783
AddHistoryFile (add restorable history file) ...............1250 PopupClass ............................................................. 783
AddItem .................. 92, 234, 509, 779, 1034, 1145, 1251 AddTarget ................................................................. 1094
AsciiViewerClass .......................................................92 ToolbarClass ......................................................... 1094
FieldPairsClass ........................................................509 AddTarget (register toolbar driven entity) ................. 1094
PopupClass .............................................................779 AddThread (maintains the triggerqueue) .................... 301
QueryClass ..............................................................850 AddToolbarTarget ....................................................... 161
StepCustomClass ..................................................1034 BrowseClass ........................................................... 161
WindowManagerClass ...........................................1251 AddToolbarTarget (set the browse toolbar) ................ 161
AddItem (add a step marker) .................................... 1034 AddTranslation .......................................................... 1162
AddItem (add field to query) ........................................850 TranslatorClass ........................................... 1162, 1163
AddItem (add menu item)............................................779 AddUpdateField .......................................................... 546
AddItem (maintain the columninfo structure) ..............290 FileDropClass .......................................................... 546
AddItem (maintain the namequeue structure) .............301 AddUpdateField (specify field assignments) .............. 546
AddItem (program the AsciiViewer object) ....................92 AddUpdateFile .......................................................... 1252
AddItem (program the WindowManager object) .......1251 WindowManagerClass .......................................... 1252
AddItem(program the BrowseClass object) ................158 AddUpdateFile (register batch add files) .................. 1252
AddItem(program the ReportManager object) ............958 AddValue
AddItemEvent ..............................................................780 EditMultiSelectClass ............................................... 397
PopupClass .............................................................780 AddValue (prime the MultiSelect dialog)..................... 397
AddItemEvent (set menu item action) .........................780 Again ........................................................................... 413
AddItemMimic..............................................................781 AliasedFile .................................................................. 559
PopupClass .............................................................781 FileManagerClass ................................................... 559
AddItemMimic (tie menu item to a button) ..................781 AliasedFile (the primary file) ....................................... 559
AddKey ........................................................................570 AlinkLookup (associative link lookup) ....................... 1076
FileManagerClass ....................................................570 AllowReset .................................................................. 543
AddKey (set the file's keys) .........................................570 AllowUnfilled ............................................................... 133
AddLocator .................................................................. 158 BrowseClass ........................................................... 133
BrowseClass ............................................................158 AllowUnfilled (display filled list) ................................... 133
1304 ABC Library Reference
GetTopic (get current topic name) ............................1077 HelpButton (help control number) ............................. 1121
GetValue .................................... 1024, 1036, 1044, 1058 HideSelect ................................................................... 140
StepClass ..............................................................1024 High ................................................................. 1042, 1056
StepCustomClass ..................................................1036 StepLongClass ...................................................... 1042
StepLongClass ......................................................1044 StepRealClass....................................................... 1056
StepRealClass .......................................................1058 High (upper boundary) .................................... 1042, 1056
StepStringClass .....................................................1069 HistHandlerClass Methods ......................................... 717
GetValue (return a percentile's value) ..1024, 1036, 1044, HistHandlerClass Properties ....................................... 715
1058, 1069 HistHandlerClass Source Files ................................... 715
GetValueFromField .....................................................684 History ....................................................................... 1136
GetValueFromStatusBar .............................................684 ToolbarUpdateClass ............................................. 1136
GetVisible(returns visibility of control) .........................724 History (enable toolbar history button) ...................... 1136
GraphClass Overview .................................................661 History (error history structure) ................................... 715
GraphClass Source Files ............................................661 HistoryHandler (windowcomponent interface) ........... 769
GridClass ABC Template Implementation ..................703 HistoryKey................................................................. 1239
GridClass Methods ......................................................708 WindowManagerClass .......................................... 1239
GridClass Overview ....................................................703 HistoryKey (restore field key) .................................... 1239
GridClass Properties ...................................................704 HistoryMsg (initialize the message window) ............... 468
GridClass Source Files ...............................................703 hRTFWindow(RTF control handle) ............................. 266
GroupColor (background color of group fields) ...........706 Icon (icon for image control) ....................................... 768
GroupControl (GROUP control number) .....................706 IDbChangeAudit Concepts ......................................... 719
GroupTitle (title of group element) ..............................706 IDbChangeAudit Methods ........................................... 719
gShowDiagramName ..................................................663 IDbChangeAudit Source Files .................................... 719
gShowDiagramNameV................................................664 IfGroupField (determine if current control is a GROUP)
gShowMouse...............................................................665 ................................................................................. 710
gShowMouseX ............................................................666 IListControl Concepts ................................................. 723
gShowMouseY ............................................................667 IListControl Methods ................................................... 723
gShowNodeName .......................................................668 IListControl Source Files ............................................. 723
gShowNodeNameV .....................................................669 ImageToWMF ............................................................. 685
gShowNodeValue .......................................................670 IncrementalLocatorClass
gShowNodeValueX .....................................................671 methods ................................................................... 731
gShowNodeValueY .....................................................672 properties ................................................................ 730
HasCancelButton display cancel button on report IncrementalLocatorClass Methods ............................. 731
preview .................................................................... 244 IncrementalLocatorClass Overview ............................ 727
HasCloseButton display close button on report preview IncrementalLocatorClass Properties........................... 730
.................................................................................245 INIClass .............................................................. 733, 734
HasExportButton display export button on report preview methods ................................................................... 736
.................................................................................246 properties ................................................................ 735
HasLaunchButton display launch button on report INIClass Methods........................................................ 736
preview .................................................................... 247 INIClass Properties ..................................................... 735
HasNavigationControls display navigation controls on Init 60, 72, 81, 95, 96, 125, 166, 225, 235, 425, 444, 469,
report preview ..........................................................248 516, 530, 531, 547, 588, 685, 740, 761, 791, 819, 837,
HasPrintButton display print button on report preview 249 896, 905, 915, 935, 962, 1013, 1025, 1037, 1096,
HasPrintSetupButton display print setup button on report 1164, 1189, 1217, 1256
preview .................................................................... 250 ASCIIFileClass .......................................................... 60
HasProgressControls display progress controls on report ASCIIPrintClass......................................................... 72
preview .................................................................... 251 ASCIISearchClass..................................................... 81
HasRefreshButton display refresh button on report ASCIIViewerClass ............................................... 95, 96
preview .................................................................... 252 BrowseClass ........................................................... 166
HasSearchButton display search button on report BufferedPairsClass.................................................. 225
preview .................................................................... 253 ConstantClass ......................................................... 235
HasThumb ................................................................... 140 EditClass ................................................................. 319
BrowseClass ............................................................140 EntryLocatorClass ................................................... 444
HasZoomControl display zoom control on report preview ErrorClass ............................................................... 469
.................................................................................254 FieldPairsClass ....................................................... 516
HelpButton................................................................. 1121 FileDropClass .......................................................... 547
ToolbarTargetClass ...............................................1121 FileDropComboClass .............................................. 530
1312 ABC Library Reference
Msg ..............................................................................472 Open (prepare preview window for display) ............... 822
ErrorClass ................................................................472 Opened ..................................................................... 1241
Msg (initiate error message destination) .....................472 WindowManagerClass .......................................... 1241
MsgBoxClass Methods ...............................................770 Opened (file opened flag) ................................... 308, 748
MsgBoxClass Overview ..............................................767 Opened (window opened flag) .................................. 1241
MsgBoxClass Properties .............................................768 OpenLogFile (open the audit log file).......................... 296
MsgRVal (message box return value) .........................769 OpenMode .................................................................. 565
MyWindow ................................................................. 1240 FileManagerClass ................................................... 565
NameQueue (pointer into trigger queue) ....................300 OpenMode (file access/sharing mode) ....................... 565
Naming Conventions and Dual Approach to Database OpenReport ................................................................ 966
Operations ...............................................................566 ReportManagerClass .............................................. 966
Next OpenReport (prepare report for execution) ................ 966
ASCIISearchClass .....................................................82 OpsEIP ........................................................................ 903
BrowseClass ............................................................168 OpsEIP (reference to the EditDropListClass) ............. 903
ConstantClass .........................................................238 Order
FileManagerClass ....................................................592 ViewManagerClass ............................................... 1173
ProcessClass ...........................................................839 ORDER ..................................................................... 1173
ReportManagerClass ...............................................964 Order (sort
NEXT .................. 82, 168, 238, 427, 592, 839, 964, 1190 range-limit
Next (copy next constant item to targets) ...................238 and filter information) ......................................... 1173
Next (find next line containing search text) ...................82 OriginalRequest ........................................................ 1242
Next (get next element) ...............................................839 WindowManagerClass .......................................... 1242
Next (get next record in sequence) .............................592 OriginalRequest (original database request) ............ 1242
Next (get next report record) .......................................964 OutputFileQueue......................................................... 950
Next (get the next browse item) .................................. 168 Overview ............................................................. 287, 639
Next (get the next edit-in-place field) ..........................427 OwnerWindow........................................................... 1242
Next (load all constant items to file or queue) .............237 PageDown .................................................................... 98
NoCase ASCIIViewerClass ..................................................... 98
LocatorClass ............................................................759 PageDown (scroll down one page) ............................... 98
NOCASE .....................................................................759 PagesAcross ............................................................... 809
NoCase (case sensitivity flag) .....................................759 PrintPreviewClass ................................................... 809
NodeNameText ...........................................................688 PagesAcross (number of pages displayed horizontally)
NodeText .....................................................................689 ................................................................................. 809
NodeTipText ................................................................689 PagesAhead ............................................................. 1174
NodeValueText............................................................690 ViewManagerClass ............................................... 1174
NodeXText .................................................................. 690 PagesAhead (buffered pages) .................................. 1174
NodeYText .................................................................. 691 PagesBehind ............................................................. 1174
OKControl.................................................................. 1241 ViewManagerClass ............................................... 1174
WindowManagerClass ...........................................1241 PagesBehind (buffered pages) ................................. 1174
OKControl (window acceptance control--OK button) 1241 PagesDown ................................................................. 810
OnChange (update audit log file after a record change) PrintPreviewClass ................................................... 810
.........................................................................294, 721 PagesDown (number of vertical thumbnails) .............. 810
OnDelete (update audit log file when a record is deleted) PageSize ................................................................... 1175
.................................................................................294 ViewManagerClass ............................................... 1175
OnFieldChange (virtual method for each field change) PageSize (buffer page size) .................................... 1175
.................................................................................295 PagesToPrint .............................................................. 810
OnInsert (update audit log file when a record is added) PageUp ......................................................................... 99
.................................................................................296 ASCIIViewerClass ..................................................... 99
Open ..........................................................................1260 PageUp (scroll up one page) ........................................ 99
FileManagerClass ....................................................593 Paste (paste text from clipboard) ................................ 280
PrintPreviewClass ...................................................822 Percentile .................................................................... 834
RelationManagerClass ............................................938 ProcessClass .......................................................... 834
ViewManagerClass ................................................1191 Percentile (portion of process completed) .................. 834
OPEN ....................................... 593, 822, 938, 965, 1191 Popup .......................................................................... 691
Open (initiate open of log file) .....................................503 ASCIIViewerClass ..................................................... 88
Open (open a file and any related files) ......................938 BrowseClass ........................................................... 142
Open (open standarderrorlog file) .............................1020 POPUP ................................................................. 88, 142
Open (open the file) ....................................................593 PopupAsk .................................................................... 692
Open (open the view) ................................................1191 PopupClass ................................................. 773, 774, 775
Index 1315
SetField (set the substitution value of the %Field macro) SetLocatorField ........................................................... 184
.................................................................................478 SetLocatorFromSort.................................................... 184
SetFieldName..............................................................478 SetLogErrors ............................................................... 485
SetFile .........................................................................479 SetLogoutOff ............................................................. 1151
ErrorClass ................................................................479 SetMask .................................................................... 1014
SetFile (set the substitution value of the %File macro) SelectFileClass...................................................... 1014
.................................................................................479 SetMask (set file dialog file masks) .......................... 1014
SetFileName................................................................479 SetMessageText ......................................................... 486
SetFilter ..................................................................... 1196 SetName ..................................................................... 614
SetFM (determine log file status) ................................297 FileManagerClass ................................................... 614
SetFocus (give rich text control focus) ........................284 SetName (set current filename) .................................. 614
SetHelpFile (set the current HTML Help file name) .. 1080 SetOption (set fuzzymatch options) ............................ 641
SetHistoryResetOnView ..............................................480 SetOrder ................................................................... 1197
SetHistoryThreshold ....................................................480 ViewManagerClass ............................................... 1197
SetHistoryViewLevel ...................................................481 SetOrder (replace a sort order) ................................ 1197
SetId ............................................................................484 SetParentControl ...................................................... 1223
ErrorClass ................................................................484 SetParentDefaults ..................................................... 1224
SetId (make a specific error current) ...........................484 WindowResizeClass ............................................. 1224
SetINIManager ............................................................823 SetParentDefaults (set default parent controls) ........ 1224
PrintPreviewClass ...................................................823 SetPercentile ................................................................. 64
SetINIManager (save and restore window coordinates) ASCIIFileClass .......................................................... 64
.................................................................................823 SetPercentile (set file to relative position) .................... 64
SetItemCheck ..............................................................795 SetPosition
PopupClass .............................................................795 PrintPreviewClass ................................................... 824
SetItemCheck (set toggle item status) ........................795 SETPOSITION ............................................................ 824
SetItemEnable .............................................................796 SetPosition (set initial preview window coordinates) .. 824
PopupClass .............................................................796 SetProcedureName .................................................... 487
SetItemEnable (set item status) .................................. 796 SetProcedureName ( stores procedure names .......... 487
SetKey .........................................................................613 SetProgressLimits ....................................................... 840
FileManagerClass ....................................................613 SetQueueRecord ................................................ 185, 550
SetKey (set current key) ..............................................613 BrowseClass ........................................................... 185
SetKeyName ...............................................................483 FileDropClass .......................................................... 550
SetLevel ......................................................................797 SetQueueRecord (copy data from file buffer to queue
PopupClass .............................................................797 buffer) .............................................................. 185, 550
SetLevel (set menu item level) .................................... 797 SetQuickPopup ........................................................... 863
SetLimit ...................................... 1027, 1045, 1059, 1072 SetQuickPopup ( add QuickQBE to browse popup ) .. 863
QueryClass ......................................................861, 862 SetQuickScan ............................................................. 940
StepClass ..............................................................1027 RelationManagerClass ............................................ 940
StepLongClass ......................................................1045 SetQuickScan (enable QuickScan on a file and any
StepRealClass .......................................................1059 related files) ............................................................. 940
StepStringClass .....................................................1072 SetReadOnly....................................................... 321, 359
SetLimit (set search values) ........................................861 SetReadOnly (set edit control to read-only
SetLimit (set smooth data distribution) .1027, 1045, 1059, EditDropClass) ........................................................ 359
1072 SetReadOnly (set edit control to read-only) ............... 321
SetLimitNeeded ...............................................1028, 1073 SetReportTarget ......................................................... 969
StepClass ..............................................................1028 SetResponse ............................................................ 1273
StepStringClass .....................................................1073 WindowManagerClass .......................................... 1273
SetLimitNeeded (return static/dynamic boundary flag) SetResponse (OK or Cancel the window) ................ 1273
...............................................................................1073 SetShadow .................................................................. 446
SetLine ..................................................................63, 101 SetShadow (update shadow value) ............................ 764
ASCIIFileClass...........................................................63 SetShadow(set shadow value) ................................... 446
ASCIIViewerClass ...................................................101 SetSilent ...................................................................... 488
SetLine (a virtual to position the file) .............................63 SetSort .............................................................. 186, 1198
SetLine (position to specific line) ................................101 BrowseClass ........................................................... 186
SetLineRelative ...........................................................102 ViewManagerClass ............................................... 1198
ASCIIViewerClass ...................................................102 SetSort (apply a sort order to the browse) .................. 186
SetLineRelative (move n lines) ................................... 102 SetSort (set the active sort order) ............................. 1198
1320 ABC Library Reference
TakeKey (process an alerted keystroke) ...189, 732, 765, TakeWindowEvent (process non-field events) .......... 830
1052 TakeWindowEvent (a virtual to process non-field events)
TakeNewSelection ............................. 190, 437, 536, 552 ................................................................................. 973
BrowseClass ............................................................190 TargetSelector ............................................................ 954
FileDropClass ..........................................................552 TargetSelectorCreated ............................................... 954
FileDropComboClass ..............................................536 TerminatorField ........................................................... 231
WindowManagerClass ...........................................1279 TerminatorInclude ....................................................... 231
TakeNewSelection (reset edit-in-place column TerminatorValue (end of data marker) ....................... 232
EIPManagerClass) ..................................................437 TestLen ..................................................................... 1067
TakeNewSelection (reset edit-in-place column) ........128 StepStringClass..................................................... 1067
TakeNewSelection (a virtual to process EVENT TestLen (length of the static step portion) ................ 1067
NewSelection)........................................................1279 TextWindowClass Concepts ..................................... 1083
TakeNewSelection (process a new selection) ............190 TextWindowClass Methods ...................................... 1085
TakeNewSelection (process EVENT TextWindowClass Overview ..................................... 1083
NewSelection events) ......................................536, 552 TextWindowClass Properties .................................... 1084
TakeNoRecords ..........................................................972 TextWindowClass Source Files ................................ 1083
ReportManagerClass ...............................................972 Throw .................................................................. 497, 615
TakeNoRecords (process empty report) .....................972 ErrorClass ............................................................... 497
TakeNotify .........................................................493, 1280 FileManagerClass ................................................... 615
ErrorClass ................................................................493 Throw (process specified error) ................................. 497
TakeNotify (process notify error) ................................. 493 Throw (pass an error to the error handler for processing)
TakeOther ................................................................... 494 ................................................................................. 615
ErrorClass ................................................................494 ThrowFile .................................................................... 498
TakeOther (process other error) ................................. 494 ErrorClass ............................................................... 498
TakeProgram...............................................................495 ThrowFile (set value of %File
ErrorClass ................................................................495 then process error) .................................................. 498
TakeProgram (process program error) ......................495 ThrowMessage ................................................... 499, 616
TakeRecord ................................................................. 841 ErrorClass ............................................................... 499
ProcessClass ...........................................................841 FileManagerClass ................................................... 616
TakeRecord (a virtual to process each report record) 841 ThrowMessage (pass an error and text to the error
TakeRecord(process each record) .............................972 handler) ................................................................... 616
TakeRejected ............................................................1281 TimeOut .................................................................... 1177
WindowManagerClass ...........................................1281 ViewManagerClass ............................................... 1177
TakeRejected (a virtual to process EVENT TimeOut (buffered pages freshness) ........................ 1177
Rejected) ...............................................................1281 TimeSlice .................................................................... 955
TakeScroll ................................................................... 191 ReportManagerClass .............................................. 955
BrowseClass ............................................................191 TimeSlice (report resource usage) ............................. 955
TakeScroll (process a scroll event) .............................191 Title ............................................................................. 405
TakeSelected ............................................................1282 EditColorClass......................................................... 341
WindowManagerClass ...........................................1282 EditFileClass ........................................................... 374
TakeSelected (a virtual to process EVENT EditFontClass .......................................................... 384
Selected) ................................................................1282 EditMultiSelectClass ............................................... 394
TakeToolbar ......................................... 1116, 1127, 1139 Title (color dialog title text) .......................................... 341
ToolbarListBoxClass ..............................................1106 Title (font dialog title text) .................................... 384, 394
ToolbarReltreeClass ..............................................1116 Title (text dialog title text) ............................................ 405
ToolbarTargetClass ...............................................1127 Toolbar
ToolbarUpdateClass ..............................................1139 BrowseClass ........................................................... 151
TakeToolbar (assume contol of the toolbar) .............1106 TOOLBAR ................................................................... 151
TakeToolbar (assume control of the toolbar) .1116, 1127, Toolbar (browse Toolbar object) ................................. 151
1139 ToolbarClass ...............................1087, 1088, 1089, 1091
TakeUser .....................................................................496 methods ................................................................. 1093
ErrorClass ................................................................496 properties .............................................................. 1093
TakeUser (process user error) .................................... 496 ToolbarClass Functional Organization--Expected Use
TakeVCRScroll ............................................................192 ............................................................................... 1093
BrowseClass ............................................................192 ToolbarClass Methods .............................................. 1093
TakeVCRScroll (process a VCR scroll event) .............192 ToolbarClass Overview ............................................. 1087
TakeWindowEvent ........................... 830, 920, 973, 1283 ToolbarItem ................................................................. 152
PrintPreviewClass ...................................................830 BrowseClass ........................................................... 152
ReportManager ........................................................973 ToolbarItem (browse ToolbarTarget object) ............... 152
Index 1323
ToolbarListboxClass ........................................1099, 1100 TryFetch (get a value from the INI file) ....................... 741
methods ................................................................. 1104 TryFetch (try to get a specific record by key value) .... 617
properties ...............................................................1103 TryFetchField .............................................................. 742
ToolbarListboxClass Methods ................................... 1104 INIClass ................................................................... 742
ToolbarListBoxClass Overview ................................. 1099 TryFetchField (return comma delimited INI file value) 742
ToolbarListboxClass Properties ................................1103 TryInsert ...................................................................... 618
ToolbarReltreeClass TryNext ....................................................................... 619
methods ................................................................. 1115 FileManagerClass ................................................... 619
properties ...............................................................1114 TryNext (try to get next record in sequence) .............. 619
ToolbarReltreeClass Methods................................... 1115 TryOpen ...................................................................... 620
ToolbarReltreeClass Overview ................................. 1109 FileManagerClass ................................................... 620
ToolbarReltreeClass Properties ................................1114 TryOpen (try to open the file) ...................................... 620
ToolbarTarget ..................................................1118, 1119 TryPrevious ................................................................. 621
ToolbarTarget Functional Organization--Expected Use FileManagerClass ................................................... 621
...............................................................................1124 TryPrevious (try to get previous record in sequence) . 621
ToolbarTarget Overview ............................................1118 TryPrimeAutoInc ......................................................... 622
ToolbarUpdateClass ............................ 1129, 1130, 1133 FileManagerClass ................................................... 622
methods ................................................................. 1137 TryPrimeAutoInc (try to prepare an autoincremented
properties ...............................................................1135 record for adding) .................................................... 622
ToolbarUpdateClass Methods................................... 1137 TryReget ..................................................................... 624
ToolbarUpdateClass Overview ................................. 1129 TryTakeToolbar..................................... 1107, 1127, 1140
ToolbarUpdateClass Properties ................................1135 ToolbarListBoxClass ............................................. 1107
ToolTip ........................................................................701 ToolbarTargetClass ............................................... 1127
TopLine .........................................................................89 ToolbarUpdateClass ............................................. 1140
ASCIIViewerClass .....................................................89 TryTakeToolbar (return toolbar control indicator) .... 1107,
ToShowValues ............................................................702 1127, 1140
TransactionCommit ...................................................1155 TryUpdate ................................................................... 624
TransactionManager .................................................1141 FileManagerClass ................................................... 624
TransactionRollback ..................................................1156 TryUpdate (try to change the current record) ............. 624
TranslateControl ........................................................1165 TryValidateField(validate field contents) ..................... 625
TranslatorClass .....................................................1165 Txt (field equate number) .......................................... 1084
TranslateControl (translate text for a control) ...........1165 Undo (undo action) ..................................................... 286
TranslateControls ......................................................1166 UniquePosition (check queue for duplicate record by key
TranslatorClass .....................................................1166 position) ................................................................... 537
TranslateControls (translate text for range of controls) Update
...............................................................................1166 EntryLocatorClass ................................................... 448
TranslateString ..........................................................1167 FileManagerClass ................................................... 626
TranslatorClass .....................................................1167 INIClass ................................................................... 744
TranslateString (translate text) .................................. 1167 RelationManagerClass ............................................ 941
TranslateWindow ......................................................1168 UPDATE ...........................448, 626, 743, 744, 941, 1284
TranslatorClass .....................................................1168 Update (change the current record)............................ 626
TranslateWindow (translate text for a window) .........1168 Update (update record subject to referential constraints)
Translator ......................................................70, 79, 1246 ................................................................................. 941
AsciiPrintClass ...........................................................70 Update (update the audit log file buffer) ..................... 305
ASCIISearchClass .....................................................79 Update (update the locator control and free elements)
WindowManager ....................................................1246 ................................................................................. 448
Translator (TranslatorClass object) ...........................1246 Update (write INI file entries) ...................................... 743
TranslatorClass .......................... 1157, 1158, 1159, 1160 Update(FileManager) ................................................ 1249
methods ................................................................. 1162 Update(get VIEW data for the selected item) ........... 1208
properties ...............................................................1161 Update(update entry in LIST queue) .......................... 203
TranslatorClass Methods ..........................................1162 UpdateBuffer ............................................................... 193
TranslatorClass Overview .........................................1157 BrowseClass ........................................................... 193
TranslatorClass Properties ........................................1161 UpdateBuffer (copy selected item from queue buffer to
TriggerQueue (pointer to BFP for field changes) ........300 file buffer) ................................................................ 193
TryFetch ..............................................................617, 741 UpdateControl (file update trigger) ............................. 707
FileManagerClass ....................................................617 UpdateControl(updates the edit-in-place entry control)
INIClass ................................................................... 741 ................................................................................. 912
1324 ABC Library Reference