User Tools

Site Tools


stepstringclass_overview.htm
Navigation:  ABC Library Reference > StepStringClass >====== StepStringClass Overview C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

The StepStringClass is a StepClass that handles alphanumeric keys with a normal distribution (data is evenly distributed between the lowest and highest key values) or with English Alphabet or US Surname distribution. You can provide information about the data distribution so that the StepStringClass object returns accurate feedback about the data being processed.

StepStringClass Concepts

You can set the expected data distribution for a StepStringClass object–the StepStringClass object applies one of several predefined data distributions. Use the Init and SetLimit methods to set the expected data distribution for the StepStringClass object.

For example, your NameKey may contain US Surname values ranging from 'Aabel' to 'Zuger.' If your StepClass assumes the values are evenly distributed between these values, then your progress bars and vertical scroll bar thumbs will give an inaccurate visual representation of the data. However, if your StepClass assumes a typical US Surname distribution, then your progress bars and vertical scroll bar thumbs will give an accurate visual representation of the data.

Use the StepStringClass with alphanumeric keys that have a normal distribution (data is evenly distributed between the lowest and highest key values) or with English Alphabet or US Surname distribution.

TipBox.jpg

Use the StepLongClass for integer keys with normal distribution. Use the StepRealClass for fractional keys with normal distribution. Use the StepCustomClass for numeric or alphanumeric keys with skewed distribution.

StepStringClass Relationship to Other Application Builder Classes

The BrowseClass and the ProcessClass optionally use the StepStringClass. Therefore, if your BrowseClass or ProcessClass uses the StepStringClass, your program must instantiate the StepStringClass for each use. See the Conceptual Example.

StepStringClass ABC Template Implementation

The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and generate all the code necessary to use the StepStringClass with your BrowseBoxes, Reports, and Processes.

Process and Report Procedure Templates

By default, the Process and Report templates declare a StepStringClass for alphanumeric keys called ProgressMgr. You can use the Report Properties Classes tab (the Progress Class button) or the Process Properties General tab (the Progress Manager buttonto derive from the StepStringClass instead. The templates provide the derived class so you can modify the ProgressMgr behavior on an instance-by-instance basis.

Browse Procedure and BrowseBox Control Templates

By default, the BrowseBox template declares a StepStringClass for alphanumeric keys called BRWn::Sort#:StepClass, where n is the BrowseBox template instance number, and # is the sort order sequence (identifies the key). You can use the BrowseBox's Scroll Bar Behavior dialog to specify the expected data distribution (normal distribution, English alphabet, or US surname). You can use the Step Class button to derive from the StepStringClass so you can modify the StepStringClass behavior on an instance-by-instance basis.

StepStringClass Source Files

The StepStringClass source code is installed by default to the Clarion \LIBSRC folder. The StepStringClass source code and its respective components are contained in:

ABBROWSE.INC StepStringClass declarations
ABBROWSE.CLW StepStringClass method definitions

StepStringClass Conceptual Example

The following example shows a typical sequence of statements to declare, instantiate, initialize, use, and terminate a StepStringClass object and related objects. The example initializes and page-loads a LIST, then handles a number of associated events, including scrolling.

The StepStringClass object's steps are calculated based on the poles of the actual browsed data–a list of State abbreviations.

 PROGRAM

INCLUDE('ABWINDOW.INC')           !declare WindowManager class

INCLUDE('ABBROWSE.INC')           !declare BrowseClass & StepClasses

MAP

END

State    FILE,DRIVER('TOPSPEED'),PRE(ST),THREAD

StateCodeKey KEY(ST:STATECODE),NOCASE,OPT

Record       RECORD,PRE()

STATECODE     STRING(2)

STATENAME     STRING(20)

            END

        END

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

GlobalErrors ErrorClass

Access:State CLASS(FileManager)

Init          PROCEDURE

            END

Relate:State CLASS(RelationManager)

Init          PROCEDURE

            END

VCRRequest  LONG(0),THREAD

StWindow WINDOW('Browse States'),AT(,,123,152),IMM,SYSTEM,GRAY

     LIST,AT(8,5,108,124),USE(?StList),IMM,HVSCROLL,FROM(StateQ),|

     FORMAT('27L(2)|M~CODE~@s2@80L(2)|M~STATENAME~@s20@')

     BUTTON('&Insert'),AT(8,133),USE(?Insert)

     BUTTON('&Change'),AT(43,133),USE(?Change),DEFAULT

     BUTTON('&Delete'),AT(83,133),USE(?Delete)

        END

ThisWindow CLASS(WindowManager)

Init        PROCEDURE(),BYTE,PROC,VIRTUAL

Kill        PROCEDURE(),BYTE,PROC,VIRTUAL

          END

BrowseSt  CLASS(BrowseClass)          !declare BrowseSt object

Q          &StateQ

         END

StStep   StepStringClass              !declare StStep object

CODE

ThisWindow.Run()                     !run the window procedure

ThisWindow.Init  PROCEDURE()          !initialize things

ReturnValue    BYTE,AUTO

CODE

ReturnValue = PARENT.Init()

IF ReturnValue THEN RETURN ReturnValue.

GlobalErrors.Init

Relate:State.Init

SELF.FirstField = ?StList

SELF.VCRRequest &= VCRRequest

SELF.Errors &= GlobalErrors

Relate:State.Open

BrowseSt.Init(?StList,StateQ.ViewPosition,StView,StateQ,Relate:State,SELF)

OPEN(StWindow)

SELF.Opened=True

BrowseSt.Q &= StateQ

StStep.Init(+ScrollSort:AllowAlpha,ScrollBy:Runtime)!initialize the StStep object

BrowseSt.AddSortOrder(StStep,ST:StateCodeKey)    ! & plug in to the BrowseSt

                           ! BrowseSt calls SetLimit to

                           ! calculate data distribution

                           ! from the poles of the data

BrowseSt.AddField(ST:STATECODE,BrowseSt.Q.ST:STATECODE)

BrowseSt.AddField(ST:STATENAME,BrowseSt.Q.ST:STATENAME)

SELF.SetAlerts()

RETURN ReturnValue

ThisWindow.Kill  PROCEDURE()           !shut down things

ReturnValue    BYTE,AUTO

CODE

ReturnValue = PARENT.Kill()

IF ReturnValue THEN RETURN ReturnValue.

Relate:State.Close

Relate:State.Kill

GlobalErrors.Kill

RETURN ReturnValue

Access:State.Init PROCEDURE

CODE

PARENT.Init(State,GlobalErrors)

SELF.FileNameValue = 'State'

SELF.Buffer &= ST:Record

SELF.AddKey(ST:StateCodeKey,'ST:StateCodeKey',0)

Relate:State.Init PROCEDURE

CODE

Access:State.Init

PARENT.Init(Access:State,1)

stepstringclass_overview.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1