Module Dfdata.pkg

     1//************************************************************************
     2//
     3// Copyright (c) 1997 Data Access Corporation, Miami Florida,
     4// All rights reserved.
     5// DataFlex is a registered trademark of Data Access Corporation.
     6//
     7//************************************************************************
     8// 11/21/97 JJT - Added DoDisplayCheckbox message
     9// 08/07/97 JJT - Added Column_xxxx Get and Set messages. See below
    10// 07/23/96 JJT - New Class names
    11// 06/03/96 JJT - Added DEO_Control_Object ID
    12//************************************************************************
    13
    14Use DFWide.pkg
    15Use Datalist.pkg
    16
    17{ ClassType=Abstract }
    18{ HelpTopic=DataList_ }
    19Class DataList_ is a WideList STARTMAC dlStart 
    20    // the startmac is used to catch old obsolete code at compiletime
    21    Import_Class_Protocol Data_List_mixin
    22End_Class
    23
    24{ ClassType=Abstract }
    25{ DataBindable=True }
    26{ OverrideProperty=Checkbox_Item_State Visibility=Private }
    27{ HelpTopic=DataList }
    28Class DataList is a DataList_
    29
    30    Procedure Construct_Object
    31        Forward send Construct_Object no_image
    32        { Category=Behavior }
    33        { PropertyType=Boolean }
    34        Property Integer ScrollOnThumbTrackState True
    35        { Category=Behavior }
    36        { PropertyType=Boolean }
    37        Property Integer ThumbScrollState True
    38        { Category=Behavior }
    39        { PropertyType=Boolean }
    40        Property Integer CustomScrollState False
    41
    42        // Prompt and Spin button support
    43        // If true, prompts added automatically to columns that prompt objects
    44        { Category=Appearance }
    45        { PropertyType=Boolean }
    46        Property Integer pbEmbeddedPrompts False
    47        // text for embedded prompt buttons
    48        { Category=Appearance }
    49        property string psEmbeddedButtonValue "..."
    50
    51        // this determines if clicking on header changes ordering direction
    52        { Category=Behavior }
    53        property boolean pbHeaderTogglesDirection False
    54
    55        // these are all private
    56        { Visibility=Private }
    57        Property integer SBRange 0
    58        { Visibility=Private }
    59        Property integer FindAtEndState False
    60        { Visibility=Private }
    61        Property integer LastFindLTState False
    62        { Visibility=Private }
    63        Property integer CrntThumbPos 0
    64
    65        // private for prompt and spin stuff
    66        { Visibility=Private }
    67        Property Integer Current_Position  0
    68
    69        Define oCOLPARAMS_ITEMS for 2
    70        Object oColParams is an Array
    71        End_object
    72
    73
    74    end_procedure
    75
    76
    77
    78    // augmented to check if number of rows changed so we can support dynamic
    79    // resizing of non-batch lists.
    80    { MethodType=Property  NoDoc=True }
    81    Procedure set GuiSize integer row integer col
    82       Forward Set guisize to row col
    83       Send DoCheckDisplayableRows // handle any change in number of rows
    84    End_Procedure // set guisize
    85
    86
    87  //  Returns TRUE to indicate that this is a DEO control. This is used by
    88  //  if you are within a DEO control message and should therefore
    89  //  send a DEO message.
    90  { MethodType=Property }
    91  Function DEO_Control_Object Returns integer
    92    Function_Return 1
    93  End_Function // DEO_Control_Object
    94
    95  // Create interface to more easily get at column options:
    96  // This allows the developer to easiy get at all of the {...}
    97  // items in a dbGrid or dbList.
    98  //
    99  // Get/Set Column_Options
   100  // Get/Set Column_Option
   101  // Get/Set Column_Shadow_State
   102  // Get/Set Column_Capslock_State
   103  // Get/Set Column_Prompt_Object
   104  // Get/Set Column_Zoom_Object
   105  // Get/Set Column_Entry_msg
   106  // Get/Set Column_Exit_msg
   107  // Get/Set Column_Validate_msg
   108
   109  // Get/Set Column_Message (generic: Pass Msg number, column, integer param)
   110  // Advanced Message:
   111  // This is used to get/set the column message for the passed message
   112  // number. Other public column messages use this.
   113  // When SET : Pass message number, column, Integer param to Set.
   114  // When GET : Pass message number, column and return Integer param
   115  //
   116  // sets items in protoype object and items in grid
   117  { MethodType=Property Visibility=Private }
   118  Procedure Set Column_Message integer hmMsg integer iCol integer iParam
   119      integer hObj iRows iCols iRow
   120      Get Prototype_Object to hObj
   121      If hObj Set hmMsg of hObj item iCol to iParam
   122      Get row_count to iRows
   123      get item_limit to iCols
   124      for iRow from 0 to (iRows-1)
   125          Set hmMsg (iRow * iCols + iCol) to iParam
   126      loop
   127  End_procedure
   128
   129  { MethodType=Property Visibility=Private }
   130  Function Column_Message integer hmMsg integer iCol returns integer
   131      integer hObj iParam
   132      Get ProtoType_Object to hObj
   133      If hObj Get hmMsg of hObj item iCol to iParam
   134      Function_Return iParam
   135  End_function
   136
   137  // Get/Set Column_Options
   138  { MethodType=Property }
   139  { ColumnBased=True }
   140  { Category=Data }
   141  { DesignTime=False }
   142  Procedure Set Column_Options integer iCol integer iOptions
   143      Set Column_Message SET_Item_Options iCol to iOptions
   144  End_Procedure
   145
   146  { MethodType=Property }
   147  Function Column_Options integer iCol returns integer
   148      Function_Return (Column_Message(self,GET_Item_Options,iCol))
   149  End_function
   150
   151  // Get/Set Column_Option.
   152  // sets items in protoype object and items in grid
   153  { MethodType=Property }
   154  { ColumnBased=True }
   155  { Category=Behavior }
   156  { DesignTime=False }
   157  Procedure Set Column_Option integer iCol integer iOption integer bState
   158          integer hObj iRows iCols iRow
   159          Get ProtoType_Object to hObj
   160          If hObj Set Item_Option of hObj iCol to iOption bState
   161          Get row_count to iRows
   162          get item_limit to iCols
   163          for iRow from 0 to (iRows-1)
   164              Set Item_Option (iRow * iCols + iCol) to iOption bState
   165          loop
   166  End_procedure
   167
   168  { MethodType=Property }
   169  Function Column_Option integer iCol integer iOption returns integer
   170      integer hObj bState
   171      Get ProtoType_Object to hObj
   172      If hObj Get Item_Option of hObj item iCol iOption to bState
   173      Function_Return bState
   174  End_function
   175
   176  // Get/Set Column_Shadow_State
   177  { MethodType=Property }
   178  { ColumnBased=True }
   179  { Category=Appearance }
   180  { InitialValue=False }
   181  Procedure Set Column_Shadow_State integer iCol Boolean bState
   182       integer iOptions
   183       Boolean bCrntState
   184       // if we have an item (we should) we will see if the item
   185       // option NOENTER is correct. If not, we will set it, which will
   186       // in turn, call shadow_State for us. This keeps item options and
   187       // Shadow_state in synch
   188       Get Column_Options item iCol to iOptions
   189       // 8 = Noenter
   190       Move ( (iOptions IAND 8)<>0 ) to bCrntState // current value of no enter
   191       if bState ne bCrntState Begin // if item opt is not what we want, set it
   192           Set Column_Option item iCol to NOPUT   bState // which will call this
   193           Set Column_Option item iCol to NOENTER bState // proc again.
   194       end
   195  End_Procedure
   196
   197  { MethodType=Property }
   198  Function Column_Shadow_State integer iCol returns Boolean
   199      Function_Return (Column_Message(self,GET_Shadow_State,iCol))
   200  End_function
   201
   202  // Get/Set Column_Capslock_State
   203  { MethodType=Property }
   204  { ColumnBased=True }
   205  { Category=Behavior }
   206  { InitialValue=False }
   207  Procedure Set Column_CapsLock_State integer iCol Boolean bState
   208      integer iOptions
   209      Get Column_Options item iCol to iOptions
   210      if bState ;
   211         Move (AddBitValue(CAPSLOCK_BIT_VALUE, iOptions)) To iOptions
   212      else ;
   213         Move (RemoveBitValue(CAPSLOCK_BIT_VALUE, iOptions)) to iOptions
   214      set Column_Options item iCol to iOptions
   215      // note we set form_options of local object not protype
   216      set form_Options item iCOl to iOptions
   217  End_Procedure
   218
   219  { MethodType=Property }
   220  Function Column_CapsLock_State integer iCol returns Boolean
   221      integer iOptions
   222      Get Column_Options item iCol to iOptions
   223      Function_Return ( (iOptions IAND CAPSLOCK_BIT_VALUE)<>0 )
   224  End_function
   225
   226  // Get/Set Column_Prompt_Object
   227  { MethodType=Property }
   228  { ColumnBased=True }
   229  { Category=Appearance }
   230  { InitialValue=0 }
   231  Procedure Set Column_Prompt_Object integer iCol Handle hObj
   232      Set Column_Message SET_Prompt_Object iCol to hObj
   233  End_Procedure
   234
   235  { MethodType=Property }
   236  Function Column_Prompt_Object integer iCol returns Handle
   237      Function_Return (Column_Message(self,GET_Prompt_Object,iCol))
   238  End_function
   239
   240  // Get/Set Column_Zoom_Object
   241  { MethodType=Property }
   242  { ColumnBased=True }
   243  { Category=Appearance }
   244  { InitialValue=0 }
   245  Procedure Set Column_Zoom_Object integer iCol Handle hObj
   246      Set Column_Message SET_Zoom_Object iCol to hObj
   247  End_Procedure
   248
   249  { MethodType=Property }
   250  Function Column_Zoom_Object integer iCol returns Handle
   251      Function_Return (Column_Message(self,GET_Zoom_Object,iCol))
   252  End_function
   253
   254  // Get/Set Column_Entry_msg
   255  { MethodType=Property }
   256  { ColumnBased=True }
   257  { InitialValue=0 }
   258  { Category=Data }
   259  Procedure Set Column_Entry_msg Integer iCol Handle hmMsg
   260      Set Column_Message SET_Item_Entry_msg iCol to hmMsg
   261  End_Procedure
   262
   263  { MethodType=Property }
   264  Function Column_Entry_msg integer iCol returns Handle
   265      Function_Return (Column_Message(self,GET_Item_entry_msg,iCol))
   266  End_function
   267
   268  // Get/Set Column_Exit_msg
   269  { MethodType=Property }
   270  { ColumnBased=True }
   271  { InitialValue=0 }
   272  { Category=Data }
   273  Procedure Set Column_Exit_msg Integer iCol Handle hmMsg
   274      Set Column_Message SET_Item_Exit_msg iCol to hmMsg
   275  End_Procedure
   276
   277  { MethodType=Property }
   278  Function Column_Exit_msg integer iCol returns Handle
   279      Function_Return (Column_Message(self,GET_Item_Exit_msg,iCol))
   280  End_function
   281
   282  // Get/Set Column_Validate_msg
   283  { MethodType=Property }
   284  { ColumnBased=True }
   285  { InitialValue=0 }
   286  { Category=Data }
   287  Procedure Set Column_Validate_msg Integer iCol Handle hmMsg
   288      Set Column_Message SET_Item_Validate_msg iCol to hmMsg
   289  End_Procedure
   290
   291  { MethodType=Property }
   292  Function Column_Validate_msg integer iCol returns Handle
   293      Function_Return (Column_Message(self,GET_Item_Validate_msg,iCol))
   294  End_function
   295
   296  // Get/Set Column_checkbox_state
   297  { MethodType=Property }
   298  { ColumnBased=True }
   299  { Category=Appearance }
   300  { InitialValue=False }
   301  Procedure set Column_Checkbox_State integer iCol Boolean bSelect
   302      integer hObj
   303      Get ProtoType_Object to hObj
   304      If hObj begin
   305          Set checkbox_item_state of hObj item iCol to bSelect
   306          Set entry_state         of hObj item iCol to (not(bSelect))
   307      end
   308  End_Procedure
   309
   310  { MethodType=Property }
   311  Function Column_Checkbox_State integer iCol returns Boolean
   312      Function_Return (Column_Message(self,GET_checkbox_item_state,iCol))
   313  End_function
   314
   315  // This can be called from with entry_display to display a
   316  // checkbox. This is used for non-data entry checkboxes (most
   317  // often in sel-lists).
   318  // Displays a checkbox for the item passed based on passed state.
   319  // Display different ckboxes for displayonly and not. This can be
   320  // sent to display a checkbox. If a developer wishes to use different
   321  // bitmaps, they can augment this message.
   322  procedure DoDisplayCheckBox integer iItm integer bSt
   323     integer bSh
   324     Get item_shadow_state item iItm to bSh
   325
   326     // JVH - this statement has been unraveled into conventional
   327     // If blocks because the IDE's Scan for Images parser is not
   328     // smart enough to process expressions. The Set statement must
   329     // also exist on its own line (not be preceded by an if).
   330//     set form_bitmap item iItm to ;
   331//        (if(bSt, if(bSh,"ChkOnD.bmp","ChkOnE.bmp"),;
   332//                 if(bSh,"ChkOffD.bmp","ChkOffE.bmp") ))
   333     If (bSt) Begin
   334        If (bsh) ;
   335            set form_bitmap item iItm to "ChkOnD.bmp"
   336        Else ;
   337            set form_bitmap item iItm to "ChkOnE.bmp"
   338     End
   339     Else Begin
   340        If (bsh) ;
   341            set form_bitmap item iItm to "ChkOffD.bmp"
   342        Else ;
   343            set form_bitmap item iItm to "ChkOffE.bmp"
   344     End
   345  end_procedure
   346
   347
   348  { Visibility=Private }
   349  Procedure SetVScrollInfo Integer iMin Integer iMax Integer iPage
   350    If not (CustomScrollState(self)) Begin
   351        If (batch_state(self)) begin
   352            // if batch, set range of 0 to numRows-1
   353            // If Thumb does lineup/down set page size to 1 (1 row)
   354            // If thumb does scroll set page size to number of displayable rows
   355            Move 0 to iMin
   356            Move (Row_Count(self)-1) to iMax
   357            Move (if(ThumbScrollState(self), displayable_rows(self), 1 )) to iPage
   358        end
   359        Else Begin
   360            // if virtual, set range 0 to number displayble row -1 (i.e. range is one screen)
   361            // Thumb is sized based on size of grid.
   362            // If rows are 1,2,3  a single size thumb is best. 2 rows will look bad -not centered
   363            // If row is 4, a double thumb is best because it can be centered
   364            // if row is 5, a single is best, it is centered with room on scroll bar for top/up/down/bottom
   365            // if row is 6 or >, use double thumb or triple thumb - we use what is needed to center the thumb
   366            Move 0 to iMin
   367            Move (displayable_rows(self)-1) to iMax
   368            Case Begin
   369                Case (iMax<3 or iMax=4)          Move 1 to iPage //1-3, 5 rows -little thumb
   370                Case (iMax=3)                    Move 2 to iPage // 4 rows - 2 thumb centers is
   371                Case (integer(iMax/2)<>iMax/2.0) Move 2 to iPage // if >6 and odd use double thumb
   372                Case else                        Move 3 to iPage // if >6 and even use triple thumb
   373            Case End
   374            // we need to keep track of the scroll range. used by ScrollPos. This # of scroll bar positions
   375            Set SBRange to (iMax-iPage+1)
   376            //showln ' post ' iMin ' ' iMax ' ' iPage
   377        End
   378    End
   379    Forward Send SetVScrollInfo iMin iMax iPage
   380  End_Procedure
   381
   382  { Visibility=Private }
   383  Procedure SetVScrollPos Integer iPos
   384        integer iRow iMax iPage
   385        If not (CustomScrollState(self)) Begin
   386
   387            If (batch_state(self)) begin
   388                // if thumb scroll use position from top of grid
   389                // if thumb line use passed value which is the current_item
   390                If (ThumbScrollState(self)) ;
   391                    Move (top_item(self)/line_size(self))to iPos
   392            end
   393            Else Begin
   394                // position thumb in middle unless the last find was at end.
   395                Get SBRange to iMax
   396                get current_row to iRow
   397                move (iMax/2) to iPos  // default guess for thumb is the center...it might change below
   398                If (FindAtEndState(self)) begin            // if last find was at end
   399                    If (LastFindLTState(self)) begin       // If at top and current row is 0, move thumb to top
   400                        if (iRow=0) move 0 to  iPos     // if not at top, we have moved off of the first row, use center
   401                        else set FindAtEndState to False   // and mark no longer at end
   402                    end
   403                    else begin                                          // if at end
   404                        If (iRow=row_count(Self)-1) move iMax to iPos   // if on last row we are at end of file, thumb to bottom
   405                        else set FindAtEndState to False                   // if not on last, we moved from last, use center, mark not at end
   406                    end
   407                    //if (FindAtEndState(self)) showln 'alter'
   408                end
   409                set CrntThumbPos to iPos // we need to know where the thumb is.
   410            End
   411            //    Showln "SetVScrollPos" iPos
   412        End
   413        Forward Send SetVScrollPos iPos
   414    End_Procedure
   415
   416  { Visibility=Private }
   417    Procedure SetVScrollbox Integer iType Integer iData
   418        integer iPos
   419        integer iTop bFast
   420        If not (CustomScrollState(self)) Begin
   421
   422            if (batch_state(self)) begin
   423                //Showln "SetVScrollBox" iType ", " iData
   424                If (iType=SB_THUMBPOSITION or iType=SB_THUMBTRACK) Begin
   425                    get ScrollOnThumbTrackState to bFast
   426                    If (( iType=SB_THUMBPOSITION and bFast) OR ;
   427                        (iType=SB_THUMBTRACK and not(bFast))) ;
   428                                procedure_return
   429                    If Not (ThumbScrollState(self)) ;
   430                        Move SB_THUMBPOSITION to iType  // will cuse RT to react
   431                    Else Begin
   432                        Move (Top_item(self)/line_size(self)) to iTop
   433                        If (iTop<>iData) Begin
   434                            If (iTop>iData) send scroll upward_direction (iTop-iData)
   435                            else            send Scroll downward_direction (iData-iTop)
   436                        End
   437                        procedure_return
   438                    End
   439                end
   440            end
   441            Else Begin
   442                If (iType=SB_THUMBPOSITION) begin
   443                    get CrntThumbPos to iPos
   444                    case begin
   445                        case (iData=0)               Send Beginning_of_Data
   446                        case (iData=SBRange(self)) Send End_of_Data
   447                        case (iData=iPos)
   448                                    procedure_return
   449                        case (iData<iPos)            Move SB_PAGEUP   to iType
   450                        case (iData>iPos)            Move SB_PAGEDOWN to iType
   451                    case end
   452                end
   453            End
   454        End
   455        Forward Send SetVScrollBox iType iData
   456    End_Procedure
   457
   458    // augment to set findatend. We use this to position the scrollbar
   459    { Visibility=Private }
   460    Procedure Read_Next_Record
   461        Forward Send Read_next_record
   462        Set FindAtEndState to (not(found))                      // did last find hit the end of the file
   463    End_Procedure                                            // note we do not know the direction
   464
   465    // augment to keep track of find direction, used by scrollbar
   466    { Visibility=Private }
   467    Procedure Establish_Find_Mode Integer mode
   468        Set LastFindLTState to (mode=LT or mode=LE)             // keep track of last find direction
   469        Forward Send Establish_Find_Mode mode
   470    End_Procedure
   471
   472    // augment to set last direction, find at end and trigger a scroll bar change
   473    { Visibility=Private }
   474    Procedure Beg_End_Data Integer Direction Integer NoSave
   475        forward send beg_end_Data direction nosave
   476        set LastFindLTState to (direction=Downward_direction)   // last find direction
   477        set FindAtEndState to True                              // last find at end of file
   478        send SetVscrollPos (current_row(self))               // force scroll bar position to update itself
   479    end_procedure
   480
   481    // augment to set scroll info (it is needed to set the thumb)
   482  { Visibility=Private }
   483    Function Load_Page Integer Row# Returns Integer
   484        integer iRet
   485        forward get load_page row# to iRet
   486        // force this message to make the thumb current.
   487        // EntryList class does not do this automatically
   488        if (batch_state(self)) send SetVScrollInfo 0 0 0
   489        function_return iRet
   490    end_function
   491
   492    // Private: JJT 8/11/00 This fixes a RT behavior where the edit window updates the wrong
   493    // grid item after an insert. When you insert if the current item has an edit window (i.e.
   494    // entry_state is true). Then it inserts the row so the current_item is incremented by a row
   495    // but it moves the edit window value back to old current_item. This shuts off the edit window
   496    // before it does this. The window comes back by itself.
   497    Define TBM_EDITON for (WM_USER+9)   // private definition, not for developers
   498   { Visibility=Private }
   499    procedure Insert_Row integer row#
   500        send windows_message TBM_EDITON false 0 // kill edit window, if needed.
   501        forward send insert_row row#
   502    end_procedure
   503
   504    // prompt and spin button messages for columns
   505    //
   506    // Get/set Column_Button to FORM_BUTTON_NONE|FORM_BUTTON_PROMPT|FORM_BUTTON_SPIN|FORM_BUTTON_SPIN_WRAP
   507    // get/set Column_Minumum_position
   508    // get/set Column_Maximum_position
   509
   510    { MethodType=Property }
   511    Function Column_Button integer iCol returns integer
   512        integer eMode
   513        Get Form_Button iCol to eMode
   514        function_return eMode
   515    End_Function
   516
   517    { MethodType=Property }
   518    { ColumnBased=True }
   519    { Category=Appearance }
   520    { EnumList="Form_Button_None, Form_Button_Prompt, Form_Button_Spin, Form_Button_Spin_Wrap" }
   521    { InitialValue=Form_Button_None }
   522    Procedure Set Column_Button integer iCol integer eMode
   523        Set Form_Button iCol to eMode
   524    End_Procedure
   525
   526    { MethodType=Property }
   527    Function Column_Minimum_Position integer iCol returns integer
   528        String sPos
   529        Get Value of oColParams (iCol*oCOLPARAMS_ITEMS+0) to sPos
   530        // if array value is blank, it was not defined, in such a case dflt to minimum
   531        If (sPos="") Begin
   532            Move "-32767" to sPos
   533            Set Column_minimum_position iCol to -32767
   534        End
   535        function_return (integer(sPos))
   536    end_function
   537
   538    { MethodType=Property }
   539    { ColumnBased=True }
   540    { Category=Behavior }
   541    { InitialValue=-32767 }
   542    Procedure set Column_Minimum_Position integer iCol integer iPos
   543        Set Value of oColParams (iCol*oCOLPARAMS_ITEMS+0) to iPos
   544    end_Procedure
   545
   546    { MethodType=Property }
   547    Function Column_Maximum_Position integer iCol returns integer
   548        String sPos
   549        Get Value of oColParams (iCol*oCOLPARAMS_ITEMS+1) to sPos
   550        // if array value is blank, it was not defined, in such a case dflt to maximum
   551        If (sPos="") Begin
   552            Move "32767" to sPos
   553            Set Column_maximum_position iCol to 32767
   554        End
   555        function_return (integer(sPos))
   556    end_function
   557
   558    { MethodType=Property }
   559    { ColumnBased=True }
   560    { Category=Behavior }
   561    { InitialValue=32767 }
   562    Procedure set Column_Maximum_Position integer iCol integer iPos
   563        Set Value of oColParams (iCol*oCOLPARAMS_ITEMS+1) to iPos
   564    end_Procedure
   565
   566    { MethodType=Event }
   567    Procedure OnInitSpin
   568        integer iCol
   569        Get Current_Col to iCol
   570        set minimum_position to (Column_minimum_position(self,iCol))
   571        set maximum_position to (Column_maximum_position(self,iCol))
   572    End_procedure
   573
   574   // augment to always force the first column to be visible. This will occur during a
   575   // panels clear or save. It makes sense to restore the column. If you do no want this
   576   // behavior just cancel it.
   577    { MethodType=Event }
   578   Procedure OnBeginningOfPanel
   579       Send DoMakeColumnVisible 0
   580    end_procedure
   581
   582    // augmented to change ordering direction of pbHeaderTogglesDirection is set.
   583    // Only do this if the selected column is already the selected column, if not
   584    // forward, which will do the normal column change and new index thing, if needed.
   585    { MethodType=Event }
   586    Procedure Header_Mouse_Click Integer iItem
   587        if (pbHeaderTogglesDirection(self) and ;
   588                focus(desktop)=self and current_col(self)=iItem) ;
   589            Send DoToggleColumnOrdering iItem
   590        else ;
   591            forward send Header_mouse_Click iItem
   592    End_Procedure
   593
   594    // the DFBaseEntryList class has it's own special Set_Top_item message (as of 9.0) which does not
   595    // set current_item. When used for non-batch lists, we don't want the set_current_item and
   596    // that is why it was removed. This fixes a problem when scrolling down/up when the entire
   597    // grid is shifted horizontally to the right. When you scroll, the grid would shift to col 0.
   598    // However, with batch lists we want the normal set_top_item or we get other problems. So we
   599    // we modify the method here to make it do a normal top_item (ie. set current_item).
   600    { MethodType=Property  NoDoc=True }
   601    procedure set top_item integer iNewTop integer iNewCurrent
   602        forward set top_item to iNewTop // we know the C code augmentation ignores any 2nd param
   603        // if batch, make this work like normal top_item and set current_item
   604        if (batch_state(self) and Item_count(self)) ;
   605            set current_item to (if(num_arguments=1,iNewTop,iNewCurrent))
   606    end_procedure
   607
   608
   609End_Class
   610
   611//
   612// use this to catch any obsolete object line startmac usage
   613//
   614#COMMAND dlStart R R
   615  FORWARD_BEGIN_CONSTRUCT !1 !2
   616  bind_using !3 !4 !5 !6 !7 !8 !9
   617  bind_datalist_main_file !3 !4 !5 !6 !7 !8 !9
   618  bind_datalist_index !3 !4 !5 !6 !7 !8 !9
   619  bind_batch !3 !4 !5 !6 !7 !8 !9
   620#ENDCOMMAND
   621
   622#COMMAND Bind_Batch
   623  #IF (!0>0)
   624    #IFSAME !1 BATCH VIRTUAL
   625      #ERROR DFERR_COMP_OBSOLETE_UNSUPPORTED_FEATURE "Batch object syntax is no longer supported. Use Set Batch_state instead." 
   626      //#IFSAME !1 BATCH
   627        //set Batch_State to true
   628      //#ELSE
   629        //set Batch_State to false
   630      //#ENDIF
   631    #ELSE
   632      Bind_Batch !2 !3 !4 !5 !6 !7 !8 !9
   633    #ENDIF
   634  #ENDIF
   635#ENDCOMMAND
   636
   637#COMMAND Bind_Static
   638  #IF (!0>0)
   639    #IFSAME !1 STATIC
   640      #ERROR DFERR_COMP_OBSOLETE_UNSUPPORTED_FEATURE "Static object syntax is no longer supported. Use Set Static_state instead." 
   641      //set Batch_State to true
   642      //set Static_State to true
   643    #ELSE
   644      Bind_Static !2 !3 !4 !5 !6 !7 !8 !9
   645    #ENDIF
   646  #ENDIF
   647#ENDCOMMAND
   648
   649#COMMAND bind_datalist_index
   650  #IF (!0>1)
   651    #IFSAME !1 BY
   652      #ERROR DFERR_COMP_OBSOLETE_UNSUPPORTED_FEATURE "By Index object syntax is no longer supported. Use Set Ordering instead." 
   653      //set ordering to !2
   654    #ELSE
   655      bind_datalist_index !2 !3 !4 !5 !6 !7 !8 !9
   656    #ENDIF
   657  #ENDIF
   658#ENDCOMMAND
   659
   660#COMMAND bind_datalist_main_file
   661  #IF (!0>1)
   662    #IFSAME !1 MAIN_FILE
   663      #ERROR DFERR_COMP_OBSOLETE_UNSUPPORTED_FEATURE "Main_file object syntax is no longer supported. Use Set Main_file instead." 
   664      //#PUSH !u
   665      //#SET U$ !2.RECNUM
   666      //set main_file to |CI!u
   667      //#POP U$
   668    #ELSE
   669      bind_datalist_main_file !2 !3 !4 !5 !6 !7 !8 !9
   670    #ENDIF
   671  #ENDIF
   672#ENDCOMMAND
   673