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