| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > StepCustomClass >====== StepCustomClass Overview {{c6h0009.jpg|C6H0009.jpg}} ====== | [[stepcustomclass.htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[stepcustomclass properties.htm|{{btn_next_n.gif|Next page}}]] | | || The StepCustomClass is a StepClass that handles a numeric or alphanumeric key with a skewed distribution (data is not evenly distributed between the lowest and highest key values). You can provide information about the data distribution so that the StepCustomClass object returns accurate feedback about the data being processed. **StepCustomClass Concepts** You can specify a custom data distribution for a StepCustomClass object that fits a specific data set (the other StepClass objects apply one of several predefined data distributions). Use the AddItem method to set the steps or distribution points for the StepCustomClass object. For example, your CustomerKey may contain values ranging from 1 to 10,000, but 90 percent of the values fall between 9,000 and 10,000. If your StepClass object assumes the values are //evenly //distributed between 1 and 10,000 (StepLongClass with Runtime distribution), then your progress bars and vertical scroll bar thumbs will give a misleading visual representation of the data. However, if your StepClass object knows the actual data distribution (StepCustomClass object with 90 percent of the steps between 9,000 and 10,000), then your progress bars and vertical scroll bar thumbs will give an accurate visual representation of the data. {{tipbox.jpg|TipBox.jpg}} **Use the StepLongClass for integer keys with normal distribution. Use the StepStringClass for alphanumeric keys with smooth or skewed distribution. Use the StepRealClass for fractional keys with normal distribution.** Use the StepCustomClass when the data (key) is skewed (data is not evenly distributed between the lowest and highest key values), and the skew does not match any of the standard StepStringClass distribution options (see [[stepstringclass.htm|StepStringClass]]// //for more information). **StepCustomClass Relationship to Other Application Builder Classes** The BrowseClass and the ProcessClass optionally use the StepCustomClass. Therefore, if your BrowseClass or ProcessClass uses the StepCustomClass, your program must instantiate the StepCustomClass for each use. See the [[stepcustomclass overview.htm#d49g0b5|Conceptual Example]]. **StepCustomClass ABC Template Implementation** The ABC Templates (BrowseBox, Process, and Report) automatically include all the classes and generate all the code necessary to use the StepCustomClass with your BrowseBoxes, Reports, and Processes. **Process and Report Procedure Templates** By default, the Process and Report templates declare a StepStringClass, StepLongClass, or StepRealClass called ProgressMgr. However, you can use the **Report Properties **Classes tab (the **Progress Class **button) to declare a StepCustomClass (or derive from the StepCustomClass) instead. Similarly, you can use the **Process Properties **General tab (the **Progress Manager **button) to declare a StepCustomClass (or derive from the StepCustomClass). The templates provide the derived class so you can modify the ProgressMgr behavior on an instance-by-instance basis. If you specify a StepCustomClass object for a Process or Report procedure, you must embed calls to the AddItem method (ProgressMgr.AddItem) to set the custom "steps" or distribution points. **Browse Procedure and BrowseBox Control Templates** By default, the BrowseBox template declares a StepStringClass, StepLongClass, or StepRealClass 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 a StepCustomClass and to set the custom "steps" or distribution points. You can use the **Step Class** button to derive from the StepCustomClass so you can modify the StepCustomClass behavior on an instance-by-instance basis. **StepCustomClass Source Files** The StepCustomClass source code is installed by default to the Clarion \LIBSRC folder. The StepCustomClass source code and its respective components are contained in: | | ABBROWSE.INC | StepCustomClass declarations | | | ABBROWSE.CLW | StepCustomClass method definitions | **StepCustomClass Conceptual Example** The following example shows a typical sequence of statements to declare, instantiate, initialize, use, and terminate a BrowseClass object and related objects. The example initializes and page-loads a LIST, then handles a number of associated events, including searching, scrolling, and updating. When they are initialized properly, the BrowseClass and WindowManager objects do most of the work (default event handling) internally. ** INCLUDE('ABBROWSE.INC')** ** INCLUDE('ABREPORT.INC')** ** MAP** **CustomerProcess  PROCEDURE ** ** END** **CustomerProcess  PROCEDURE** **FilesOpened    BYTE** **Thermometer    BYTE** **Process:View   VIEW(Customer)** **          END** **ProgressWindow WINDOW('Progress...'),AT(,,142,59),CENTER,TIMER(1),GRAY,DOUBLE** **          PROGRESS,USE(Thermometer),AT(15,15,111,12),RANGE(0,100)** **          STRING(''),AT(0,3,141,10),USE(?UserString),CENTER** **          STRING(''),AT(0,30,141,10),USE(?PctText),CENTER** **          BUTTON('Cancel'),AT(45,42,50,15),USE(?Cancel)** **               END** **ThisWindow   CLASS(ReportManager)** **Init        PROCEDURE(),BYTE,PROC,VIRTUAL** **Kill        PROCEDURE(),BYTE,PROC,VIRTUAL** **         END** **ThisProcess   ProcessClass          !declare ThisProcess object** **ProgressMgr   StepCustomClass       !declare ProgressMgr object** ** CODE** ** GlobalResponse = ThisWindow.Run()** **ThisWindow.Init  PROCEDURE()** **ReturnValue  BYTE,AUTO** ** CODE** ** SELF.Request = GlobalRequest** ** ReturnValue = PARENT.Init()** ** IF ReturnValue THEN RETURN ReturnValue.** ** SELF.FirstField = ?Thermometer** ** SELF.VCRRequest &= VCRRequest** ** SELF.Errors &= GlobalErrors** ** CLEAR(GlobalRequest)** ** CLEAR(GlobalResponse)** ** Relate:Customer.Open** ** FilesOpened = True** ** OPEN(ProgressWindow)** ** SELF.Opened=True** ** ProgressMgr.Init(ScrollSort:AllowNumeric)  !initialize ProgressMgr object** **                                            ! ignores inapplicable parameters** ** LOOP i# = 1 TO 9000 BY 1000                !build skewed distribution steps** **  Step"=i#                         !10% of customerids fall between 1 & 9000** **  ProgressMgr.AddItem(Step")** ** END** ** LOOP i# = 9010 TO 10000 BY 11     !90% of customerids between 9000 & 10000** **  Step"=i#** **  ProgressMgr.AddItem(Step")** ** END** ** ThisProcess.Init(Process:View,Relate:Customer,?PctText,Thermometer,ProgressMgr,CUS:ID)** ** ThisProcess.AddSortOrder(CUS:CustomerIDKey)** ** SELF.Init(ThisProcess)** ** SELF.AddItem(?Progress:Cancel,RequestCancelled)** ** SELF.SetAlerts()** ** RETURN ReturnValue** **ThisWindow.Kill  PROCEDURE()** **ReturnValue  BYTE,AUTO** ** CODE** ** ReturnValue = PARENT.Kill()** ** IF ReturnValue THEN RETURN ReturnValue.** ** IF FilesOpened** **  Relate:Customer.Close** ** END** ** RETURN ReturnValue**