Module cCJGridColumn.pkg

     1Use UI
     2Use cCJReportControl.pkg
     3Use cCJGridDataSource.pkg
     4Use cCJGridColumnEdit.pkg
     5Use CharTranslate.pkg
     6
     7External_Function SysAllocString "SysAllocString" oleaut32.dll Pointer pStr Returns Pointer
     8
     9{ Visibility=Private }
    10Procedure Set ComUText for cCJReportRecordItemMetrics Variant vValue
    11    Set ComProperty of (phDispatchDriver(Self)) 4 OLE_VT_Variant to vValue
    12End_Procedure
    13    
    14
    15
    16// tComboItemData:
    17// Data stored for each combo item in a combo list (also know as constraints in the CodeJock documentation).
    18Struct tComboItemData
    19    String sCaption   // Value displayed in the combo list
    20    Integer iData     // Value returned for the selected item
    21End_Struct
    22
    23Define xtpButtonExpand for 100    // Expand Button type of in place button
    24Define xtpButtonCombo  for 101    // Combo Button type of in place button 
    25
    26Define xtpAlignmentDefault for -1 // Column Alignment default value (used to set the column alignment to it's class default - only used in Header and footer aligmnent)
    27
    28// cGridColumn
    29// -------------
    30// Wraps the interface for each grid column.
    31
    32{ DesignerClass=cDTCJGridColumn } 
    33{ HelpTopic=cCJGridColumn }
    34{ OverrideProperty=psLicenseKey DesignTime=False }
    35{ OverrideProperty=psProgID DesignTime=False }
    36{ OverrideProperty=peAutoCreate DesignTime=False }
    37{ OverrideProperty=peNeighborhood DesignTime=False }
    38
    39Class cCJGridColumn is a cCJReportColumn
    40
    41    Procedure Construct_Object
    42        Forward Send Construct_Object 
    43
    44        // Create an edit options object for the column. The pvComObject for this child object
    45        // is assigned during OnCreate of the parent grid object....
    46        { DesignTime = False }
    47        Property Handle phoEditOptions (Create(Self,RefClass(cCJReportRecordItemEditOptions)))     // ReportRecordItemEditOptions for the column
    48        
    49        // Create a constraints object for the column. The pvComObject for this child object
    50        // is assigned during OnCreate of the parent grid object....
    51        { DesignTime = False }
    52        Property Handle phoConstraints (Create(Self,RefClass(cCJReportRecordItemConstraints)))     // ReportRecordItemConstraints for the column
    53        
    54        // Grid Column Properties (private with Get/Set methods)....
    55        { Visibility=Private }
    56        Property Integer private_Color clNone              // specifies the column's background color (clNone = use Grid's Color)
    57
    58        { Visibility=Private }
    59        Property Boolean private_pbAllowDrag True             // Allows\Disallows dragging of the column, see ReportColumn.AllowDrag
    60        { Visibility=Private }
    61        Property Boolean private_pbAllowRemove True           // Specifies whether the column can be removed from the grid at runtime, see ReportColumn.AllowRemove
    62        { Visibility=Private }
    63        Property Boolean private_pbCapslock False
    64        { Visibility=Private }
    65        Property Boolean private_pbComboButton False          // Specifies whether the Items in the column display a combo button when selected. See ReportRecordItemEditOptions.AddComboButton
    66        { Visibility=Private }
    67        Property Boolean private_pbComboEntryState True       // Similar to VDF Grid.Column_Combo_Entry_State. See ReportRecordItemEditOptions.ConstraintEdit
    68        { Visibility=Private }
    69        Property Boolean private_pbDrawFooterDivider True     // Specifies whether a divider is drawn between column footers, see ReportColumn.DrawFooterDivider
    70        { Visibility=Private }
    71        Property Boolean private_pbDrawHeaderDivider True     // Specifies whether the divider is drawn Between column headers. See ReportColumn.DrawHeaderDivider
    72        { Visibility=Private }
    73        Property Boolean private_pbEditable True              // Specifies whether the Items in the column can be edited. See ReportColumn.Editable and ReportRecordItemEditOptions.AllowEdit
    74        { Visibility=Private }
    75        Property Boolean private_pbMultiLine False            // Indicates whether the column supports multi-line rows. See ReportColumn.Alignment
    76        { Visibility=Private }
    77        Property Boolean private_pbResizable True             // Indicates whether the column is resizable. See ReportColumn.Resizable
    78        { Visibility=Private }
    79        Property Boolean private_pbShowInFieldChooser True    // Indicates If a column will appear in the FieldChooser when the column is hidden. See See ReportColumn.ShowInFieldChooser.
    80        { Visibility=Private }
    81        Property Boolean private_pbVisible True               // Specifies whether the column is visible in the ReportControl. See ReportColumn.Visible
    82        { Visibility=Private }
    83        Property Integer private_peDataType Ascii_Window
    84        { Visibility=Private }
    85        Property XTPColumnAlignment private_peFooterAlignment xtpAlignmentDefault // Specifies the column footer text alignment. See ReportColumn.FooterAlignment
    86        { Visibility=Private }
    87        Property XTPColumnAlignment private_peHeaderAlignment xtpAlignmentDefault // Specifies the column header text alignment. See ReportColumn.HeaderAlignment 
    88        { Visibility=Private }
    89        Property XTPColumnAlignment private_peIconAlignment xtpAlignmentLeft  // column icon alignment. See ReportColumn.Alignment
    90        { Visibility=Private }
    91        Property XTPColumnAlignment private_peTextAlignment xtpAlignmentLeft  // column text alignment. See ReportColumn.Alignment
    92        { Visibility=Private }
    93        Property Boolean pbTextAlignmentSet False
    94        { Visibility=Private }
    95        Property Boolean pbIconAlignmentSet False             // Tracks whether peIconAlignment has been explicitly set.
    96
    97        { Visibility=Private }
    98        Property Integer private_piIcon 0                     // (internal) Icon ID of the image to display in column header, psImage (above)
    99        { Visibility=Private }
   100        Property Integer private_piMaximumWidth 0             // Maximum column width (If Set as positive).  This only applies when AutoSize is False. See ReportColumn.MaximumWidth 
   101        { Visibility=Private }
   102        Property Integer private_piMaxLength 0                // the maximum number of characters that can be entered when editing an item. See ReportControlItemEditOptions.MaxLength
   103        { Visibility=Private }
   104        Property Integer private_piMinimumWidth 0             // Specifies the minimum width that a column can be sized to If resizable. See ReportColumn.MinimumWidth
   105        { Visibility=Private }
   106        Property Integer private_piWidth 0                    // Specifies the minimal default column width. See ReportColumn.Width 
   107        { Visibility=Private }
   108        Property String private_psCaption ""                  // Text caption for the column header, see ReportColumn.Caption 
   109        { Visibility=Private }
   110        Property String private_psFooterText ""               // The text that is displayed in the column's footer. see ReportColumn.FooterText
   111        { Visibility=Private }
   112        Property String private_psImage ""                    // Image to display in column header, see ReportColumn.Icon
   113        { Visibility=Private }
   114        Property String private_psMask ""                     // Specifies the mask token characters. See VDF Grid, Form_Mask
   115        { Visibility=Private }
   116        Property String private_psTooltip ""                  // Tool tip that is displayed when the mouse cursor is positioned over the column header. See ReportColumn.Tooltip
   117        { Visibility=Private }
   118        Property Integer private_TextColor clNone          // specifies the column's text color (clNone = use Grid's Color)
   119        { Visibility=Private }
   120        Property Integer private_piDisabledColor clNone      // specifies the disabled column's background color (clNone = use Column Color)
   121        { Visibility=Private }
   122        Property Integer private_piDisabledTextColor clDkGray // specifies the disabed column's text color (clNone = use Column Color)
   123        { Visibility=Private }
   124        Property Boolean private_pbCheckbox False              // Specifies whether the column contains a CheckBox. See ReportRecordItem.HasCheckbox
   125
   126        { Category=Behavior }
   127        Property Boolean pbFocusable True                      // Specifies whether the column can have focus. See ReportRecordItem.Focusable
   128        { Category=Behavior }
   129        Property Boolean pbVDFEditControl True // if set false, it will use the codejock edit control
   130        { Category=Behavior }
   131        Property String psCheckboxTrue "1"
   132        { Category=Behavior }
   133        Property String psCheckboxFalse "0"
   134        { Category=Appearance }
   135        { EnumList="PB_PromptAuto, PB_PromptOn, PB_PromptOff" }
   136        Property Integer Prompt_Button_Mode PB_PromptAuto
   137        { Category=Appearance }
   138        Property String Prompt_Button_Value "..."
   139        { Visibility=Private }
   140        Property String private_Status_Help
   141
   142        { Visibility=Private }
   143        Property Handle phoMaskForm (Create( Self, RefClass(DfBaseForm))) // control needed to handle masking
   144        { DesignTime=False }
   145        Property Handle phcEditClass (RefClass(cCJGridColumnEdit))
   146        { Visibility=Private }
   147        Property Handle phoDataSourceColumnClass (Create(Self, RefClass(cCJGridDataSourceColumn)))
   148
   149        { Visibility=Private }
   150        Property Handle private_Prompt_Object 0
   151        { Visibility=Private }
   152        Property Handle private_Zoom_Object 0
   153        { Visibility=Private }
   154        Property Handle phoEdit 0
   155
   156        { Visibility=Private }
   157        Property tComboItemData[] pComboItemData              // Used to store combo list items before the COM object has been instanciated.
   158
   159        // these can be set via entry_item command
   160        { DesignTime=False }
   161        Property Integer piBindingTable 0
   162        { DesignTime=False }
   163        Property Integer piBindingColumn 0
   164
   165        { DesignTime=False }
   166        Property Integer piColumnId -1 // will be assigned when the grid is registered belowd
   167
   168        // Add myself to the parent Grid object's columns collection....
   169        Delegate Send RegisterColumn Self
   170
   171    End_Procedure
   172
   173    // ========================================================================================
   174    // Property Get/Set Methods................................................................
   175    // ========================================================================================
   176
   177    
   178    // Color:
   179    
   180    // specifies the column's background color (clNone = use Grid's Color)
   181    { MethodType=Property InitialValue=clNone }
   182    { PropertyType=Color Category=Appearance }
   183    { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
   184    { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
   185    { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
   186    Procedure Set Color Integer iValue
   187        Set private_Color to iValue
   188        
   189        If (IsComObjectCreated(Self)) Begin
   190            Delegate Send DeferredRedraw // ComRedraw
   191        End
   192    End_Procedure
   193    
   194    { MethodType=Property }
   195    Function Color Returns Integer
   196        Integer iValue
   197        Get private_Color to iValue
   198        Function_Return iValue
   199    End_Function
   200
   201    // piDisabledColor:
   202    
   203    // specifies the column's disabled background color (clNone = use Grid's Color)
   204    { MethodType=Property InitialValue=clNone }
   205    { PropertyType=Color Category=Appearance }
   206    { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
   207    { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
   208    { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
   209    Procedure Set piDisabledColor Integer iValue
   210        Set private_piDisabledColor to iValue
   211        
   212        If (IsComObjectCreated(Self)) Begin
   213            Delegate Send DeferredRedraw // ComRedraw
   214        End
   215    End_Procedure
   216    
   217    { MethodType=Property }
   218    Function piDisabledColor Returns Integer
   219        Integer iValue
   220        Get private_piDisabledColor to iValue
   221        Function_Return iValue
   222    End_Function
   223
   224    // piDisabledTextColor:
   225    
   226    // specifies the column's disabled text color (clNone = use Grid's Color)
   227    { MethodType=Property InitialValue=clDkGray }
   228    { PropertyType=Color Category=Appearance }
   229    { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
   230    { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
   231    { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
   232    Procedure Set piDisabledTextColor Integer iValue
   233        Set private_piDisabledTextColor to iValue
   234        
   235        If (IsComObjectCreated(Self)) Begin
   236            Delegate Send DeferredRedraw // ComRedraw
   237        End
   238    End_Procedure
   239    
   240    { MethodType=Property }
   241    Function piDisabledTextColor Returns Integer
   242        Integer iValue
   243        Get private_piDisabledTextColor to iValue
   244        Function_Return iValue
   245    End_Function
   246
   247
   248    // pbAllowDrag
   249
   250    // Allows\Disallows dragging of the column, see ReportColumn.AllowDrag
   251    { MethodType=Property InitialValue=True } 
   252    { Category=Behavior }
   253    Procedure Set pbAllowDrag Boolean bValue
   254        Set private_pbAllowDrag to bValue
   255        
   256        If (IsComObjectCreated(Self)) Begin
   257            Set ComAllowDrag to bValue
   258        End
   259    End_Procedure
   260    
   261    { MethodType=Property }
   262    Function pbAllowDrag Returns Boolean
   263        Boolean bValue
   264        If (IsComObjectCreated(Self)) Begin
   265            Get ComAllowDrag to bValue
   266        End
   267        Else Begin
   268            Get private_pbAllowDrag to bValue
   269        End
   270        Function_Return bValue
   271    End_Function
   272
   273
   274    // pbAllowRemove
   275
   276    // Allows\Disallows removing of the column, see ReportColumn.AllowRemove
   277    { MethodType=Property InitialValue=True } 
   278    { Category=Behavior }
   279    Procedure Set pbAllowRemove Boolean bValue
   280        Set private_pbAllowRemove to bValue
   281        
   282        If (IsComObjectCreated(Self)) Begin
   283            Set ComAllowRemove to bValue
   284        End
   285    End_Procedure
   286    
   287    { MethodType=Property }
   288    Function pbAllowRemove Returns Boolean
   289        Boolean bValue
   290        If (IsComObjectCreated(Self)) Begin
   291            Get ComAllowRemove to bValue
   292        End
   293        Else Begin
   294            Get private_pbAllowRemove to bValue
   295        End
   296        Function_Return bValue
   297    End_Function
   298    
   299    // pbCapslock
   300
   301    // Set True to force data entry in this column to uppercase characters.
   302    { MethodType=Property InitialValue=False }
   303    { Category=Behavior }
   304    Procedure Set pbCapslock Boolean bOn
   305        Integer iValue
   306        Handle hoEditOptions
   307
   308        Set private_pbCapslock to bOn
   309        
   310        If (IsComObjectCreated(Self)) Begin
   311            Get phoEditOptions to hoEditOptions
   312            Get ComEditControlStyle of hoEditOptions to iValue
   313            If bOn Begin
   314                Move (AddBitValue(xtpEditStyleUppercase,iValue)) to iValue
   315            End
   316            Else Begin
   317                Move (RemoveBitValue(xtpEditStyleUppercase,iValue)) to iValue
   318            End
   319            Set ComEditControlStyle of hoEditOptions to iValue
   320        End
   321    End_Procedure
   322
   323    { MethodType=Property }
   324    Function pbCapslock Returns Integer
   325        Boolean bOn
   326        Integer iValue
   327        Handle hoEditOptions
   328
   329        If (IsComObjectCreated(Self)) Begin
   330            Get phoEditOptions to hoEditOptions
   331            Get ComEditControlStyle of hoEditOptions to iValue
   332            Move (iValue iand xtpEditStyleUppercase) to bOn
   333        End
   334        Else Begin
   335            Get private_pbCapslock to bOn
   336        End
   337        Function_Return bOn
   338    End_Function
   339    
   340    // pbCheckbox
   341    
   342    // Specifies whether the column contains a CheckBox. See ReportRecordItem.HasCheckbox
   343    { MethodType=Property InitialValue=False }
   344    { Category=Appearance }
   345    Procedure Set pbCheckbox Boolean bValue
   346        Boolean bAlignmentSet
   347
   348        Set private_pbCheckbox to bValue
   349        
   350        // Try to implicitly set the icon alignment to center....
   351        Get pbIconAlignmentSet to bAlignmentSet
   352        If (not(bAlignmentSet)) Begin
   353            Set peIconAlignment to (xtpAlignmentIconCenter + xtpAlignmentIconVCenter)
   354            Set pbIconAlignmentSet to False // we want it to still be implicitly settable
   355        End
   356    End_Procedure
   357    
   358    { MethodType=Property }
   359    Function pbCheckbox Returns Boolean
   360        Boolean bValue
   361        Get private_pbCheckbox to bValue
   362        Function_Return bValue
   363    End_Function
   364
   365    // pbComboButton
   366
   367    // Specifies whether a combo control is used to edit this column.
   368    { MethodType=Property InitialValue=False }
   369    { Category=Behavior }
   370    Procedure Set pbComboButton Boolean bValue
   371        Handle hoEditOptions 
   372         
   373        Set private_pbComboButton to bValue
   374        
   375        If (IsComObjectCreated(Self)) Begin
   376            // Make sure we start out with no buttons at all (we only support one button at a time)....
   377            Get phoEditOptions to hoEditOptions
   378            Send ComRemoveButtons to hoEditOptions
   379            
   380            // If setting to true then create the button....
   381            If (bValue) Begin
   382                Send ComAddComboButton to hoEditOptions True     // True = put button inside cell. 
   383            End
   384        End
   385    End_Procedure
   386    
   387    { MethodType=Property }
   388    Function pbComboButton Returns Boolean
   389        Boolean bValue
   390        Get private_pbComboButton to bValue
   391        Function_Return bValue
   392    End_Function
   393
   394    // pbComboEntryState
   395
   396    // Similar to VDF Grid.Column_Combo_Entry_State. See ReportRecordItemEditOptions.ConstraintEdit
   397    { MethodType=Property InitialValue=True }
   398    { Category=Behavior }
   399    Procedure Set pbComboEntryState Boolean bValue
   400        Handle hoEditOptions
   401
   402        Set private_pbComboEntryState to bValue
   403        
   404        If (IsComObjectCreated(Self)) Begin
   405            Get phoEditOptions to hoEditOptions 
   406            Set ComConstraintEdit of hoEditOptions to (not(bValue))
   407        End
   408    End_Procedure
   409    
   410    { MethodType=Property }
   411    Function pbComboEntryState Returns Boolean
   412        Boolean bValue
   413        Handle hoEditOptions
   414
   415        If (IsComObjectCreated(Self)) Begin
   416            Get phoEditOptions to hoEditOptions 
   417            Get ComConstraintEdit of hoEditOptions to bValue
   418            Move (not(bValue)) to bValue
   419        End
   420        Else Begin
   421            Get private_pbComboEntryState to bValue
   422        End
   423        Function_Return bValue
   424    End_Function
   425
   426    // pbDrawFooterDivider
   427
   428    // Specifies whether a divider is drawn between column footers, see ReportColumn.DrawFooterDivider.
   429    { MethodType=Property InitialValue=True }
   430    { Category=Appearance }
   431    Procedure Set pbDrawFooterDivider Boolean bValue
   432        Set private_pbDrawFooterDivider to bValue
   433        
   434        If (IsComObjectCreated(Self)) Begin
   435            Set ComDrawFooterDivider to bValue
   436        End
   437    End_Procedure
   438    
   439    { MethodType=Property }
   440    Function pbDrawFooterDivider Returns Boolean
   441        Boolean bValue
   442        If (IsComObjectCreated(Self)) Begin
   443            Get ComDrawFooterDivider to bValue
   444        End
   445        Else Begin
   446            Get private_pbDrawFooterDivider to bValue
   447        End
   448        Function_Return bValue
   449    End_Function
   450    
   451    // pbDrawHeaderDivider
   452
   453    // Specifies whether the divider is drawn Between column headers. See ReportColumn.DrawHeaderDivider
   454    { MethodType=Property InitialValue=True }
   455    { Category=Appearance }
   456    Procedure Set pbDrawHeaderDivider Boolean bValue
   457        Set private_pbDrawHeaderDivider to bValue
   458        
   459        If (IsComObjectCreated(Self)) Begin
   460            Set ComDrawHeaderDivider to bValue
   461        End
   462    End_Procedure
   463    
   464    { MethodType=Property }
   465    Function pbDrawHeaderDivider Returns Boolean
   466        Boolean bValue
   467        If (IsComObjectCreated(Self)) Begin
   468            Get ComDrawHeaderDivider to bValue
   469        End
   470        Else Begin
   471            Get private_pbDrawHeaderDivider to bValue
   472        End
   473        Function_Return bValue
   474    End_Function
   475
   476    // pbEditable:
   477
   478    // Specifies whether the Items in the column can be edited. See ReportColumn.Editable and ReportRecordItemEditOptions.AllowEdit
   479    { MethodType=Property InitialValue=True }
   480    { Category=Behavior }
   481    Procedure Set pbEditable Boolean bValue
   482        Set private_pbEditable to bValue
   483        
   484        If (IsComObjectCreated(Self)) Begin
   485            Set ComEditable to bValue
   486        End
   487    End_Procedure
   488    
   489    { MethodType=Property }
   490    Function pbEditable Returns Boolean
   491        Boolean bValue
   492        If (IsComObjectCreated(Self)) Begin
   493            Get ComEditable to bValue
   494        End
   495        Else Begin
   496            Get private_pbEditable to bValue
   497        End
   498        Function_Return bValue
   499    End_Function
   500    
   501    // pbMultiLine
   502    
   503    // Indicates whether the column supports multi-line rows. See ReportColumn.Alignment
   504    { MethodType=Property InitialValue=False }
   505    { Category=Appearance }
   506    Procedure Set pbMultiLine Boolean bValue 
   507        Integer eTextAlignment eIconAlignment eCurrentAlignment eWordBreak
   508        
   509        Set private_pbMultiLine to bValue
   510        
   511        If (IsComObjectCreated(Self)) Begin
   512            // Preserve the current allignment flags....
   513            Get ComAlignment to eCurrentAlignment
   514            Move (eCurrentAlignment iand xtpAlignmentTextMask) to eTextAlignment
   515            Move (RemoveBitValue(xtpAlignmentWordBreak, eTextAlignment)) to eTextAlignment    // preserve all text alignment flags except WordBreak
   516            Move (RemoveBitValue(xtpAlignmentTextMask, eCurrentAlignment)) to eIconAlignment
   517            
   518            // Set the alignment value....
   519            Move 0 to eWordBreak
   520            If (bValue) Begin
   521                Move xtpAlignmentWordBreak to eWordBreak 
   522                Delegate Send AllowMultiLineCells    // Ensures that multi-line rows are handled by the grid (slows down grid painting).
   523            End
   524            
   525            Set ComAlignment to (eTextAlignment ior eWordBreak ior eIconAlignment)
   526            Delegate Send DeferredRedraw // ComRedraw
   527        End
   528    End_Procedure
   529    
   530    { MethodType=Property }
   531    Function pbMultiLine Returns Boolean
   532        Boolean bValue
   533        Integer eCurrentAlignment
   534
   535        If (IsComObjectCreated(Self)) Begin
   536            Get ComAlignment to eCurrentAlignment
   537            Move (eCurrentAlignment iand xtpAlignmentWordBreak) to bValue
   538        End
   539        Else Begin
   540            Get private_pbMultiLine to bValue
   541        End
   542        Function_Return bValue
   543    End_Function
   544    
   545    // pbResizable:
   546
   547    // Indicates whether the column is resizable. See ReportColumn.Resizable
   548    { MethodType=Property InitialValue=True }
   549    { Category=Behavior }
   550    Procedure Set pbResizable Boolean bValue
   551        Set private_pbResizable to bValue
   552        
   553        If (IsComObjectCreated(Self)) Begin
   554            Set ComResizable to bValue
   555        End
   556    End_Procedure
   557    
   558    { MethodType=Property }
   559    Function pbResizable Returns Boolean
   560        Boolean bValue
   561        If (IsComObjectCreated(Self)) Begin
   562            Get ComResizable to bValue
   563        End
   564        Else Begin
   565            Get private_pbResizable to bValue
   566        End
   567        Function_Return bValue
   568    End_Function
   569
   570    // pbShowInFieldChooser
   571    
   572    // Indicates If a column will appear in the FieldChooser when the column is hidden. See See ReportColumn.ShowInFieldChooser.
   573    { MethodType=Property InitialValue=True }
   574    { Category=Behavior }
   575    Procedure Set pbShowInFieldChooser Boolean bValue
   576        Set private_pbShowInFieldChooser to bValue
   577        
   578        If (IsComObjectCreated(Self)) Begin
   579            Set ComShowInFieldChooser to bValue
   580        End
   581    End_Procedure
   582    
   583    { MethodType=Property }
   584    Function pbShowInFieldChooser Returns Boolean
   585        Boolean bValue
   586        If (IsComObjectCreated(Self)) Begin
   587            Get ComShowInFieldChooser to bValue
   588        End
   589        Else Begin
   590            Get private_pbShowInFieldChooser to bValue
   591        End
   592        Function_Return bValue
   593    End_Function
   594    
   595    // pbVisible
   596    
   597    // Specifies whether the column is visible in the ReportControl. See ReportColumn.Visible
   598    { MethodType=Property InitialValue=True }
   599    { Category=Appearance }
   600    Procedure Set pbVisible Boolean bValue
   601        Set private_pbVisible to bValue
   602        
   603        If (IsComObjectCreated(Self)) Begin
   604            Set ComVisible to bValue
   605        End
   606    End_Procedure
   607    
   608    { MethodType=Property }
   609    Function pbVisible Returns Boolean
   610        Boolean bValue
   611        If (IsComObjectCreated(Self)) Begin
   612            Get ComVisible to bValue
   613        End
   614        Else Begin
   615            Get private_pbVisible to bValue
   616        End
   617        Function_Return bValue
   618    End_Function
   619    
   620    // peDataType
   621    
   622    { MethodType=Property }
   623    { Category=Behavior }
   624    { PropertyType=FormDataType }
   625    { InitialValue=Ascii_window }
   626    { EnumList="Mask_Window, Mask_Numeric_Window, Mask_Date_Window, Mask_Datetime_Window, Mask_Currency_Window, Ascii_Window, Date_Window, 0, 1, 2, 3, 4, 5, 6, 7, 8"}
   627    Procedure Set peDataType Integer eType
   628        Boolean bAlignmentSet
   629        Set private_peDataType to eType
   630        If (eType<Ascii_Window or eType=Mask_Numeric_Window or eType=Mask_Currency_Window) Begin
   631            Get pbTextAlignmentSet to bAlignmentSet
   632            If not bAlignmentSet Begin
   633                Set peTextAlignment to xtpAlignmentRight
   634                Set pbtextAlignmentSet to False // we want it to still be automatically settable
   635            End
   636        End
   637    End_Procedure
   638
   639    { MethodType=Property }
   640    Function peDataType Returns Integer
   641        Integer eType
   642        Get private_peDataType to eType
   643        Function_Return eType
   644    End_Procedure
   645
   646    // peIconAlignment:
   647    
   648    // Column alignment. See ReportColumn.Alignment
   649    { MethodType=Property InitialValue=xtpAlignmentLeft }
   650    { EnumList= "xtpAlignmentIconLeft, xtpAlignmentIconCenter, xtpAlignmentIconRight, xtpAlignmentIconTop, xtpAlignmentIconVCenter, xtpAlignmentIconBottom" }
   651    { Category=Appearance }
   652    Procedure Set peIconAlignment XTPColumnAlignment eValue
   653        Integer eTextAlignment eIconAlignment eCurrentAlignment eWordBreak
   654         
   655        Set private_peIconAlignment to eValue
   656
   657        // Once the alignment has been explicitly set, we will not change it. If it is set as part
   658        // of set pbCheckbox it has not been explicitly set (pbCheckbox will clear this)
   659        Set pbIconAlignmentSet to True 
   660
   661        If (IsComObjectCreated(Self)) Begin
   662            Get ComAlignment to eCurrentAlignment
   663            Move (eCurrentAlignment iand xtpAlignmentWordBreak) to eWordBreak     // ensure we preserve the current word break flag
   664            Move (eCurrentAlignment iand xtpAlignmentTextMask) to eTextAlignment  // preserve the text alignment flags
   665            Set ComAlignment to (eValue ior eWordBreak ior eTextAlignment)
   666            Delegate Send DeferredRedraw // ComRedraw
   667        End
   668    End_Procedure
   669    
   670    { MethodType=Property }
   671    Function peIconAlignment Returns XTPColumnAlignment
   672        BigInt eBigCurrent eBigValue
   673        Integer eValue
   674
   675        If (IsComObjectCreated(Self)) Begin
   676            Get ComAlignment to eBigCurrent
   677            Move (eBigCurrent iand xtpAlignmentIconMask) to eBigValue
   678            Move eBigValue to eValue
   679        End
   680        Else Begin
   681            Get private_peIconAlignment to eValue
   682        End
   683        Function_Return eValue
   684    End_Function
   685    
   686    // peFooterAlignment
   687    
   688    // Specifies the column footer text alignment. See ReportColumn.FooterAlignment
   689    { MethodType=Property InitialValue=xtpAlignmentDefault }
   690    { EnumList= "xtpAlignmentDefault, xtpAlignmentLeft, xtpAlignmentCenter, xtpAlignmentRight, xtpAlignmentVCenter, xtpAlignmentWordBreak" }
   691    { Category=Appearance }
   692    Procedure Set peFooterAlignment XTPColumnAlignment eValue
   693        // Set the value...
   694        Set private_peFooterAlignment to eValue
   695
   696        If (IsComObjectCreated(Self)) Begin
   697            Set ComFooterAlignment to eValue
   698            Delegate Send DeferredRedraw // ComRedraw
   699        End
   700    End_Procedure
   701    
   702    { MethodType=Property }
   703    Function peFooterAlignment Returns XTPColumnAlignment
   704        Integer eValue
   705
   706        If (IsComObjectCreated(Self)) Begin
   707            Get ComFooterAlignment to eValue
   708        End
   709        Else Begin
   710            Get private_peFooterAlignment to eValue
   711        End
   712        Function_Return eValue
   713    End_Function
   714    
   715    // peHeaderAlignment
   716    
   717    // Specifies the column header text alignment. See ReportColumn.HeaderAlignment
   718    { MethodType=Property InitialValue=xtpAlignmentDefault }
   719    { EnumList= "xtpAlignmentDefault, xtpAlignmentLeft, xtpAlignmentCenter, xtpAlignmentRight, xtpAlignmentVCenter, xtpAlignmentWordBreak" }
   720    { EnumList+= "xtpAlignmentIconLeft, xtpAlignmentIconCenter, xtpAlignmentIconRight, xtpAlignmentIconTop, xtpAlignmentIconVCenter, xtpAlignmentIconBottom" }
   721    { Category=Appearance }
   722    Procedure Set peHeaderAlignment XTPColumnAlignment eValue
   723        // Set the value...
   724        Set private_peHeaderAlignment to eValue
   725
   726        If (IsComObjectCreated(Self)) Begin
   727            Set ComHeaderAlignment to eValue
   728            Delegate Send DeferredRedraw // ComRedraw
   729        End
   730    End_Procedure
   731    
   732    { MethodType=Property }
   733    Function peHeaderAlignment Returns XTPColumnAlignment
   734        Integer eValue
   735
   736        If (IsComObjectCreated(Self)) Begin
   737            Get ComHeaderAlignment to eValue
   738        End
   739        Else Begin
   740            Get private_peHeaderAlignment to eValue
   741        End
   742        Function_Return eValue
   743    End_Function
   744
   745    // peTextAlignment:
   746    
   747    // Column alignment. See ReportColumn.Alignment
   748    { MethodType=Property InitialValue=xtpAlignmentLeft }
   749    { EnumList= "xtpAlignmentLeft, xtpAlignmentCenter, xtpAlignmentRight, xtpAlignmentVCenter" }
   750    { Category=Appearance }
   751    Procedure Set peTextAlignment XTPColumnAlignment eValue
   752        Integer eTextAlignment eIconAlignment eCurrentAlignment eWordBreak
   753        BigInt eBigIconAlignment eBigCurrentAlignment
   754         
   755        Set private_peTextAlignment to eValue
   756        // Once the alignment has been explicitly set, we will not change it. If it is set as part
   757        // of set peDataType it has not been explicitly set (peDataType will clear this)
   758        Set pbTextAlignmentSet to True 
   759
   760        If (IsComObjectCreated(Self)) Begin
   761            Get ComAlignment to eCurrentAlignment
   762            Move (eCurrentAlignment iand xtpAlignmentWordBreak) to eWordBreak     // ensure we preserve the current word break flag 
   763            Move eCurrentAlignment to eBigCurrentAlignment
   764            Move (xtpAlignmentIconMask iand eBigCurrentAlignment) to eBigIconAlignment
   765            Move eBigIconAlignment to eIconAlignment
   766            Set ComAlignment to (eValue ior eWordBreak ior eIconAlignment)
   767            Delegate Send DeferredRedraw // ComRedraw
   768        End
   769    End_Procedure
   770    
   771    { MethodType=Property }
   772    Function peTextAlignment Returns XTPColumnAlignment
   773        Integer eValue eCurrentAlignment
   774
   775        If (IsComObjectCreated(Self)) Begin
   776            Get ComAlignment to eCurrentAlignment
   777            Move (eCurrentAlignment iand xtpAlignmentTextMask) to eValue
   778        End
   779        Else Begin
   780            Get private_peTextAlignment to eValue
   781        End
   782        Function_Return eValue
   783    End_Function
   784
   785    // piMaximumWidth
   786    
   787    // Maximum column width (If Set as positive). This only applies when AutoSize is False. See ReportColumn.MaximumWidth .
   788    { MethodType=Property InitialValue=0 }
   789    { Category=Appearance }
   790    Procedure Set piMaximumWidth Integer iValue
   791        Set private_piMaximumWidth to iValue
   792        
   793        If (IsComObjectCreated(Self)) Begin
   794            Set ComMaximumWidth to iValue
   795        End
   796    End_Procedure
   797    
   798    { MethodType=Property }
   799    Function piMaximumWidth Returns Integer
   800        Integer iValue
   801        If (IsComObjectCreated(Self)) Begin
   802            Get ComMaximumWidth to iValue
   803        End
   804        Else Begin
   805            Get private_piMaximumWidth to iValue
   806        End
   807        Function_Return iValue
   808    End_Function
   809
   810    // piMaxLength
   811    
   812    // the maximum number of characters that can be entered when editing an item. See ReportControlItemEditOptions.MaxLength
   813    { MethodType=Property InitialValue=0 }
   814    { Category=Behavior }
   815    Procedure Set piMaxLength Integer iValue
   816        Handle hoEditOptions
   817        Set private_piMaxLength to iValue
   818        
   819        If (IsComObjectCreated(Self)) Begin
   820            Get phoEditOptions to hoEditOptions
   821            Set ComMaxLength of hoEditOptions to iValue
   822        End
   823    End_Procedure
   824    
   825    { MethodType=Property }
   826    Function piMaxLength Returns Integer
   827        Integer iValue
   828        Handle hoEditOptions
   829
   830        If (IsComObjectCreated(Self)) Begin
   831            Get phoEditOptions to hoEditOptions
   832            Get ComMaxLength of hoEditOptions to iValue
   833        End
   834        Else Begin
   835            Get private_piMaxLength to iValue
   836        End
   837        Function_Return iValue
   838    End_Function
   839
   840    // piMinimumWidth:
   841    
   842    // Specifies the minimum width that a column can be sized to If resizable. See ReportColumn.MinimumWidth
   843    { MethodType=Property InitialValue=0 }
   844    { Category=Appearance }
   845    Procedure Set piMinimumWidth Integer iValue
   846        Set private_piMinimumWidth to iValue
   847        
   848        If (IsComObjectCreated(Self)) Begin
   849            Set ComMinimumWidth to iValue
   850        End
   851    End_Procedure
   852    
   853    { MethodType=Property }
   854    Function piMinimumWidth Returns Integer
   855        Integer iValue
   856        If (IsComObjectCreated(Self)) Begin
   857            Get ComMinimumWidth to iValue
   858        End
   859        Else Begin
   860            Get private_piMinimumWidth to iValue
   861        End
   862        Function_Return iValue
   863    End_Function
   864        
   865    // piWidth:
   866    
   867    // Specifies the minimal default column width. See ReportColumn.Width 
   868    { MethodType=Property InitialValue=0 }
   869    { Category=Appearance }
   870    Procedure Set piWidth Integer iValue
   871        Set private_piWidth to iValue
   872        
   873        If (IsComObjectCreated(Self)) Begin
   874            Set ComWidth to iValue
   875        End
   876    End_Procedure
   877    
   878    { MethodType=Property }
   879    Function piWidth Returns Integer
   880        Integer iValue
   881        If (IsComObjectCreated(Self)) Begin
   882            Get ComWidth to iValue
   883        End
   884        Else Begin
   885            Get private_piWidth to iValue
   886        End
   887        Function_Return iValue
   888    End_Function
   889    
   890    // psCaption
   891    
   892    // Text caption for the column header, see ReportColumn.psCaption
   893    { MethodType=Property InitialValue="" }
   894    { Category=Appearance }
   895    Procedure Set psCaption String sValue
   896        Set private_psCaption to sValue
   897        
   898        If (IsComObjectCreated(Self)) Begin
   899            Set ComCaption to sValue
   900        End
   901    End_Procedure
   902    
   903    { MethodType=Property }
   904    Function psCaption Returns String
   905        String sValue
   906        If (IsComObjectCreated(Self)) Begin
   907            Get ComCaption to sValue
   908        End
   909        Else Begin
   910            Get private_psCaption to sValue
   911        End
   912        Function_Return sValue
   913    End_Function
   914    
   915    // psFooterText
   916    
   917    // The text that is displayed in the column's footer. see ReportColumn.FooterText
   918    { MethodType=Property InitialValue="" }
   919    { Category=Appearance }
   920    Procedure Set psFooterText String sValue
   921        Set private_psFooterText to sValue
   922        
   923        If (IsComObjectCreated(Self)) Begin
   924            Set ComFooterText to sValue
   925        End
   926    End_Procedure
   927    
   928    { MethodType=Property }
   929    Function psFooterText Returns String
   930        String sValue
   931        If (IsComObjectCreated(Self)) Begin
   932            Get ComFooterText to sValue
   933        End
   934        Else Begin
   935            Get private_psFooterText to sValue
   936        End
   937        Function_Return sValue
   938    End_Function
   939
   940    // psImage:
   941    
   942    // Sets the image/icon name of an icon that is displayed in the column header. See ReportColumn.Icon.
   943    { MethodType=Property InitialValue="" }
   944    { PropertyType=Image }
   945    { Category=Appearance }
   946    Procedure Set psImage String sValue
   947        Integer iIcon
   948        Handle hoIcons
   949        
   950        Set private_psImage to sValue
   951        
   952        If (IsComObjectCreated(Self)) Begin
   953            // If the image ID is alredy used then assign the new image to the old ID....
   954            Get private_piIcon to iIcon
   955            
   956            If (iIcon <> 0) Begin
   957                Delegate Get phoImageManagerIcons to hoIcons
   958                Send ComRemoveIcon to hoIcons iIcon
   959            End
   960            
   961            // Now add the new image....
   962            Delegate Get AddImage sValue 0 to iIcon
   963            Set private_piIcon to iIcon 
   964            Set ComIcon to iIcon
   965            Delegate Send DeferredRedraw // ComRedraw
   966        End
   967    End_Procedure
   968    
   969    { MethodType=Property }
   970    Function psImage Returns String
   971        String sValue
   972        Get private_psImage to sValue
   973        Function_Return sValue
   974    End_Function
   975    
   976    // psMask
   977    
   978    // Edit mask string.
   979    { MethodType=Property }
   980    { Category=Appearance }
   981    Procedure Set psMask String sMask
   982        Set private_psMask to sMask
   983    End_Procedure
   984    
   985    { MethodType=Property }
   986    Function psMask Returns String
   987        String sMask
   988        Get private_psMask to sMask
   989        Function_Return sMask
   990    End_Function
   991
   992    // psTooltip
   993    
   994    // Tool tip that is displayed when the mouse cursor is positioned over the column header. See ReportColumn.Tooltip
   995    { MethodType=Property InitialValue="" }
   996    { Category=Appearance }
   997    Procedure Set psTooltip String sValue
   998        Set private_psTooltip to sValue
   999        
  1000        If (IsComObjectCreated(Self)) Begin
  1001            Set ComToolTip to sValue
  1002        End
  1003    End_Procedure
  1004    
  1005    { MethodType=Property }
  1006    Function psTooltip Returns String
  1007        String sValue
  1008        If (IsComObjectCreated(Self)) Begin
  1009            Get ComToolTip to sValue
  1010        End
  1011        Else Begin
  1012            Get private_psTooltip to sValue
  1013        End
  1014        Function_Return sValue
  1015    End_Function
  1016    
  1017    // TextColor:
  1018    
  1019    // specifies the column's background text color (clNone = use Grid's Color)
  1020    { MethodType=Property InitialValue=clNone }
  1021    { PropertyType=Color Category=Appearance }
  1022    { EnumList= "clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder" }
  1023    { EnumList+="clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk, clDefault, clNone" }
  1024    { EnumList+="clAqua, clBlack, clBlue, clDkGray, clFuchsia, clGray, clGreen, clLime, clLtGray, clMaroon, clNavy, clOlive, clPurple, clRed, clSilver, clTeal, clWhite, clYellow" }
  1025    Procedure Set TextColor Integer iValue
  1026        Set private_TextColor to iValue
  1027        
  1028        If (IsComObjectCreated(Self)) Begin
  1029            Delegate Send DeferredRedraw // ComRedraw
  1030        End
  1031    End_Procedure
  1032    
  1033    { MethodType=Property }
  1034    Function TextColor Returns Integer
  1035        Integer iValue
  1036        Get private_TextColor to iValue
  1037        Function_Return iValue
  1038    End_Function
  1039    
  1040
  1041    // ========================================================================================
  1042    // Methods.................................................................................
  1043    // ========================================================================================
  1044
  1045    
  1046    // ComboAddItem
  1047    
  1048    // Adds a member to the combo list for this column. See ReportColumn.EditOptions.Constraints.Add
  1049    // sCaption - Is the value displayed in the combo list.
  1050    // iData - Is the numeric data value representing the combo item.
  1051    Procedure ComboAddItem String sCaption Integer iData
  1052        tComboItemData[] AComboData
  1053        Integer iCount
  1054        Handle hoConstraints
  1055
  1056        Get pComboItemData to AComboData
  1057        Move (SizeOfArray(AComboData)) to iCount
  1058        Move sCaption to AComboData[iCount].sCaption
  1059        Move iData    to AComboData[iCount].iData
  1060        Set pComboItemData to AComboData
  1061        
  1062        If (IsComObjectCreated(Self)) Begin
  1063            Get phoConstraints to hoConstraints
  1064            Send ComAdd to hoConstraints sCaption iData
  1065        End
  1066    End_Procedure   // ComboAddItem
  1067    
  1068    // ComboDeleteData
  1069    
  1070    // Clears the combo list for this column. See ReportColumn.EditOptions.Constraints.DeleteAll
  1071    Procedure ComboDeleteData
  1072        Handle hoConstraints
  1073        
  1074        If (IsComObjectCreated(Self)) Begin
  1075            // Delete the current constraints....
  1076            Get phoConstraints to hoConstraints
  1077            Send ComDeleteAll to hoConstraints
  1078        End
  1079    End_Procedure
  1080
  1081    // ComboData
  1082    
  1083    // Returns the set of combo items in the combo list for this column. See ReportColumn.EditOptions.Constraints.Constraint.Data
  1084    // I decided to return the entire set of combo items in an array of struct. We could change this to provide an indexed access.
  1085    Function ComboData Returns tComboItemData[]
  1086        tComboItemData[] AComboData
  1087        Get pComboItemData to AComboData
  1088        Function_Return AComboData
  1089    End_Function 
  1090
  1091    // Returns a match for the passed caption starting at position iStartAt
  1092    Function ComboFindItem Integer iStartAt String sCaption Returns Integer
  1093        Integer iCount i
  1094        String sValue
  1095        tComboItemData[] ComboItemData
  1096        Get ComboData to ComboItemData
  1097        Move (SizeOfArray(ComboItemData)) to iCount
  1098        For i from iStartAt to (iCount-1)
  1099            If (ComboItemData[i].sCaption=sCaption) Begin
  1100                Function_Return i
  1101            End
  1102        Loop
  1103        Function_Return -1
  1104    End_Function
  1105    
  1106    
  1107    // ComboInitialize:
  1108    
  1109    // Rebuilds the column combo list (ReportRecordItemConstraints) from the internal array of constraint data. 
  1110    {Visibility=Private}
  1111    Procedure ComboInitialize
  1112        tComboItemData[] AComboData
  1113        Integer iItem icItem
  1114        Handle hoConstraints
  1115        
  1116        If (IsComObjectCreated(Self)) Begin
  1117            // Delete the current constraints....
  1118            Get phoConstraints to hoConstraints
  1119            Send ComDeleteAll to hoConstraints
  1120            
  1121            // Add all the items....
  1122            Get ComboData to AComboData
  1123            Move (SizeOfArray(AComboData)) to icItem
  1124            
  1125            For iItem from 0 to (icItem - 1)
  1126                Send ComAdd to hoConstraints AComboData[iItem].sCaption AComboData[iItem].iData
  1127            Loop
  1128        End
  1129    End_Procedure  // ComboInitialize
  1130    
  1131    // Use this object to trap the error and do nothing
  1132    { NoDoc=True }
  1133    Procedure Error_Report Integer iErrNum Integer iErrLine String sErrMsg
  1134    End_Procedure
  1135    
  1136    // OnCreateColumn
  1137                
  1138    // event called at end of creation of com column object
  1139    { MethodType=Event }
  1140    Procedure OnCreateColumn
  1141    End_Procedure
  1142    
  1143    // OnEndEdit
  1144    
  1145    { MethodType=Event }
  1146    Procedure OnEndEdit String sOldValue String sNewValue
  1147    End_Procedure
  1148    
  1149    // OnEntering
  1150    
  1151    { MethodType=Event }
  1152    Function OnEntering Returns Boolean
  1153    End_Function
  1154    
  1155    // OnEntry
  1156    
  1157    { MethodType=Event }
  1158    Procedure OnEntry
  1159    End_Procedure
  1160    
  1161    // OnExit
  1162        
  1163    { MethodType=Event }
  1164    Procedure OnExit
  1165    End_Procedure
  1166    
  1167    // OnExiting
  1168    
  1169    { MethodType=Event }
  1170    Function OnExiting Returns Boolean
  1171    End_Function
  1172    
  1173    // OnGetTooltip
  1174    
  1175    // Fired whenever the mouse is positioned over a grid cell belonging to this column.
  1176    // iRow - Is the row number of the cell that the mouse is positioned over. 
  1177    // sValue - Is the current cell value of the cell that the mouse is positioned over.
  1178    // sText - Is the default tooltip to be displayed
  1179    // returns - The tooltip to display for the current mouse co-ordinate.
  1180    //           Return empty string to cancel tooltip display over this cell.
  1181    { MethodType=Event }
  1182    Function OnGetTooltip Integer iRow String sValue String sText Returns String
  1183        Function_Return sText
  1184    End_Function
  1185
  1186    // OnSetDisplayMetrics
  1187    
  1188    // Fired when each cell in the column is about to get painted. Use this method to customize the cell's display attributes (color etc).
  1189    // hoGridItemMetrics - This is a handle to a cCJReportRecordItemMetrics object. Manipulate the properties of this objecty to modify
  1190    //                     the display attributes of the cell being painted.
  1191    // iRow - Is the row number of the row whose cell is being painted.
  1192    // sValue - Is the cell text that is to be painted.
  1193    { MethodType=Event }
  1194    Procedure OnSetDisplayMetrics Handle hoGridItemMetrics Integer iRow String ByRef sValue
  1195    End_Procedure
  1196    
  1197    // OnValidating
  1198    
  1199    { MethodType=Event }
  1200    Function OnValidating Returns Boolean
  1201    End_Function
  1202    
  1203    { Visibility=Private }
  1204    Function Entering Returns Boolean
  1205        Boolean bCancel
  1206        Get OnEntering to bCancel
  1207        Function_Return bCancel
  1208    End_Function
  1209
  1210    { Visibility=Private }
  1211    Function Exiting Returns Boolean
  1212        Boolean bCancel
  1213        Get OnExiting to bCancel
  1214        Function_Return bCancel
  1215    End_Function
  1216    
  1217    { Visibility=Private }
  1218    Procedure Entry
  1219        Send OnEntry
  1220    End_Procedure
  1221        
  1222    { Visibility=Private }
  1223    Procedure Exit
  1224        Send OnExit
  1225    End_Procedure
  1226    
  1227    { Visibility=Private }
  1228    Function Validating Returns Boolean
  1229        Boolean bCancel
  1230        Get OnValidating to bCancel
  1231        Function_Return bCancel
  1232    End_Function
  1233
  1234    // Return the value for this column for the selected row. If this happens to be
  1235    // a column being edited it has the edited value (i.e., the value in the edit object)
  1236    Function SelectedRowValue Returns String
  1237        String  sValue
  1238        Handle hoSelCol
  1239        Boolean bEditMode
  1240        Get IsEditMode to bEditMode
  1241        Get SelectedColumnObject to hoSelCol
  1242        If (bEditMode and (hoSelCol=Self))  Begin
  1243            Delegate Get EditValue to sValue
  1244        End
  1245        Else Begin
  1246            Get SelectedRowValueBeforeEdit to sValue
  1247        End
  1248        Function_Return sValue
  1249    End_Function
  1250    
  1251    // Return the value for this column for the passed row. If this happens to be
  1252    // a column being edited it has the edited value (i.e., the value in the edit object)
  1253    Function RowValue Integer iRow Returns String
  1254        Handle hoDataSource
  1255        Integer iId iSelRow
  1256        String sValue
  1257        Get phoDataSource to hoDataSource
  1258        Get SelectedRow of hoDataSource to iSelRow
  1259        If (iRow=iSelRow) Begin
  1260            Get SelectedRowValue to sValue
  1261        End
  1262        Else Begin
  1263            Get piColumnID to iId
  1264            Get DataForCell of hoDataSource iRow iId to sValue
  1265        End
  1266        Function_Return sValue
  1267    End_Function
  1268    
  1269    
  1270    // This is the before value of this column for the selected row where before means
  1271    // the value before the edit is commited. 
  1272    Function SelectedRowValueBeforeEdit Returns String
  1273        Handle hoDataSource
  1274        Integer iId iRow
  1275        String sValue
  1276        Get piColumnID to iId
  1277        Get phoDataSource to hoDataSource
  1278        Get SelectedRow of hoDataSource to iRow
  1279        If (iRow<>-1) Begin
  1280            Get DataForCell of hoDataSource iRow iId to sValue
  1281        End
  1282        Function_Return sValue
  1283    End_Function
  1284    
  1285    // update value in data-source
  1286    Procedure UpdateCurrentValue String sValue
  1287        Integer iRow
  1288        Handle hoDataSource
  1289        Get phoDataSource to hoDataSource
  1290        Get SelectedRow of hoDataSource to iRow
  1291        If (iRow<>-1) Begin
  1292            Send UpdateDataSourceForSelectedRow sValue True
  1293        End
  1294    End_Function
  1295    
  1296
  1297    { Visibility=Private }
  1298    // test if two values are valid and eq based on the passed datatype    
  1299    Procedure DatatypeEQtest String sVal1 String sVal2 Boolean ByRef bError Boolean ByRef bIsEQ
  1300        Number nNum1 nNum2
  1301        Date dDate1 dDate2
  1302        DateTime dtDateTime1 dtDateTime2
  1303        Handle hOldErrorObj
  1304        Integer eDataType
  1305
  1306        Get peDataType to eDataType
  1307 
  1308        // trap errors during this test
  1309        Move Error_Object_Id to hOldErrorObj
  1310        Move Self to Error_Object_id
  1311        Move (False) to Err
  1312        If (eDataType=Ascii_Window or eDataType=Mask_Window) Begin
  1313            Move (sVal1=sVal2) to bIsEQ
  1314        End
  1315        Else If (eDataType=Mask_Date_Window or eDataType=Date_Window) Begin
  1316            Move sVal1 to dDate1
  1317            Move sVal2 to dDate2
  1318            Move (dDate1=dDate2) to bIsEQ
  1319        End
  1320        Else If (eDataType=Mask_Datetime_Window) Begin
  1321            Move sVal1 to dtDateTime1
  1322            Move sVal2 to dtDateTime2
  1323            Move (dtDateTime1=dtDateTime2) to bIsEQ
  1324        End
  1325        Else Begin
  1326            Move sVal1 to nNum1
  1327            Move sVal2 to nNum2
  1328            Move (nNum1=nNum2) to bIsEQ
  1329        End
  1330        Move (Err) to bError
  1331        Move hOldErrorObj to Error_Object_Id
  1332    End_Procedure
  1333    
  1334    // sent when the grid exits edit mode and the value needs to be 
  1335    // updated. ret true if changed
  1336    { Visibility=Private }
  1337    Function NotifyEndEdit String sValue Returns Boolean
  1338        String sOldValue
  1339        Boolean bError bIsEQ
  1340        Get SelectedRowValueBeforeEdit to sOldValue
  1341        Get FormatEditedValue sValue to sValue
  1342        Send DataTypeEQTest sOldValue sValue (&bError) (&bIsEQ)
  1343        If (not(bError) and not(bIsEQ)) Begin
  1344            Send UpdateCurrentValue sValue
  1345            Send OnEndEdit sOldValue sValue
  1346            Function_Return True
  1347        End
  1348        Function_Return False
  1349    End_Procedure
  1350
  1351    // commit the value in the edit control without losing its focus
  1352    { Visibility=Private }
  1353    Procedure UpdateFocusFieldValue
  1354        String sValue
  1355        Boolean bChange
  1356        Get SelectedRowValue to sValue  
  1357        Get NotifyEndEdit sValue to bChange
  1358    End_Procedure
  1359    
  1360    // returns boolean checked state of the passed value
  1361    Function ValueToCheckedState String sValue Returns Boolean
  1362        String sValueTrue
  1363        Get psCheckboxTrue to sValueTrue
  1364        Function_Return (sValue=sValueTrue)
  1365    End_Function
  1366
  1367    // returns a string representing the passed checked state
  1368    Function CheckedStateToValue Boolean bChecked Returns String
  1369        String sValue
  1370        If bChecked Begin
  1371            Get psCheckboxTrue to sValue
  1372        End
  1373        Else Begin
  1374            Get psCheckboxFalse to sValue
  1375        End
  1376        Function_Return sValue
  1377    End_Function
  1378
  1379    // notification that a checked value has been pressed.
  1380    { Visibility=Private }
  1381    Function NotifyItemChecked Returns Boolean
  1382        Boolean bCancel
  1383        Boolean bChecked
  1384        String sOldValue sValue
  1385
  1386        Get SelectedRowValueBeforeEdit to sOldValue
  1387        Get ValueToCheckedState sOldValue to bChecked
  1388        Move (not(bChecked)) to bChecked
  1389        Get CheckedStateToValue bChecked to sValue
  1390        Send UpdateCurrentValue sValue
  1391        Send OnEndEdit sOldValue sValue
  1392        Function_Return bCancel
  1393    End_Procedure
  1394
  1395    
  1396    // returns true of column can take the focus (focusable and editable)
  1397    Function IsColumnFocusable Returns Boolean
  1398        Boolean bVisible bFocusable bOk bCancel
  1399        Get pbVisible to bVisible
  1400        Get pbFocusable to bFocusable
  1401        Function_Return (bVisible and bFocusable)
  1402    End_Function
  1403
  1404    // returns true if keyboard navigation is allowed for this column.
  1405    // pass whether the navigation is forward or backwards, return True if allowed
  1406    // We don't test Entering here, which can refuse the focus. Even though you can navigate
  1407    // into the column, Entering or Exiting might not allow it when the change is attempted.
  1408    Function CanNavigateIntoColumn Boolean bForward Returns Boolean
  1409        Boolean bEditable bFocusable bOk bCancel
  1410        Get pbEditable to bEditable
  1411        Get IsColumnFocusable to bFocusable
  1412        Move (bEditable and bFocusable) to bOk
  1413        Function_Return bOk
  1414    End_Function
  1415    
  1416    // Find the next column that can be navigated into. Returns byref the new column and if this is
  1417    // a wrap. If return value is True if column could be found
  1418    Function NextColumn Handle ByRef hoCol Boolean ByRef bWrap Returns Boolean
  1419        Handle[] hoCols
  1420        Integer iIndex iCount
  1421        Boolean bOk
  1422        Get ColumnObjectsInDisplayOrder to hoCols
  1423        Move (SearchArray(Self,hoCols)) to iIndex
  1424        If (iIndex<>-1) Begin
  1425            Move (SizeOfArray(hoCols)) to iCount
  1426            Repeat
  1427                Increment iIndex
  1428                If (iIndex>=iCount) Begin
  1429                    Move 0 to iIndex
  1430                    Move True to bWrap
  1431                End
  1432                Move hoCols[iIndex] to hoCol
  1433                Get CanNavigateIntoColumn of hoCol True to bOk
  1434            Until (bOk  or (hoCol=Self))    
  1435        End
  1436        Function_Return bOk
  1437    End_Function
  1438    
  1439    // Find the previous column that can be navigated into. Returns byref the new column and if this is
  1440    // a wrap. If return value is True if success
  1441    Function PreviousColumn Handle ByRef hoCol Boolean ByRef bWrap Returns Boolean
  1442        Handle[] hoCols
  1443        Integer iIndex iCount
  1444        Boolean bOk
  1445        Get ColumnObjectsInDisplayOrder to hoCols
  1446        Move (SearchArray(Self,hoCols)) to iIndex
  1447        If (iIndex<>-1) Begin
  1448            Move (SizeOfArray(hoCols)) to iCount
  1449            Repeat
  1450                Decrement iIndex
  1451                If (iIndex<0) Begin
  1452                    Move (iCount-1) to iIndex
  1453                    Move True to bWrap
  1454                End
  1455                Move hoCols[iIndex] to hoCol
  1456                Get CanNavigateIntoColumn of hoCol False to bOk
  1457            Until (bOk  or (hoCol=Self))    
  1458        End
  1459        Function_Return bOk
  1460    End_Function
  1461    
  1462    
  1463    // This is the column displayed order of this object
  1464    Function ColumnDisplayIndex Returns Integer
  1465        Integer iIndex
  1466        Get ComIndex to iIndex
  1467        Function_Return iIndex
  1468    End_Function
  1469    
  1470
  1471    // takes value from datasource and formats it for display.
  1472    { Visibility=Private }
  1473    Function FormatDisplayValue String ByRef sValue Returns Boolean
  1474         Handle hoMasker
  1475         Integer eDataType
  1476         String sMask
  1477         Get peDataType to eDataType
  1478         If (eDataType>Ascii_Window) Begin
  1479             // can't just use hoEdit because Masked_value doesn't work when
  1480             // the object is the focus because it gets value from the edit control
  1481             Get psMask to sMask
  1482             Get phoMaskForm to hoMasker
  1483             Set Form_Mask of hoMasker to sMask
  1484             Set Form_DataType of hoMasker to eDataType
  1485             Set Value of hoMasker to sValue
  1486             Get Masked_Value of hoMasker  to sValue // return value will be ansi
  1487             Function_Return True // indicates that this is now ANSI
  1488         End
  1489         Function_Return False // this is OEM
  1490    End_Function
  1491    
  1492    // takes value from edit control and "unformats" it 
  1493    Function FormatEditedValue String sValue Returns String
  1494        Function_Return sValue
  1495    End_Function
  1496    
  1497    // Creates the COM column object. Called as part of grid activation
  1498    Procedure CreateColumn Integer iColumn
  1499        Handle hoReportColumns hoEditOptions hoConstraints
  1500        Variant vEditOptions vConstraints
  1501        Handle[] hoColumnObjects 
  1502        String sCaption sValue
  1503        Integer iWidth iValue iRegisteredCol
  1504        Boolean bResizable bValue
  1505        Variant vComObject
  1506        
  1507        Get piColumnID  to iRegisteredCol
  1508        If (iColumn<>iRegisteredCol) Begin
  1509            Error DFERR_PROGRAM "Assert: CreateColumn column Id mismatch" 
  1510        End
  1511        
  1512        
  1513        Get phoReportColumns to hoReportColumns
  1514        
  1515        Get private_psCaption to sCaption
  1516        Get private_piWidth to iWidth
  1517        Get private_pbResizable to bResizable
  1518        Get ComAdd of hoReportColumns iColumn sCaption iWidth bResizable to vComObject
  1519        Set pvComObject  to vComObject
  1520        
  1521        // Set the COM properties....
  1522        Get private_pbEditable to bValue
  1523        Set ComEditable to bValue 
  1524
  1525        Get private_pbVisible to bValue
  1526        Set ComVisible to bValue
  1527
  1528        Get private_piMinimumWidth to iValue
  1529        Set ComMinimumWidth to iValue
  1530
  1531        Get private_pbAllowDrag to bValue
  1532        Set ComAllowDrag to bValue
  1533
  1534        Get private_pbAllowRemove to bValue
  1535        Set ComAllowRemove to bValue
  1536
  1537        Get private_pbDrawFooterDivider to bValue
  1538        Set ComDrawFooterDivider to bValue
  1539
  1540        Get private_pbDrawHeaderDivider to bValue
  1541        Set ComDrawHeaderDivider to bValue
  1542
  1543        Get private_pbShowInFieldChooser to bValue
  1544        Set ComShowInFieldChooser to bValue
  1545
  1546        Get private_piMaximumWidth to iValue
  1547        Set ComMaximumWidth to iValue
  1548
  1549        Get private_psFooterText to sValue
  1550        Set ComFooterText to sValue
  1551
  1552        Get private_psToolTip to sValue
  1553        Set ComTooltip to sValue
  1554
  1555        // Do not set footer alignment unless it is explicitly set....
  1556        Get private_peFooterAlignment to iValue
  1557        If (iValue <> xtpAlignmentDefault) Begin
  1558            Set ComFooterAlignment to iValue
  1559        End
  1560
  1561        // Do not set header alignment unless it is explicitly set....
  1562        Get private_peHeaderAlignment to iValue
  1563        If (iValue <> xtpAlignmentDefault) Begin
  1564            Set ComHeaderAlignment to iValue
  1565        End
  1566
  1567        // Set special properties via their Set method....
  1568        Get private_peTextAlignment  to iValue
  1569        Set peTextAlignment to iValue
  1570        
  1571        Get private_peIconAlignment to iValue
  1572        Set peIconAlignment to iValue
  1573        
  1574        Get private_pbMultiLine to bValue
  1575        Set pbMultiLine to bValue
  1576         
  1577        Get private_psImage to sValue
  1578        Set psImage to sValue
  1579        
  1580        // Handle the column's edit item properties.... 
  1581        Get phoEditOptions  to hoEditOptions
  1582        Get ComEditOptions  to vEditOptions
  1583        Set pvComObject of hoEditOptions to vEditOptions
  1584
  1585        Get pbSelectTextOnEdit to bValue
  1586        Set ComSelectTextOnEdit of hoEditOptions to bValue
  1587        
  1588        Get private_pbComboEntryState to bValue
  1589        Set ComConstraintEdit of hoEditOptions to (not(bValue))
  1590
  1591        Get private_piMaxLength to iValue
  1592        Set ComMaxLength of hoEditOptions to iValue  //***VDF16.0 - Doesn't work!
  1593        
  1594        Get pbCheckbox to bValue
  1595        If (bValue) Begin
  1596            Set ComAllowEdit of hoEditOptions to False
  1597        End
  1598
  1599        Get private_pbCapslock to bValue
  1600        If bValue Begin
  1601            Get ComEditControlStyle of hoEditOptions to iValue
  1602            Move (AddBitValue(xtpEditStyleUppercase,iValue)) to iValue
  1603            Set ComEditControlStyle of hoEditOptions to iValue
  1604        End
  1605        
  1606        Get private_pbComboButton to bValue
  1607        Set pbComboButton to bValue                 // must reset this property after the edit options are created
  1608        
  1609        // Constraints....
  1610        Get phoConstraints  to hoConstraints
  1611        Get ComConstraints of hoEditOptions to vConstraints
  1612        Set pvComObject of hoConstraints to vConstraints
  1613        Send ComboInitialize
  1614        Send OnCreateColumn
  1615        
  1616    End_Procedure
  1617    
  1618    // Release/destroy the COM column object. Called as part of grid deactivation
  1619    Procedure ReleaseObject
  1620        Handle hoObject
  1621
  1622        Get phoEditOptions to hoObject
  1623        Set pvComObject of hoObject to (NullComObject())
  1624
  1625        Get phoConstraints to hoObject
  1626        Set pvComObject of hoObject to (NullComObject())
  1627
  1628        // release self
  1629        Set pvComObject to (NullComObject())
  1630        
  1631    End_Procedure
  1632    
  1633    // returns an initialized custom VDF edit object  
  1634    {Visibility=Private }
  1635    Function CustomEditObject Returns Handle
  1636         Handle hoEdit hcClass
  1637         Boolean bCombo bCheckBox bFocusable bEditable bUseVDF bCaps
  1638         String sMask
  1639         Integer eValue iMax
  1640         Get pbVDFEditControl to bUseVDF
  1641         If bUseVDF Begin
  1642             Get pbComboButton to bCombo
  1643             Get pbCheckbox to bCheckBox
  1644             Get pbFocusable to bFocusable
  1645             Get pbEditable to bEditable
  1646             If not (bCombo or bCheckBox or not(bFocusable) or not(bEditable)) Begin
  1647                 Get phoEdit to hoEdit
  1648                 If (hoEdit=0) Begin
  1649                     Get phcEditClass to hcClass
  1650                     Get Create hcClass to hoEdit
  1651                     Set phoEdit to hoEdit
  1652                     // set a property for the edit control that points to its grid
  1653                     Set phoGrid of hoEdit to (Parent(Self))
  1654                 End
  1655
  1656                 Get psMask to sMask
  1657                 Set Form_Mask of hoEdit to sMask
  1658
  1659                 Get peDataType to eValue
  1660                 Set Form_Datatype of hoEdit to eValue
  1661                 
  1662                 Get peTextAlignment to eValue
  1663                 If (eValue iand xtpAlignmentRight) Begin
  1664                     Set Form_Justification_Mode of hoEdit to (Form_EditRight ior Form_DisplayRight)
  1665                 End
  1666                 Else Begin
  1667                     Set Form_Justification_Mode of hoEdit to (Form_EditLeft ior Form_DisplayLeft)
  1668                 End
  1669                 
  1670                 
  1671                 Get pbCapslock to bCaps
  1672                 Set Capslock_State of hoEdit to bCaps
  1673                 Get piMaxLength to iMax
  1674                 Set Form_Margin of hoEdit to (If(iMax=0, 32767, iMax))
  1675             End
  1676         End
  1677         Function_Return hoEdit
  1678    End_Function
  1679
  1680    // Can be used to set up a currency/mask for this column by passing
  1681    // digits to the left and right
  1682    Procedure CreateCurrencyMask Integer iLeft Integer iRight
  1683        Set peDataType to Mask_Currency_Window
  1684        Set psMask to (Number_Default_Mask(iLeft,iRight,Default_Currency_Mask))
  1685        If (iRight>0) Begin
  1686            Increment iRight
  1687        End
  1688        Set piMaxLength to (iLeft+iRight)
  1689    End_Procedure
  1690
  1691    // Can be used to set up a numric/mask for this column by passing
  1692    // digits to the left and right
  1693    Procedure CreateNumericMask Integer iLeft Integer iRight
  1694        Set peDataType to Mask_Numeric_Window
  1695        Set psMask to (Number_Default_Mask(iLeft,iRight,Default_Numeric_Mask))
  1696        If (iRight>0) Begin
  1697            Increment iRight
  1698        End
  1699        Set piMaxLength to (iLeft+iRight)
  1700    End_Procedure
  1701    
  1702    Procedure Prompt
  1703        Handle hoPrompt
  1704        Get Prompt_Object to hoPrompt
  1705        If hoPrompt Begin
  1706            Send Popup to hoPrompt
  1707        End
  1708    End_Procedure
  1709    
  1710    { MethodType=Property InitialValue=0 }
  1711    Procedure Set Prompt_Object Integer iItem Handle hoPrompt
  1712        Set private_Prompt_Object to hoPrompt
  1713    End_Procedure
  1714    
  1715    { MethodType=Property  }
  1716    Function Prompt_Object Returns Handle
  1717        Handle hoPrompt
  1718        Get private_Prompt_Object to hoPrompt
  1719        Function_Return hoPrompt
  1720    End_Function
  1721
  1722    Procedure Zoom
  1723        Handle hoZoom
  1724        Get Zoom_Object to hoZoom
  1725        If hoZoom Begin
  1726            Send Popup to hoZoom
  1727        End
  1728    End_Procedure
  1729    
  1730    { MethodType=Property InitialValue=0 }
  1731    Procedure Set Zoom_Object Integer iItem Handle hoZoom
  1732        Set private_Zoom_Object to hoZoom
  1733    End_Procedure
  1734    
  1735    { MethodType=Property  }
  1736    Function Zoom_Object Returns Handle
  1737        Handle hoZoom
  1738        Get private_Zoom_Object to hoZoom
  1739        Function_Return hoZoom
  1740    End_Function
  1741    
  1742    { MethodType=Event }
  1743    Procedure Prompt_Callback Handle hoPrompt
  1744    End_Procedure
  1745    
  1746    // Called when an initial value is needed. With simple grids this is called
  1747    // when a row is inserted or appended. With dbgrids it is called for each record found
  1748    Function InitialValue Returns String
  1749        Boolean bCheckbox
  1750        String sValue
  1751        Move "" to sValue
  1752        // if thisis a checkbox, we will set the initial value to false
  1753        Get pbCheckbox to bCheckbox
  1754        If (bCheckbox) Begin
  1755            Get psCheckboxFalse to sValue
  1756        End
  1757        Function_Return sValue
  1758    End_Function 
  1759
  1760    { Visibility=Private }
  1761    Procedure UpdateDataToExternalSource String sValue Integer iUpdateFlag Integer iFlags
  1762    End_Procedure
  1763    
  1764
  1765    // called in OnComBeforeDrawRow to paint for this column
  1766    { Visibility=Private }
  1767    Procedure DrawCell Handle hoRow Handle hoItem Handle hoMetrics Integer iRow String sValue
  1768        Integer iColor iTextColor iDisabledColor iDisabledTextColor iSysColor
  1769        Integer iCol iSortCol
  1770        Handle hoPaint
  1771        Boolean bFocusable bCheckbox bChecked bShade bANSI
  1772        Variant vValue
  1773        
  1774        Get Color to iColor
  1775        Get TextColor to iTextColor
  1776        
  1777        Get pbFocusable to bFocusable
  1778        Set ComFocusable of hoItem to bFocusable // must be set each time
  1779        If (not(bFocusable)) Begin
  1780            
  1781            // If disabled colors are set, apply them else we use the column colors 
  1782            Get piDisabledColor to iDisabledColor
  1783            Get piDisabledTextColor to iDisabledTextColor
  1784            
  1785            If (iDisabledColor <> clNone) Begin
  1786                Move iDisabledColor to iColor
  1787            End
  1788            
  1789            If (iDisabledTextColor <> clNone) Begin
  1790                Move iDisabledTextColor to iTextColor
  1791            End
  1792        End
  1793        
  1794        If (iColor <> clNone) Begin
  1795            Delegate Get ConvertSystemColor iColor to iColor
  1796            Set ComBackColor of hoMetrics to iColor                
  1797        End
  1798        
  1799        If (iTextColor <> clNone) Begin
  1800            Delegate Get ConvertSystemColor iColor to iColor
  1801            Set ComForeColor of hoMetrics to iTextColor                
  1802        End
  1803
  1804        // apply item specific display attributes:
  1805        Send OnSetDisplayMetrics hoMetrics iRow (&sValue)
  1806        
  1807        // Set the cell value or the checkbox value
  1808        Get pbCheckbox to bCheckbox
  1809        If bCheckbox Begin
  1810            Get ValueToCheckedState sValue to bChecked
  1811            Set ComHasCheckbox of hoItem to True
  1812            Set ComChecked of hoItem to bChecked
  1813        End
  1814        Else Begin
  1815           Get FormatDisplayValue (&sValue) to bANSI
  1816           // special logic for masked numerics to handle Euro
  1817           If (bANSI) Begin
  1818               Get AnsiValueToVariant sValue to vValue
  1819               Set ComUText of hoMetrics to vValue
  1820           End
  1821           Else Begin
  1822               Set ComText of hoMetrics to sValue  // set the cell value
  1823           End
  1824        End
  1825        
  1826    End_Procedure
  1827 
  1828    { Visibility=Private }
  1829    Function AnsiValueToVariant String sSource Returns Variant
  1830        Variant vValue
  1831        Address pvValue
  1832        Boolean bOk
  1833        Address pWStr
  1834
  1835        //Initialize pWstr variable so it has the correct type and AddressOf will return a proper pointer
  1836        Move 0 to pWStr
  1837        //Convert the Ansi string to Unicode
  1838        Get MultiToWideBuffer CP_ACP (AddressOf(sSource)) (Length(sSource)) (AddressOf(pWStr)) to bOk
  1839        //Initialize vValue variable so it has the correct type and AddressOf will return a proper pointer
  1840        Move 0 to vValue
  1841        Move (AddressOf(vValue)) to pvValue
  1842        //Change the Variant type to VT_BSTR
  1843        Move (StoreDw(pvValue,0,OLE_VT_Bstr)) to bOk
  1844        //Allocate a proper COM BSTR, assign the Unicode string, and store the BSTR in the Variant variable
  1845        Move (StoreDw(pvValue,8,SysAllocString(pWStr))) to bOk
  1846        //Now clear up the Unicode string, the Variant owns a BSTR copy of the string
  1847        Move (Free(pWStr)) to bOk
  1848        Function_Return vValue
  1849    End_Function
  1850    
  1851
  1852    // Can be used to determine if the column object understands the DEO interface
  1853    Function DEO_Object Returns Boolean
  1854        Function_Return False
  1855    End_Function
  1856    
  1857    // returns a tGridSortRules type which defines the rules for sorting this column.
  1858    // by default the rule is sort ascending the current column based on its datatype
  1859    Function ColumnSortRules Returns tGridSortRules
  1860        tGridSortRules SortRules
  1861        Get piColumnId to SortRules.Rules[0].iColumn
  1862        Get peDataType to SortRules.Rules[0].eDataType
  1863        Function_Return SortRules
  1864    End_Function
  1865    
  1866    // allows you to assign a different header context menu for this column. The
  1867    // current default grid menu is passed in. If you return 0, no menu is used
  1868    Function HeaderContextMenu Handle hoMenu Returns Handle
  1869        Function_Return hoMenu
  1870    End_Function
  1871    
  1872    // allows you to assign a different row context menu for this column. The
  1873    // current default grid menu is passed in. If you return 0, no menu is used
  1874    Function ContextMenu Handle hoMenu Returns Handle
  1875        Function_Return hoMenu
  1876    End_Function
  1877    
  1878    { MethodType=Property }
  1879    { InitialValue="" }
  1880    { Category=Help }
  1881    Procedure Set Status_Help String sHelp
  1882        Set private_Status_Help to sHelp
  1883    End_Procedure
  1884
  1885    { MethodType=Property }
  1886    Function Status_Help Returns String
  1887        String sHelp
  1888        Get private_Status_Help to sHelp
  1889        Function_Return sHelp
  1890    End_Function
  1891    
  1892    { Visibility=Private }
  1893    Procedure UpdateDataSourceForSelectedRow String sValue Boolean bPush 
  1894        Handle hoDataSource
  1895        Integer iThis
  1896        Get phoDataSource to hoDataSource
  1897        Get piColumnId to iThis
  1898        Send UpdateDataForSelectedRow of hoDataSource iThis sValue bPush
  1899    End_Procedure
  1900  
  1901    {MethodType=Event }
  1902    Procedure OnSelectedRowDataChanged String sOldValue String sValue
  1903    End_Procedure
  1904
  1905    { MethodType=Event }
  1906    Procedure OnEditChanging
  1907    End_Procedure
  1908    
  1909
  1910End_Class  // cGridColumn
  1911
  1912