Module cSigCJPropertyGrid.pkg

     1//==============================================================================
     2// Project      : SigCj - VDF Classes for Codejock
     3// File         : cSigCJPropertyGrid.pkg
     4// Description  : VDF Class for Codejock control
     5//
     6// Revision     : $Rev: 599 $
     7//                $Date: 2009-10-14 05:39:01 -0400 (Wed, 14 Oct 2009) $
     8//                $Author: pak $ Martin Pincott
     9// 
    10// Requirements : Visual DataFlex 12.1+
    11//                Codejock SuitePro - Version 12.0.0+
    12//
    13// Copyright    : (c) 2008 VDF SIG UK
    14//                Visual DataFlex Special Interest Group UK.
    15//                http://www.vdfsig.co.uk/
    16//                dev@vdfsig.co.uk
    17//
    18//                This file is part of SigCj.
    19//
    20//                SigCj is free software: you can redistribute it and/or modify
    21//                it under the terms of the GNU Lesser General Public License 
    22//                as published by the Free Software Foundation, either version 
    23//                2.1 of the License, or (at your option) any later version.
    24//
    25//                SigCj is distributed in the hope that it will be useful, but 
    26//                WITHOUT ANY WARRANTY; without even the implied warranty of
    27//                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    28//                GNU Lesser General Public License for more details.
    29//
    30//                If you have the complete SigCj workspace then a copy of the  
    31//                GNU Lesser General Public License is in the Docs folder. If  
    32//                not, see <http://www.gnu.org/licenses/>.
    33//    
    34//==============================================================================
    35
    36Use SigCjW_PropertyGrid.pkg
    37Use cSigCJMethods_Mixin.pkg
    38Use cSigCJGlobalSettings.pkg
    39Use StdFont.pkg
    40Use brdcster.pkg
    41
    42Register_Procedure OnMoveItemDataIn
    43Register_Procedure OnMoveItemDataOut
    44Register_Procedure ReadItemFromDatabase
    45Register_Function  pbCapslock_State Returns Boolean
    46
    47//Redefine (rename) Themes
    48Define ePGThm_Default           for OLExtpGridThemeDefault
    49Define ePGThm_NativeWinXP       for OLExtpGridThemeNativeWinXP
    50Define ePGThm_Office2003        for OLExtpGridThemeOffice2003
    51Define ePGThm_Cool              for OLExtpGridThemeCool
    52Define ePGThm_Simple            for OLExtpGridThemeSimple
    53Define ePGThm_Delphi            for OLExtpGridThemeDelphi
    54Define ePGThm_Whidbey           for OLExtpGridThemeWhidbey
    55Define ePGThm_OfficeXP          for OLExtpGridThemeOfficeXP
    56Define ePGThm_Office2007        for OLExtpGridThemeOffice2007
    57//Redefine (rename) Border Styles
    58Define ePGBs_None               for OLExtpGridBorderNone
    59Define ePGBs_Flat               for OLExtpGridBorderFlat
    60Define ePGBs_StaticEdge         for OLExtpGridBorderStaticEdge
    61Define ePGBs_ClientEdge         for OLExtpGridBorderClientEdge
    62//Redfine (rename) Data Types
    63Define ePGItype_String          for OLEPropertyItemString
    64Define ePGItype_Number          for OLEPropertyItemNumber
    65Define ePGItype_Boolean         for OLEPropertyItemBool
    66Define ePGItype_Color           for OLEPropertyItemColor
    67Define ePGItype_Font            for OLEPropertyItemFont
    68Define ePGItype_Double          for OLEPropertyItemDouble
    69Define ePGItype_Date            for OLEPropertyItemDate
    70Define ePGItype_Picture         for OLEPropertyItemPicture
    71Define ePGItype_Enum            for OLEPropertyItemEnum
    72Define ePGItype_EnumFlags       for OLEPropertyItemEnumFlags
    73Define ePGItype_Category        for OLEPropertyItemCategory
    74Define ePGItype_MultiLineString for OLEPropertyItemMultilineString
    75//InPlaceButton Styles
    76Define ePGIBS_Expand            for 100   // '...'
    77Define ePGIBS_Combo             for 101
    78//Edit Styles
    79Define ePGEditStyle_Left        for OLEEditStyleLeft
    80Define ePGEditStyle_Center      for OLEEditStyleCenter
    81Define ePGEditStyle_Right       for OLEEditStyleRight
    82Define ePGEditStyle_MultiLine   for OLEEditStyleMultiLine
    83Define ePGEditStyle_Uppercase   for OLEEditStyleUpperCase
    84Define ePGEditStyle_Lowercase   for OLEEditStyleLowerCase
    85Define ePGEditStyle_AutoVScroll for OLEEditStyleAutoVscroll
    86Define ePGEditStyle_AutoHScroll for OLEEditStyleAutoHscroll
    87Define ePGEditStyle_Number      for OLEEditStyleNumber
    88Define ePGEditStyle_VScroll     for OLEEditStyleVScroll
    89Define ePGEditStyle_Password    for 32
    90
    91Struct tdGridItemSelectionValue
    92    String  sDescription
    93    Variant vCode
    94    Integer iIconIndex
    95    Integer iItemData
    96End_Struct
    97
    98Struct tdPropertyItemMask
    99    Boolean bSetMask
   100    String  sMask
   101    String  sLiteral
   102    Variant vPrompt
   103End_Struct
   104
   105{DocStart = Class}
   106//---------------------------------------------------
   107//
   108// Class        : cSigCJPropertyGrid
   109//
   110// Superclass   : cSigCjComPropertyGrid 
   111//
   112// Package      : cSigCJPropertyGrid.pkg
   113//
   114// Mixins       : cSigCJImage_Manager_Mixin
   115//
   116// Description  : Represents a PropertyGrid control. The property grid comes with a built in toolbar for easy sorting 
   117//                and grouping, and a help panel to display information on each selected item. 
   118//
   119// Properties   : peVisualTheme                 (Integer)
   120//                prSplitterPos                 (Real)
   121//                pbVariableSplitterPos         (Boolean)
   122//                pbHighlightChanged            (Boolean)
   123//                pbHelpVisible                 (Bolean)
   124//                piHelpHeight                  (Integer)
   125//                pbToolbarVisible              (Boolean)
   126//                pbVariableHelpHeight          (Boolean)
   127//                pbVariableItemsHeight         (Boolean)
   128//                pbShowInPlaceButtonsAlways    (Boolean)
   129//                peBorderStyle                 (Integer)
   130//
   131// Events       : OnMoveDataIn
   132//                OnMoveDataOut
   133//                OnItemChanged                 (Handle hoItem)
   134//
   135// Methods      : Procedure DoMoveDataIn                 
   136//                Procedure DoMoveDataOut
   137//                Procedure Apply
   138//                Procedure DoEnumerateAllPropertyGridItems
   139//                Function  AddImage            (String sImage Integer iId Integer eImageType Returns Integer)
   140//
   141// Notes        :
   142//
   143// To Do        : Currently unable to get psFormat to work for item type 'double'. Need to look at this
   144//                                
   145//---------------------------------------------------
   146{DocEnd} 
   147
   148{ OverrideProperty=Label                     DesignTime=False }
   149{ OverrideProperty=Label_Col_Offset          DesignTime=False }
   150{ OverrideProperty=Label_Justification_Mode  DesignTime=False }
   151{ OverrideProperty=Label_Row_Offset          DesignTime=False }
   152{ OverrideProperty=peAnchors                 DesignTime=False }
   153{ OverrideProperty=piMinSize                 DesignTime=False }
   154{ OverrideProperty=TextColor                 DesignTime=False }
   155{ OverrideProperty=Color                     DesignTime=False }
   156{ OverrideProperty=Border_Style              DesignTime=False }
   157{ OverrideProperty=Enabled_State             DesignTime=False }
   158{ OverrideProperty=Visible_State             DesignTime=False }
   159{ OverrideProperty=Attach_Parent_State       DesignTime=False }
   160{ OverrideProperty=Block_Mouse_State         DesignTime=False }
   161{ OverrideProperty=Client_Area_State         DesignTime=False }
   162{ OverrideProperty=Delegation_Mode           DesignTime=False }
   163{ OverrideProperty=Focus_Mode                DesignTime=False }
   164{ OverrideProperty=pbBindValue               DesignTime=False }
   165{ OverrideProperty=peAutoCreate              DesignTime=False }
   166{ OverrideProperty=peNeighborhood            DesignTime=False }
   167{ OverrideProperty=Popup_State               DesignTime=False }
   168{ OverrideProperty=Ring_State                DesignTime=False }
   169{ OverrideProperty=Scope_State               DesignTime=False }
   170{ OverrideProperty=Search_Case               DesignTime=False }
   171{ OverrideProperty=Skip_State                DesignTime=False }
   172{ OverrideProperty=Help_Id                   DesignTime=False }
   173{ OverrideProperty=Help_Keyword              DesignTime=False }
   174{ OverrideProperty=psHtmlHelpTopic           DesignTime=False }
   175{ OverrideProperty=Status_Help               DesignTime=False }
   176{ OverrideProperty=Use_Parent_Status_Help    DesignTime=False }
   177{ OverrideProperty=psLicenseKey              DesignTime=False }
   178{ OverrideProperty=psProgID                  DesignTime=False }
   179{ DesignerClass=None }
   180Class cSigCJPropertyGrid is a cSigCjComPropertyGrid
   181    Import_Class_Protocol cSigCJMethods_Mixin
   182    
   183    Procedure Construct_Object
   184        Forward Send Construct_Object
   185
   186        // Define new Properties:
   187        { DesignTime=False Visibility=Private }
   188        Property Integer Private.peVisualTheme              ePGThm_Office2003
   189        { DesignTime=False Visibility=Private }
   190        Property Real Private.prSplitterPos                 0.5
   191        { DesignTime=False Visibility=Private }
   192        Property Boolean Private.pbVariableSplitterPos      True
   193        { DesignTime=False Visibility=Private }
   194        Property Boolean Private.pbHighlightChanged         True
   195        { DesignTime=False Visibility=Private }
   196        Property Boolean Private.pbHelpVisible              True
   197        { DesignTime=False Visibility=Private }
   198        Property Integer Private.piHelpHeight               50
   199        { DesignTime=False Visibility=Private }
   200        Property Boolean Private.pbToolbarVisible           True
   201        { DesignTime=False Visibility=Private }
   202        Property Boolean Private.pbVariableHelpHeight       False
   203        { DesignTime=False Visibility=Private }
   204        Property Boolean Private.pbVariableItemsHeight      False
   205        { DesignTime=False Visibility=Private }
   206        Property Boolean Private.pbShowInPlaceButtonsAlways False
   207        { DesignTime=False Visibility=Private }
   208        Property Integer Private.peBorderStyle              ePGBs_Flat                
   209
   210        //Property phoMainContainerObjectID
   211        //The object ID of the main container object (ie the view) that contains any DDs that this grid will use
   212        //Set automatically (in Item_Data_Set) if not specified, but can be set by the developer
   213        Property Handle  phoMainContainerObjectID           (Parent(Self))
   214        
   215        // Create child objects:
   216        Object oAllPropertyGridItems is a Broadcaster
   217        End_Object
   218
   219        Set peAnchors to anAll  
   220    End_Procedure
   221
   222    // Create and augment procedures and functions
   223    { Category="CodeJock" }
   224    { MethodType=Property }
   225    { EnumList="ePGThm_Default, ePGThm_NativeWinXP, ePGThm_Office2003, ePGThm_Cool, ePGThm_Simple, ePGThm_Delphi, ePGThm_Whidbey, ePGThm_OfficeXP, ePGThm_Office2007" }
   226    { InitialValue=ePGThm_Office2003 }
   227    Procedure Set peVisualTheme Integer eTheme
   228        Set SigCJProperty Set_Private.peVisualTheme Set_ComVisualTheme to eTheme
   229    End_Procedure
   230
   231    { Category="CodeJock" }
   232    { MethodType=Property }
   233    Function peVisualTheme Returns Integer
   234        Function_Return (Private.peVisualTheme(Self))
   235    End_Function
   236    
   237    { Category="CodeJock" }
   238    { MethodType=Property }
   239    { InitialValue=0.5}
   240    Procedure Set prSplitterPos Real rSplitterPos     
   241        Boolean bIsCreated
   242        
   243        Get IsComObjectCreated to bIsCreated
   244        If (bIsCreated) Begin
   245            Set ComSplitterPos to rSplitterPos
   246        End
   247        Set Private.prSplitterPos to rSplitterPos
   248    End_Procedure
   249
   250    { Category="CodeJock" }
   251    { MethodType=Property }    
   252    Function prSplitterPos Returns Real
   253        Function_Return (Private.prSplitterPos(Self))
   254    End_Function
   255
   256    { Category="CodeJock" }
   257    { MethodType=Property }
   258    { PropertyType=Boolean}
   259    { InitialValue=True}
   260    Procedure Set pbVariableSplitterPos Boolean bState
   261        Set SigCJProperty Set_Private.pbVariableSplitterPos Set_ComVariableSplitterPos to bState           
   262    End_Procedure
   263
   264    { Category="CodeJock" }
   265    { MethodType=Property }
   266    Function pbVariableSplitterPos Returns Boolean
   267        Function_Return (Private.pbVariableSplitterPos(Self))
   268    End_Function
   269
   270    { Category="CodeJock" } 
   271    { MethodType=Property }
   272    { PropertyType=Boolean }
   273    { InitialValue=True }
   274    Procedure Set pbHighlightChanged Boolean bState
   275        Set SigCJProperty Set_Private.pbHighlightChanged Set_ComHighlightChangedItems to bState         
   276    End_Procedure
   277
   278    { Category="CodeJock" }
   279    { MethodType=Property }
   280    Function pbHighlightChanged Returns Boolean
   281        Function_Return (Private.pbHighlightChanged(Self))
   282    End_Function   
   283
   284    { Category="CodeJock" } 
   285    { MethodType=Property }
   286    { PropertyType=Boolean }
   287    { InitialValue=True }
   288    Procedure Set pbHelpVisible Boolean bState
   289        Set SigCJProperty Set_Private.pbHelpVisible Set_ComHelpVisible to bState            
   290    End_Procedure
   291
   292    { Category="CodeJock" }
   293    { MethodType=Property }
   294    Function pbHelpVisible Returns Boolean
   295        Function_Return (Private.pbHelpVisible(Self))
   296    End_Function  
   297
   298    { Category="CodeJock" }
   299    { MethodType=Property }
   300    { InitialValue=50}
   301    Procedure Set piHelpHeight Integer iHeight
   302        Set SigCJProperty Set_Private.piHelpHeight Set_ComHelpHeight to iHeight           
   303    End_Procedure
   304
   305    { Category="CodeJock" }
   306    { MethodType=Property }
   307    Function piHelpHeight Returns Integer
   308        Function_Return (Private.piHelpHeight(Self))
   309    End_Function  
   310
   311    { Category="CodeJock" } 
   312    { MethodType=Property }
   313    { PropertyType=Boolean }
   314    { InitialValue=True }
   315    Procedure Set pbToolbarVisible Boolean bState
   316        Set SigCJProperty Set_Private.pbToolbarVisible Set_ComToolBarVisible to bState               
   317    End_Procedure
   318
   319    { Category="CodeJock" }
   320    { MethodType=Property }
   321    Function pbToolbarVisible Returns Boolean
   322        Function_Return (Private.pbToolbarVisible(Self))
   323    End_Function     
   324
   325    { Category="CodeJock" } 
   326    { MethodType=Property }
   327    { PropertyType=Boolean }
   328    { InitialValue=False }
   329    Procedure Set pbVariableHelpHeight Boolean bState
   330        Set SigCJProperty Set_Private.pbVariableHelpHeight Set_ComVariableHelpHeight to bState       
   331    End_Procedure
   332
   333    { Category="CodeJock" }
   334    { MethodType=Property }
   335    Function pbVariableHelpHeight Returns Boolean
   336        Function_Return (Private.pbVariableHelpHeight(Self))
   337    End_Function  
   338
   339    { Category="CodeJock" } 
   340    { MethodType=Property }
   341    { PropertyType=Boolean }
   342    { InitialValue=False }
   343    Procedure Set pbVariableItemsHeight Boolean bState
   344        Set SigCJProperty Set_Private.pbVariableItemsHeight Set_ComVariableItemsHeight to bState           
   345    End_Procedure
   346
   347    { Category="CodeJock" }
   348    { MethodType=Property }
   349    Function pbVariableItemsHeight Returns Boolean
   350        Function_Return (Private.pbVariableItemsHeight(Self))
   351    End_Function  
   352
   353    { Category="CodeJock" } 
   354    { MethodType=Property }
   355    { PropertyType=Boolean }
   356    { InitialValue=False }
   357    Procedure Set pbShowInPlaceButtonsAlways Boolean bState
   358        Set SigCJProperty Set_Private.pbShowInPlaceButtonsAlways Set_ComShowInplaceButtonsAlways to bState          
   359    End_Procedure
   360
   361    { Category="CodeJock" }
   362    { MethodType=Property }
   363    Function pbShowInPlaceButtonsAlways Returns Boolean
   364        Function_Return (Private.pbShowInPlaceButtonsAlways(Self))
   365    End_Function  
   366
   367    { Category="CodeJock" }
   368    { MethodType=Property }
   369    { EnumList="ePGBs_None, ePGBs_Flat, ePGBs_StaticEdge, ePGBs_ClientEdge" }
   370    { InitialValue=ePGBs_Flat }
   371    Procedure Set peBorderStyle Integer eStyle
   372        Set SigCJProperty Set_Private.peBorderStyle Set_ComBorderStyle to eStyle
   373    End_Procedure
   374
   375    { Category="CodeJock" }
   376    { MethodType=Property }
   377    Function peBorderStyle Returns Integer
   378        Function_Return (Private.peBorderStyle(Self))
   379    End_Function    
   380
   381    {DocStart = Method}
   382    //---------------------------------------------------
   383    //
   384    // Procedure    : Item_Data_Set
   385    //
   386    // Scope        : Private 
   387    //
   388    // Paramaters   : iFile_Number
   389    //
   390    // Returns      : Handle
   391    //
   392    // Purpose      : Pass a file number and this function will return the object id of the DDO in the view whose main_file
   393    //                matches the passed value. Uses internally when binding property grid items to a database (Procedure BindToDataBase)
   394    //                
   395    // Notes        : 
   396    //               
   397    //---------------------------------------------------
   398    {DocEnd}     
   399    { MethodType=Method Visibility=Private }
   400    Function Item_Data_Set Integer iFile_Number Returns Handle
   401        Handle hoDDO hoMainContainer
   402        Integer iClient_ID
   403        
   404        Get phoMainContainerObjectID to hoMainContainer
   405        If (hoMainContainer = 0) Begin
   406            Get Client_Id to iClient_ID
   407            If (iClient_ID <> 0) Begin
   408                Move Self to hoMainContainer
   409                While ((Parent(hoMainContainer) <> iClient_ID) and (hoMainContainer <> 0))
   410                    Get Parent of hoMainContainer to hoMainContainer
   411                Loop 
   412                Set phoMainContainerObjectID to hoMainContainer
   413            End
   414        End
   415        If (hoMainContainer <> 0) Begin
   416            Broadcast Get Data_Set of hoMainContainer iFile_Number to hoDDO
   417        End
   418        Function_Return hoDDO
   419    End_Function
   420        
   421    Procedure OnCreate
   422        //Apply Property Grid Settings...
   423        Set ComIcons to (ComIcons(ghoSigCjGlobalSetting))
   424        
   425        Set peVisualTheme to (Private.peVisualTheme(Self))         
   426        Set prSplitterPos to (Private.prSplitterPos (Self))         
   427        Set pbVariableSplitterPos to (Private.pbVariableSplitterPos(Self))    
   428        Set pbHighlightChanged to (Private.pbHighlightChanged(Self))       
   429        Set pbHelpVisible to (Private.pbHelpVisible(Self))             
   430        Set piHelpHeight to (Private.piHelpHeight(Self))            
   431        Set pbToolbarVisible to (Private.pbToolbarVisible(Self))           
   432        Set pbVariableHelpHeight to (Private.pbVariableHelpHeight(Self))       
   433        Set pbVariableItemsHeight to (Private.pbVariableItemsHeight(Self))     
   434        Set pbShowInPlaceButtonsAlways to (Private.pbShowInPlaceButtonsAlways(Self)) 
   435        Set peBorderStyle to (Private.peBorderStyle(Self))  
   436        //Create Child Objects
   437        Broadcast Send Private.Create Self True
   438        //Upload Data
   439        Send DoMoveDataIn
   440    End_Procedure
   441    
   442    {DocStart = Method}
   443    //---------------------------------------------------
   444    //
   445    // Procedure    : DoEnumerateAllPropertyGridItems
   446    //
   447    // Scope        : Public 
   448    //
   449    // Paramaters   : iMsg
   450    //
   451    // Returns      : None
   452    //
   453    // Purpose      : As objects of type cSigCJPropertyGridItem are created they are registered with a Broadcaster object
   454    //                DoEnumerateAllPropertyGridItems simply sends the passed message to all registered objects
   455    //                
   456    // Notes        : 
   457    //               
   458    //---------------------------------------------------
   459    {DocEnd} 
   460    
   461    { MethodType=Method Visibility=Public }
   462    Procedure DoEnumerateAllPropertyGridItems Integer iMsg
   463        Set broadcast_state of (oAllPropertyGridItems(Self)) to True
   464        Send iMsg of (oAllPropertyGridItems(Self))
   465        Set broadcast_state of (oAllPropertyGridItems(Self)) to False
   466    End_Procedure
   467
   468    
   469    {DocStart = Method}
   470    //---------------------------------------------------
   471    //
   472    // Procedure    : OnMoveDataIn
   473    //
   474    // Scope        : Event
   475    //
   476    // Paramaters   : None
   477    //
   478    // Returns      : None
   479    //
   480    // Purpose      : Called from DoMoveDataIn. Simple hook that can used for moving data into the control (ie find a record in a dd)
   481    //                
   482    // Notes        : The message OnMoveItemDataIn will also be sent to all grid items 
   483    //               
   484    //---------------------------------------------------
   485    {DocEnd} 
   486    
   487    {MethodType=Event}
   488    Procedure OnMoveDataIn
   489    End_Procedure
   490
   491    {DocStart = Method}
   492    //---------------------------------------------------
   493    //
   494    // Procedure    : OnMoveDataOut
   495    //
   496    // Scope        : Event
   497    //
   498    // Paramaters   : None
   499    //
   500    // Returns      : None
   501    //
   502    // Purpose      : Called from DoMoveDataOut. Simple hook that can used for moving data out of the control
   503    //                
   504    // Notes        : The message OnMoveItemDataOut will also be sent to all grid items 
   505    //               
   506    //---------------------------------------------------
   507    {DocEnd} 
   508        
   509    {MethodType=Event}
   510    Procedure OnMoveDataOut
   511    End_Procedure    
   512
   513    {DocStart = Method}
   514    //---------------------------------------------------
   515    //
   516    // Procedure    : DoMoveDataIn
   517    //
   518    // Scope        : Public Method
   519    //
   520    // Paramaters   : None
   521    //
   522    // Returns      : None
   523    //
   524    // Purpose      : Calls OnMoveDataIn of the property grid object and also OnMoveItemDataIn of all property grid item objects
   525    //                
   526    // Notes        : Can be called as a means of loading the property grid items with data 
   527    //               
   528    //---------------------------------------------------
   529    {DocEnd} 
   530        
   531    { MethodType=Method Visibility=Public }
   532    Procedure DoMoveDataIn
   533        Send OnMoveDataIn
   534        Send DoEnumerateAllPropertyGridItems Msg_ReadItemFromDatabase
   535        Send DoEnumerateAllPropertyGridItems msg_OnMoveItemDataIn
   536    End_Procedure    
   537
   538    {DocStart = Method}
   539    //---------------------------------------------------
   540    //
   541    // Procedure    : DoMoveDataOut
   542    //
   543    // Scope        : Public Method
   544    //
   545    // Paramaters   : None
   546    //
   547    // Returns      : None
   548    //
   549    // Purpose      : Calls OnMoveDataOut of the property grid object and also OnMoveItemDataOut of all property grid item objects
   550    //                
   551    // Notes        : Can be called as a means of saving the property grid's data (from Request_save for example)
   552    //               
   553    //---------------------------------------------------
   554    {DocEnd} 
   555        
   556    { MethodType=Method Visibility=Public }
   557    Procedure DoMoveDataOut
   558        Send OnMoveDataOut
   559        Send DoEnumerateAllPropertyGridItems msg_OnMoveItemDataOut
   560    End_Procedure
   561
   562    {DocStart = Method}
   563    //---------------------------------------------------
   564    //
   565    // Procedure    : Apply
   566    //
   567    // Scope        : Public Method
   568    //
   569    // Paramaters   : None
   570    //
   571    // Returns      : None
   572    //
   573    // Purpose      : Simply sends DoMoveDataOut
   574    //                
   575    // Notes        : If you have coded OnMoveDataOut and OnMoveItemDataOut to save data to the database, it can be triggered simply
   576    //                by calling 'Apply' of the control
   577    //               
   578    //---------------------------------------------------
   579    {DocEnd} 
   580        
   581    { MethodType=Method Visibility=Public }
   582    Procedure Apply
   583        Send DoMoveDataOut
   584    End_Procedure
   585    
   586
   587    {DocStart = Method}
   588    //---------------------------------------------------
   589    //
   590    // Procedure    : OnComInplaceButtonDown
   591    //
   592    // Scope        : Private Event
   593    //
   594    // Paramaters   : llButton, llCancel
   595    //
   596    // Returns      : None
   597    //
   598    // Purpose      : Called when ever an items lookup button is clicked. 
   599    //                Sends OnClick to the appropriate item object
   600    //                
   601    // Notes        : Called internally. Developer does not need to concern themself with this
   602    //                Only objects of class cSigCJPropertyGridComboFormItem and cSigCJPropertyGridExpandbtnItem will receive OnClick
   603    //               
   604    //---------------------------------------------------
   605    {DocEnd} 
   606    
   607    {MethodType=Event}
   608    Procedure OnComInplaceButtonDown Variant llButton Variant llCancel
   609        Handle hoButton hoItem hoObject_ID
   610        Variant vGridItem
   611        
   612        Get Create U_cSigCjComPropertyGridInplaceButton to hoButton
   613        Set pvComObject of hoButton to llButton
   614        Get ComItem of hoButton to vGridItem
   615        Get Create U_cSigCjComPropertyGridItem to hoItem
   616        Set pvComObject of hoItem to vGridItem
   617        Get ComID of hoItem to hoObject_ID
   618        Send Destroy of hoItem
   619        Send Destroy of hoButton
   620        If (hoObject_ID <> 0) Begin
   621            Send OnClick of hoObject_ID
   622        End       
   623    End_Procedure
   624
   625    {MethodType=Event}
   626    //Fired when ever a combo is dropped down or expand button clicked
   627    Procedure OnClick
   628    End_Procedure    
   629
   630    {DocStart = Method}
   631    //---------------------------------------------------
   632    //
   633    // Procedure    : OnItemChanged
   634    //
   635    // Scope        : Public Event
   636    //
   637    // Paramaters   : Handle hoItem
   638    //
   639    // Returns      : None
   640    //
   641    // Purpose      : Occurs when a value of any PropertyGridItem has changed.
   642    //                
   643    // Notes        : 
   644    //               
   645    //---------------------------------------------------
   646    {DocEnd} 
   647        
   648    {MethodType=Event}
   649    Procedure OnItemChanged Handle hoItem
   650    End_Procedure
   651    
   652    {DocStart = Method}
   653    //---------------------------------------------------
   654    //
   655    // Procedure    : OnComValueChanged
   656    //
   657    // Scope        : Private Event
   658    //
   659    // Paramaters   : llItem
   660    //
   661    // Returns      : None
   662    //
   663    // Purpose      : Occurs when the value of a PropertyGridItem has changed.
   664    //                Sends OnChange message to item object
   665    //                
   666    // Notes        : Called internally. Developer does not need to concern themself with this
   667    //               
   668    //---------------------------------------------------
   669    {DocEnd} 
   670        
   671    {MethodType=Event}
   672    Procedure OnComValueChanged Variant llItem
   673        Handle hoItem hoObject_ID
   674        
   675        Get Create U_cSigCjComPropertyGridItem to hoItem
   676        Set pvComObject of hoItem to llItem
   677        Get ComID of hoItem to hoObject_ID
   678        Send Destroy of hoItem
   679        If (hoObject_ID <> 0) Begin
   680            Send MoveItemDataToDatabase of hoObject_ID  
   681            Send OnChange of hoObject_ID
   682            Send OnItemChanged hoObject_ID
   683        End     
   684    End_Procedure
   685
   686    {DocStart = Method}
   687    //---------------------------------------------------
   688    //
   689    // Procedure    : OnComAfterEdit
   690    //
   691    // Scope        : Private Event
   692    //
   693    // Paramaters   : llItem, llNewValue (byRef), llCancel (byRef)
   694    //
   695    // Returns      : None
   696    //
   697    // Purpose      : Called when an edit operation is complete
   698    //                Sends OnEditAfter message to item object
   699    //                
   700    // Notes        : Called internally. Developer does not need to concern themself with this
   701    //               
   702    //---------------------------------------------------
   703    {DocEnd}     
   704    
   705    Procedure OnComAfterEdit Variant llItem String ByRef llNewValue Boolean ByRef llCancel
   706        Handle hoItem hoObject_ID
   707        
   708        Get Create U_cSigCjComPropertyGridItem to hoItem
   709        Set pvComObject of hoItem to llItem
   710        Get ComID of hoItem to hoObject_ID
   711        Send Destroy of hoItem
   712        If (hoObject_ID <> 0) Begin
   713            Send OnEditAfter of hoObject_ID (&llNewValue) (&llCancel)
   714        End 
   715    End_Procedure
   716    
   717    
   718End_Class
   719
   720{DocStart = Class}
   721//---------------------------------------------------
   722// Mixin Class  : cSigCJPropertyGridItem_Mixin
   723//---------------------------------------------------
   724{DocEnd} 
   725
   726Class cSigCJPropertyGridItem_Mixin is a Mixin
   727    Import_Class_Protocol cSigCJMethods_Mixin
   728    
   729    { MethodType=Method Visibility=Private }
   730    Procedure Define_Standard_Item_Properties
   731        { DesignTime=False }
   732        Property String Private.psLabel     ''
   733        { DesignTime=False }
   734        Property String Private.psImage                 ''          
   735        { DesignTime=False }
   736        Property String Private.psHelpText  ''
   737        { DesignTime=False }
   738        Property String Private.psToolTip   ''        
   739        { DesignTime=False }
   740        Property Boolean Private.pbCreateExpanded       True  
   741        { DesignTime=False }
   742        Property Boolean Private.pbLabelEmboldened      False
   743        
   744        {DesignTime=False}
   745        Property Handle  Private.phoPropertyCaptionMetrics  (Create(Self, U_cSigCjComPropertyGridItemMetrics))
   746        {DesignTime=False}
   747        Property Handle  Private.phoPropertyValueMetrics    (Create(Self, U_cSigCjComPropertyGridItemMetrics))     
   748    End_Procedure
   749    
   750    {MethodType=Method Visibility=Private}
   751    Procedure Bind_Metrics
   752        Set pvComObject of (Private.phoPropertyCaptionMetrics(Self)) to (ComCaptionMetrics(Self))
   753        Set pvComObject of (Private.phoPropertyValueMetrics(Self)) to (ComValueMetrics(Self))    
   754    End_Procedure
   755    
   756    { MethodType=Property Category="CodeJock"}
   757    Procedure Set psLabel String sLabel
   758        Set SigCJProperty Set_Private.psLabel Set_ComCaption to sLabel
   759    End_Procedure
   760    
   761    { MethodType=Property Category="CodeJock"}
   762    Function psLabel Returns String
   763        Function_Return (Private.psLabel(Self))
   764    End_Function
   765
   766    { MethodType=Property Category="CodeJock" }
   767    Procedure Set psImage String sImage
   768        Integer iImageID
   769        
   770        If (not(IsNullComObject(pvComObject(Self)))) Begin
   771            Get AddImage of ghoSigCjGlobalSetting sImage 0 0 to iImageID //Won't add it again if already uploaded once
   772            If (not(IsNullComObject(pvComObject(Private.phoPropertyCaptionMetrics(Self))))) Begin        
   773                Set ComIconIndex of (Private.phoPropertyCaptionMetrics(Self)) to iImageID    
   774            End
   775        End
   776        Set Private.psImage to sImage
   777    End_Procedure  
   778    
   779    { MethodType=Property Category="CodeJock" }
   780    Function psImage Returns String
   781        Function_Return (Private.psImage(Self))
   782    End_Function  
   783    
   784    { MethodType=Property Category="CodeJock"}
   785    Procedure Set psHelpText String sHelpText
   786        Set SigCJProperty Set_Private.psHelpText Set_ComDescription to sHelpText
   787    End_Procedure
   788    
   789    { MethodType=Property Category="CodeJock"}
   790    Function psHelpText Returns String
   791        Function_Return (Private.psHelpText(Self))
   792    End_Function
   793
   794    { MethodType=Property Category="CodeJock"}
   795    Procedure Set psToolTip String sToolTip
   796        Set SigCJProperty Set_Private.psToolTip Set_ComToolTip to sToolTip
   797    End_Procedure
   798    
   799    { MethodType=Property Category="CodeJock"}
   800    Function psToolTip Returns String
   801        Function_Return (Private.psToolTip(Self))
   802    End_Function
   803    
   804    { MethodType=Property Category="CodeJock"}
   805    { PropertyType=Boolean InitialValue=True } 
   806    Procedure Set pbCreateExpanded Boolean bExpanded
   807        Boolean bExpandable
   808
   809        If (not(IsNullComObject(pvComObject(Self)))) Begin        
   810            Get ComExpandable to bExpandable
   811            If (bExpandable) Begin
   812                Set ComExpanded to bExpanded    
   813            End
   814        End
   815        Set Private.pbCreateExpanded to bExpanded
   816    End_Procedure
   817
   818    { MethodType=Property Category="CodeJock"}
   819    Function pbCreateExpanded Returns Boolean
   820        Function_Return (Private.pbCreateExpanded(Self))
   821    End_Function
   822
   823    { MethodType=Property Category="CodeJock"}
   824    { PropertyType=Boolean InitialValue=True }    
   825    Procedure Set pbLabelEmboldened Boolean bState
   826        Handle hoFont
   827        Variant vFont
   828        Boolean bUnderlined
   829        
   830        If (not(IsNullComObject(pvComObject(Self)))) Begin
   831            If (not(IsNullComObject(pvComObject(Private.phoPropertyCaptionMetrics(Self))))) Begin
   832                Get Create U_cComStdFont to hoFont 
   833                Get ComFont of (Private.phoPropertyCaptionMetrics(Self)) to vFont  
   834                Set pvComObject of hoFont to vFont
   835                Get ComUnderline of hoFont to bUnderlined
   836                Set ComUnderline of hoFont to True
   837                Set ComBold of hoFont to bState
   838                Set ComUnderline of hoFont to bUnderlined
   839                Send Destroy of hoFont  
   840            End
   841        End  
   842        Set Private.pbLabelEmboldened to bState
   843    End_Procedure
   844    
   845    { MethodType=Property Category="CodeJock"}
   846    Function pbLabelEmboldened Returns Boolean
   847        Function_Return (Private.pbLabelEmboldened(Self))
   848    End_Function
   849        
   850End_Class
   851
   852{DocStart = Class}
   853//---------------------------------------------------
   854//
   855// Class        : cSigCJPropertyGridCategory
   856//
   857// Superclass   : cSigCjComPropertyGridItem 
   858//
   859// Package      : cSigCJPropertyGrid.pkg
   860//
   861// Mixins       : cSigCJPropertyGridItem_Mixin
   862//
   863// Description  : Categories are used to group PropertyGritItems into groups within the PropertyGrid. Categories have an 
   864//                expand/collapse button that can be used to Show/hide the PropertyGridItems that belong the the category.
   865//
   866// Properties   : psLabel               (String)
   867//                psHelpText            (String)
   868//                psToolTip             (String)
   869//                pbCreateExpanded      (Boolean)
   870//                pbLabelEmboldened     (Boolean)
   871//
   872// Events       : 
   873//
   874// Methods      :                 
   875//
   876// Notes        :
   877//
   878// To Do        :           
   879//               
   880//---------------------------------------------------
   881{DocEnd} 
   882
   883{ OverrideProperty=psLicenseKey    DesignTime=False }
   884{ OverrideProperty=psProgID        DesignTime=False }
   885{ OverrideProperty=Delegation_Mode DesignTime=False }
   886{ OverrideProperty=peAutoCreate    DesignTime=False }
   887{ OverrideProperty=peNeighborhood  DesignTime=False }
   888
   889Class cSigCJPropertyGridCategory is a cSigCjComPropertyGridItem
   890    Import_Class_Protocol cSigCJMethods_Mixin
   891    Import_Class_Protocol cSigCJPropertyGridItem_Mixin
   892    
   893    Procedure Construct_Object
   894        Forward Send Construct_Object
   895
   896        // Define new Properties:
   897        Send Define_Standard_Item_Properties
   898        
   899        // Create child objects:
   900
   901        // Set property values:
   902        Set Private.pbLabelEmboldened to True
   903    End_Procedure
   904
   905    // Create and augment procedures and functions
   906        
   907    { MethodType=Method Visibility=Private }
   908    Procedure Private.Create Handle hoParent Boolean bRecursive
   909        Variant vCategory
   910        
   911        //check for parent
   912        If (hoParent = 0) Begin
   913            Procedure_Return
   914        End
   915        Get ComAddCategory (Private.psLabel(Self)) to vCategory
   916        Set pvComObject to vCategory
   917        Send Bind_Metrics  
   918        Set pbLabelEmboldened to (Private.pbLabelEmboldened(Self))
   919        Set pbCreateExpanded to (Private.pbCreateExpanded(Self))
   920        Set psImage to (Private.psImage(Self))
   921        Set psHelpText to (Private.psHelpText(Self))
   922        If (bRecursive) Begin
   923            Broadcast Send Private.Create Self True
   924        End
   925    End_Procedure
   926        
   927End_Class
   928
   929{DocStart = Class}
   930//---------------------------------------------------
   931//
   932// Class        : cSigCJPropertyGridItem
   933//
   934// Superclass   : cSigCjComPropertyGridItem 
   935//
   936// Package      : cSigCJPropertyGrid.pkg
   937//
   938// Mixins       : cSigCJPropertyGridItem_Mixin
   939//
   940// Description  : Represents an item in the Property Grid.
   941//
   942// Properties   : psLabel                 (String)  
   943//                psHelpText              (String)  
   944//                psToolTip               (String)  
   945//                pbCreateExpanded        (Boolean) 
   946//                pbLabelEmboldened       (Boolean) 
   947//                peItemType              (Integer)
   948//                pvValue                 (Variant)
   949//                pbDefaultAsInitialValue (Boolean) 
   950//                pvDefaultValue          (Variant)
   951//                pvInitialValue          (Variant)
   952//                pvTag                   (Variant)
   953//                pbHidden                (Boolean) 
   954//                pbReadOnly              (Boolean) 
   955//                pbPassword_State        (Boolean)
   956//                pbCapslock_State        (Boolean)
   957//                piForm_Margin           (Integer) 
   958//                piValueBackgroundColor  (Integer)
   959//                psImage                 (String)
   960//                psFormat                (String)
   961//
   962//                READ-ONLY ***
   963//                Item_Server             (Handle)
   964//                Item_Data_Field         (Integer)
   965//
   966// Events       : OnChange          
   967//                OnEditAfter       
   968//                OnMoveItemDataIn  
   969//                OnMoveItemDataOut 
   970//
   971// Methods      : Procedure Set PropertyItemMask (String llMask String llLiteral Variant llPrompt)   
   972//                Procedure BindToDatabase (integer hFile integer iField) 
   973//                MoveItemDataToDatabase
   974//                ReadItemFromDatabase 
   975//
   976// Notes        : Example call of BindToDatabase: Send BindToDatabase File_Field Sysfile.Field_1
   977//
   978// To Do        :           
   979//               
   980//---------------------------------------------------
   981{DocEnd} 
   982
   983{ OverrideProperty=psLicenseKey    DesignTime=False }
   984{ OverrideProperty=psProgID        DesignTime=False }
   985{ OverrideProperty=Delegation_Mode DesignTime=False }
   986{ OverrideProperty=peAutoCreate    DesignTime=False }
   987{ OverrideProperty=peNeighborhood  DesignTime=False }
   988
   989Class cSigCJPropertyGridItem is a cSigCjComPropertyGridItem
   990    Import_Class_Protocol cSigCJMethods_Mixin
   991    Import_Class_Protocol cSigCJPropertyGridItem_Mixin
   992    
   993    Procedure Construct_Object
   994        Forward Send Construct_Object
   995
   996        // Define new Properties:
   997        Send Define_Standard_Item_Properties
   998        
   999        { DesignTime=False }
  1000        Property Integer Private.peItemType             ePGItype_String
  1001        { DesignTime=False }
  1002        Property Variant Private.pvValue
  1003        { DesignTime=True }
  1004        Property Boolean pbDefaultAsInitialValue        True  
  1005        { DesignTime=False }
  1006        Property Variant Private.pvDefaultValue
  1007        { DesignTime=False }
  1008        Property Variant Private.pvTag  
  1009        { Visibility=Private }
  1010        Property tdPropertyItemMask ptPropertyItemMask
  1011        { DesignTime=False }
  1012        Property Boolean Private.pbHidden               False
  1013        { DesignTime=False }
  1014        Property Boolean Private.pbReadOnly             False
  1015        { DesignTime=False }
  1016        Property Boolean Private.pbIsPassword           False
  1017        { DesignTime=False }
  1018        Property Boolean Private.pbCapslock             False
  1019        { DesignTime=False }
  1020        Property Integer Private.piFormMargin           0
  1021        { DesignTime=False }
  1022        Property Integer Private.piValueBackgroundColor clWindow 
  1023        { DesignTime=False }
  1024        Property String  Private.psFormat               ''    
  1025        
  1026        //If this item is linked to a field in a database, we may like properties
  1027        //to store the server and field values
  1028        { DesignTime=False }
  1029        Property Handle  Private.phoPropertyGridItemServer      0
  1030        { DesignTime=False }
  1031        Property Integer Private.piPropertyGridItemDataField    0 
  1032        
  1033        // Create child objects:
  1034
  1035        // Set property values:
  1036        
  1037    End_Procedure
  1038
  1039    Procedure End_Construct_Object
  1040        Send Add_Element of (oAllPropertyGridItems(Self)) Self
  1041        Forward Send End_Construct_Object
  1042    End_Procedure
  1043
  1044    // Create and augment procedures and functions
  1045    
  1046    { MethodType=Property Category="CodeJock"}
  1047    Function Item_Server Returns Handle
  1048        Function_Return (Private.phoPropertyGridItemServer(Self))
  1049    End_Function
  1050    
  1051    { MethodType=Property Category="CodeJock"}
  1052    Function Item_Data_Field Returns Integer
  1053        Function_Return (Private.piPropertyGridItemDataField(Self))
  1054    End_Function    
  1055
  1056    {DocStart = Method}
  1057    //---------------------------------------------------
  1058    //
  1059    // Procedure    : MoveItemDataToDatabase
  1060    //
  1061    // Scope        : Public 
  1062    //
  1063    // Paramaters   : None
  1064    //
  1065    // Returns      : None
  1066    //
  1067    // Purpose      : If item is bound to the database (file and field) it will simply set the field_changed_value of the item's
  1068    //                server DDO with the value of the property grid item.
  1069    //                
  1070    // Notes        : Could be Broadcast as part of a save process.
  1071    //                Take care however. If the item has a combo form it MAY be that you DON'T want to save the value (decription)
  1072    //                but instead would want to save the itemdata or code value!
  1073    //                If this is the case, the method can be augmented in the item object to "Get CodeFromDescription" of whatever 
  1074    //                          
  1075    //---------------------------------------------------
  1076    {DocEnd}
  1077        
  1078    { MethodType = Method Visibility=Public }
  1079    Procedure MoveItemDataToDatabase
  1080        Handle  hoDD
  1081        Integer iField eType iValidationType
  1082        Variant vValue
  1083        String  sTrue sFalse sMask
  1084        
  1085        Get Item_Server to hoDD
  1086        Get Item_Data_Field to iField
  1087        If ((hoDD <> 0) and (iField <> 0)) Begin        
  1088            Get pvValue to vValue
  1089            Get peItemType to eType
  1090            If (eType = ePGItype_Boolean) Begin
  1091                Get Field_Validation_Type of hoDD iField to iValidationType
  1092                If (iValidationType = FA_VALIDATION_TYPE_CHECKBOX) Begin
  1093                    Get Field_CheckBox_Value of hoDD iField True to sTrue
  1094                    Get Field_CheckBox_Value of hoDD iField False to sFalse
  1095                    If (vValue="True") Begin
  1096                        Move sTrue to vValue
  1097                    End
  1098                    Else Begin
  1099                        Move sFalse to vValue
  1100                    End
  1101                End
  1102            End
  1103            Set Field_changed_Value of hoDD iField to vValue
  1104        End
  1105    End_Procedure
  1106    
  1107    {DocStart = Method}
  1108    //---------------------------------------------------
  1109    //
  1110    // Procedure    : ReadItemFromDatabase
  1111    //
  1112    // Scope        : Public 
  1113    //
  1114    // Paramaters   : None
  1115    //
  1116    // Returns      : None
  1117    //
  1118    // Purpose      : If item is bound to the database (file and field) it will simply get the field_current_value of the item's
  1119    //                server DDO and set the value of the property grid item.
  1120    //                
  1121    // Notes        : Could be Broadcast as part of an initialise process
  1122    //                Take care however. If the item has a combo form it MAY be that you DON'T want to set the value with the raw 
  1123    //                data but instead with a descriptive value. If this is the case, use Get DescriptionFromCode of the comboitem
  1124    //                and set the value with this instead.
  1125    //                             
  1126    //---------------------------------------------------
  1127    {DocEnd}
  1128        
  1129    { MethodType = Method Visibility=Public }
  1130    Procedure ReadItemFromDatabase
  1131        Handle  hoDD
  1132        Integer iField iValidationType iType
  1133        Variant vValue
  1134        String  sState
  1135        Date dDate
  1136        
  1137        Get Item_Server to hoDD
  1138        Get Item_Data_Field to iField
  1139        If ((hoDD <> 0) and (iField <> 0)) Begin
  1140            Get field_current_value of hoDD iField to vValue
  1141            //Is this a checkbox item that we need to translate to True/False
  1142            Get Field_Validation_Type of hoDD iField to iValidationType
  1143            If (iValidationType = FA_VALIDATION_TYPE_CHECKBOX) Begin
  1144                Get Field_CheckBox_Value of hoDD iField True to sState
  1145                If (sState=vValue) Begin
  1146                    Move "True" to vValue
  1147                End
  1148                Else Begin
  1149                    Move "False" to vValue
  1150                End
  1151            End
  1152            //If data type is DATE, then if we don't use a date variable, the item always shows up as changed (?)
  1153            Get_Attribute DF_FIELD_TYPE of (Main_File(hoDD)) iField to iType
  1154            If (iType=DF_DATE) Begin
  1155                Get field_current_value of hoDD iField to dDate
  1156                Set pvInitialValue to dDate
  1157            End
  1158            Else Begin
  1159                Set pvInitialValue to vValue    
  1160            End
  1161        End
  1162    End_Procedure    
  1163    
  1164        
  1165    { MethodType=Property Category="CodeJock"}
  1166    { EnumList="ePGItype_String, ePGItype_Number, ePGItype_Boolean, ePGItype_Color, ePGItype_Font, ePGItype_Double, ePGItype_Date, ePGItype_Picture, ePGItype_Enum, ePGItype_EnumFlags, ePGItype_Category, ePGItype_MultiLineString" }
  1167    { InitialValue=ePGItype_String }
  1168    Procedure Set peItemType Integer eType
  1169        Set Private.peItemType to eType
  1170    End_Procedure
  1171    
  1172    { MethodType=Property Category="CodeJock"}
  1173    Function peItemType Returns String
  1174        Function_Return (Private.peItemType(Self))
  1175    End_Function
  1176
  1177    { MethodType=Property Category="CodeJock"}
  1178    Procedure Set pvValue Variant vValue
  1179        Set SigCJProperty Set_Private.pvValue Set_ComValue to vValue
  1180    End_Procedure
  1181
  1182    { MethodType=Property Category="CodeJock"}
  1183    Function pvValue Returns String
  1184        Variant vValue
  1185        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1186            Get ComValue to vValue     
  1187        End        
  1188        Function_Return vValue
  1189    End_Function
  1190
  1191    { MethodType=Property Category="CodeJock"}
  1192    Procedure Set pvDefaultValue Variant vValue
  1193        If (pbDefaultAsInitialValue(Self)) Begin
  1194            Procedure_Return //don't set the default
  1195        End        
  1196        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1197            Set ComDefaultValue to vValue     
  1198        End
  1199        Set Private.pvDefaultValue to vValue
  1200    End_Procedure
  1201
  1202    { MethodType=Property Category="CodeJock"}
  1203    Function pvDefaultValue Returns String
  1204        Variant vValue
  1205        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1206            Get ComDefaultValue to vValue     
  1207        End        
  1208        Function_Return vValue
  1209    End_Function
  1210
  1211    {DocStart = Method}
  1212    //---------------------------------------------------
  1213    //
  1214    // Procedure    : Set pvInitialValue
  1215    //
  1216    // Scope        : Public 
  1217    //
  1218    // Paramaters   : Variant (vVal)
  1219    //
  1220    // Returns      : None
  1221    //
  1222    // Purpose      : Can be used to set both the value AND the default value (to be the same) at the same time
  1223    //                
  1224    // Notes        : If setting a value from event OnMoveItemDataIn then this is a useful way of setting both the value AND the default
  1225    //                Otherwise, because the initial value is set during Private.OnCreate, any value applied afterwards will be seen to be 
  1226    //                different (the default will be the intial value - undefined) 
  1227    //               
  1228    //---------------------------------------------------
  1229    {DocEnd} 
  1230    
  1231    { MethodType=Property Category="CodeJock"}
  1232    Procedure Set pvInitialValue Variant vValue
  1233        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1234            Set ComDefaultValue to vValue
  1235            Set ComValue to vValue    
  1236        End
  1237        Set Private.pvValue to vValue
  1238        Set Private.pvDefaultValue to vValue
  1239    End_Procedure
  1240    
  1241    
  1242    { MethodType=Property Category="CodeJock"}
  1243    Procedure Set pvTag Variant vValue
  1244        Set SigCJProperty Set_Private.pvTag Set_ComTag to vValue
  1245    End_Procedure
  1246
  1247    { MethodType=Property Category="CodeJock"}
  1248    Function pvTag Returns String       
  1249        Function_Return (Private.pvTag(Self))
  1250    End_Function      
  1251
  1252    { MethodType=Property Category="CodeJock"}
  1253    { PropertyType=Boolean InitialValue=False } 
  1254    Procedure Set pbHidden Boolean bHidden
  1255        Set SigCJProperty Set_Private.pbHidden Set_ComHidden to bHidden
  1256    End_Procedure
  1257
  1258    { MethodType=Property Category="CodeJock"}
  1259    Function pbHidden Returns Boolean    
  1260        Function_Return (Private.pbHidden(Self))
  1261    End_Function
  1262    
  1263    { MethodType=Property Category="CodeJock"}
  1264    { PropertyType=Boolean InitialValue=False } 
  1265    Procedure Set pbReadOnly Boolean bReadOnly
  1266        Set SigCJProperty Set_Private.pbReadOnly Set_ComReadOnly to bReadOnly
  1267    End_Procedure
  1268
  1269    { MethodType=Property Category="CodeJock"}
  1270    Function pbReadOnly Returns Boolean       
  1271        Function_Return (Private.pbReadOnly(Self))
  1272    End_Function
  1273    
  1274    { MethodType=Property Category="CodeJock"}
  1275    { PropertyType=Boolean InitialValue=False } 
  1276    Procedure Set pbPassword_State Boolean bState
  1277        Set SigCJProperty Set_Private.pbIsPassword Set_ComPasswordMask to bState
  1278    End_Procedure
  1279
  1280    { MethodType=Property Category="CodeJock"}
  1281    Function pbPassword_State Returns Boolean       
  1282        Function_Return (Private.pbIsPassword(Self))
  1283    End_Function    
  1284    
  1285    { MethodType=Property Category="CodeJock"}
  1286    { PropertyType=Boolean InitialValue=False } 
  1287    Procedure Set pbCapslock_State Boolean bState
  1288        Set Private.pbCapslock to bState
  1289    End_Procedure
  1290    
  1291    { MethodType=Property Category="CodeJock"}
  1292    Function pbCapslock_State Returns Boolean
  1293        Function_Return (Private.pbCapslock(Self))
  1294    End_Function 
  1295      
  1296    { MethodType=Property Category="CodeJock"}
  1297    Procedure Set piForm_Margin Integer iWidth
  1298
  1299        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1300            If (not(IsNullComObject(pvComObject(Private.phoPropertyValueMetrics(Self))))) Begin
  1301                Set ComMaxLength of (Private.phoPropertyValueMetrics(Self)) to iWidth
  1302            End
  1303        End
  1304        Set Private.piFormMargin to iWidth
  1305    End_Procedure
  1306    
  1307    { MethodType=Property Category="CodeJock"}
  1308    Function piForm_Margin Returns Integer
  1309        Function_Return (Private.piFormMargin(Self))
  1310    End_Function
  1311    
  1312    { MethodType=Property Category="CodeJock"}
  1313    Procedure Set piValueBackgroundColor Integer iColor
  1314        If (not(IsNullComObject(pvComObject(Self)))) Begin
  1315            If (not(IsNullComObject(pvComObject(Private.phoPropertyValueMetrics(Self))))) Begin
  1316                Set ComBackColor of (Private.phoPropertyValueMetrics(Self)) to iColor
  1317            End
  1318        End
  1319        Set Private.piValueBackgroundColor to iColor
  1320    End_Procedure
  1321    
  1322    { MethodType=Property Category="CodeJock"}
  1323    Function piValueBackgroundColor Returns Integer
  1324        Function_Return (Private.piValueBackgroundColor(Self))
  1325    End_Function    
  1326    
  1327    { MethodType=Property Category="CodeJock" }
  1328    Procedure Set psFormat String sFormat
  1329        Set SigCJProperty Set_Private.psFormat Set_ComFormat to sFormat
  1330    End_Procedure
  1331
  1332    { MethodType=Property Category="CodeJock" }
  1333    Function psFormat Returns String
  1334        Function_Return (Private.psFormat(Self))
  1335    End_Function  
  1336    
  1337    
  1338    {DocStart = Method}
  1339    //---------------------------------------------------
  1340    //
  1341    // Procedure    : Set PropertyItemMask
  1342    //
  1343    // Scope        : Public 
  1344    //
  1345    // Paramaters   : llMask, llLiteral, llPrompt
  1346    //
  1347    // Returns      : None
  1348    //
  1349    // Purpose      : Sets the mask of a property grid item 
  1350    //                
  1351    // Notes        : You can use any of these characters for defining your edit mask:
  1352    //                0 - Numeric (0-9)
  1353    //                9 - Numeric (0-9) or space (' ')
  1354    //                # - Numeric (0-9) or space (' ') or ('+') or ('-')
  1355    //                L - Alpha (a-Z)
  1356    //                ? - Alpha (a-Z) or space (' ')
  1357    //                a - Alpha numeric (0-9 and a-Z)
  1358    //                a - Alpha numeric (0-9 and a-Z) or space (' ')
  1359    //                & - All Print character only
  1360    //                H - Hex digit (0-9 and a-F)
  1361    //                X - Hex digit (0-9 and a-F) and space (' ')
  1362    //                > - Forces characters to upper Case (a-Z)
  1363    //                < - Forces characters to lower Case (a-z)
  1364    //
  1365    //                llLiteral defines the prompt area of the mask where text entry is allowed.  This should match the areas that 
  1366    //                you have already defined as mask fields. By default the prompt character is '_' . 
  1367    //                
  1368    //                llPrompt is optional, but allows you to define default characters that you want displayed when the user presses 
  1369    //                the backspace key. This usually represents data that has been previously saved then restored. This makes it easy 
  1370    //                for the user to restore some or all of the default text displayed when the control was initialized. 
  1371    //---------------------------------------------------
  1372    {DocEnd}     
  1373    
  1374    Procedure Set PropertyItemMask String llMask String llLiteral Variant llPrompt
  1375        tdPropertyItemMask tPropertyItemMask
  1376        
  1377        Move True      to tPropertyItemMask.bSetMask
  1378        Move llMask    to tPropertyItemMask.sMask
  1379        Move llLiteral to tPropertyItemMask.sLiteral
  1380        Move llPrompt  to tPropertyItemMask.vPrompt
  1381        Set ptPropertyItemMask to tPropertyItemMask
  1382    End_Procedure
  1383
  1384    {DocStart = Method}
  1385    //---------------------------------------------------
  1386    //
  1387    // Procedure    : DoApplyMask
  1388    //
  1389    // Scope        : Private 
  1390    //
  1391    // Paramaters   : None
  1392    //
  1393    // Returns      : None
  1394    //
  1395    // Purpose      : Called from Private.Create. Applies any mask set using 'Set PropertyItemMask'
  1396    //                
  1397    // Notes        : Called internally. Developer does not need to concern themself with this
  1398    //               
  1399    //---------------------------------------------------
  1400    {DocEnd} 
  1401        
  1402    Procedure DoApplyMask
  1403        tdPropertyItemMask tPropertyItemMask
  1404        
  1405        Get ptPropertyItemMask to tPropertyItemMask
  1406        If (tPropertyItemMask.bSetMask = True) Begin
  1407            If (not(IsNullComObject(pvComObject(Self)))) Begin
  1408                Send ComSetMask tPropertyItemMask.sMask tPropertyItemMask.sLiteral tPropertyItemMask.vPrompt
  1409            End
  1410        End      
  1411    End_Procedure
  1412
  1413    
  1414    {DocStart = Method}
  1415    //---------------------------------------------------
  1416    //
  1417    // Procedure    : BindToDataBase
  1418    //
  1419    // Scope        : Public 
  1420    //
  1421    // Paramaters   : iFile iField 
  1422    //
  1423    // Returns      : None
  1424    //
  1425    // Purpose      : Links a grid item with the db (file and field). Sets Private.phoPropertyGridItemServer 
  1426    //                and Private.piPropertyGridItemDataField  
  1427    //                                                                     
  1428    // Notes        : If an item is linked to the db, pbCapslock_State and piForm_Margin will be set automatically. If you don't
  1429    //                Set psLabel or psHelpText these too will be taken from the DD
  1430    //                Example Call: Send BindToDataBase File_Field Sysfile.Company_Name 
  1431    //               
  1432    //---------------------------------------------------
  1433    {DocEnd}   
  1434
  1435    Procedure BindToDataBase Integer hFile Integer iField
  1436        Handle  hoDDO 
  1437        Integer iLength iType iValidationType iPrecision
  1438        Boolean bOptionEnabled
  1439        String  sStatusHelp sLabel
  1440        
  1441        Get Item_Data_Set hFile to hoDDO 
  1442        Set Private.phoPropertyGridItemServer to hoDDO
  1443        Set Private.piPropertyGridItemDataField to iField
  1444        //Set properties based on field and DD settings...
  1445        If (hFile <> 0) Begin
  1446            Get_Attribute DF_FIELD_LENGTH of hFile iField to iLength
  1447            Set piForm_Margin to iLength
  1448            Get_Attribute DF_FIELD_TYPE of hFile iField to iType
  1449            If (iType=DF_ASCII) Begin
  1450                Set peItemType to ePGItype_String
  1451            End
  1452            Else If (iType=DF_BCD) Begin
  1453                Get_Attribute DF_FIELD_PRECISION of hFile iField to iPrecision
  1454                If (iPrecision=0) Begin
  1455                    Set peItemType to ePGItype_Number
  1456                End
  1457                Else Begin
  1458                    Set peItemType to ePGItype_Double
  1459                    Set psFormat to  ("%0."-String(iPrecision)-"f")  //Doesn't seem to work. Why?
  1460                End
  1461            End
  1462            Else If (iType=DF_DATE) Begin
  1463                Set peItemType to ePGItype_Date
  1464            End
  1465        End
  1466        If (hoDDO <> 0) Begin
  1467            //Should field by uppercase?
  1468            Get Field_Option of hoDDO iField DD_CAPSLOCK to bOptionEnabled
  1469            If (bOptionEnabled) Begin
  1470                Set pbCapslock_State to True
  1471            End
  1472            //Should field by boolean?
  1473            Get Field_Validation_Type of hoDDO iField to iValidationType
  1474            If (iValidationType = FA_VALIDATION_TYPE_CHECKBOX) Begin
  1475                Set peItemType to ePGItype_Boolean
  1476                Set pbCapslock_State to False  // we don't need True/False to be uppercase
  1477            End
  1478            //Label and helptext
  1479            Get Status_Help of hoDDO iField to sStatusHelp
  1480            Get Field_Label_Long of hoDDO iField to sLabel
  1481            If (psHelpText(Self)="") Begin
  1482                Set psHelpText to sStatusHelp
  1483            End
  1484            If (psLabel(Self)="") Begin
  1485                Set psLabel to sLabel
  1486            End
  1487        End
  1488    End_Procedure
  1489
  1490
  1491    { MethodType=Method Visibility=Private }
  1492    Procedure Private.Create Handle hoParent Boolean bRecursive
  1493        Variant vItem
  1494        Integer iEditStyle eType
  1495        Handle  hoItem
  1496        
  1497        //check for parent
  1498        If (hoParent = 0) Begin
  1499            Procedure_Return
  1500        End
  1501        //Add child item
  1502        Get ComAddChildItem of hoParent (Private.peItemType(Self)) (Private.psLabel(Self)) (Private.pvValue(Self)) to vItem
  1503        Set pvComObject to vItem
  1504        Send Bind_Metrics  
  1505        //Set the ComID value to 'self' so we can map back to the object (see Procedure OnComInplaceButtonDown)
  1506        Set ComId to Self
  1507        //Set Tag value
  1508        Set pvTag to (Private.pvTag(Self))
  1509        //If we have explicitly said that the default should NOT be the same as the initial value, set the default 
  1510        If (not(pbDefaultAsInitialValue(Self))) Begin
  1511            Set pvDefaultValue to (Private.pvDefaultValue(Self))
  1512        End  
  1513        //Set Help Text associated with the item
  1514        Set psHelpText to (Private.psHelpText(Self))
  1515        //Tootip
  1516        Set psToolTip to (Private.psToolTip(Self))
  1517        //Caption Image
  1518        Set psImage to (Private.psImage(Self))
  1519        //Set whether the item should be expanded (if it is expandable)
  1520        Set pbCreateExpanded to (Private.pbCreateExpanded(Self))
  1521        //Caption Emboldened State
  1522        Set pbLabelEmboldened to (Private.pbLabelEmboldened(Self))
  1523        //Apply any mask we may have set
  1524        Send DoApplyMask
  1525        //Set Hidden/ReadOnly states
  1526        Set pbHidden to (Private.pbHidden(Self))
  1527        Set pbReadOnly to (Private.pbReadOnly(Self))
  1528        //Password
  1529        Set pbPassword_State to (Private.pbIsPassword(Self))
  1530        //Capslock
  1531        If (pbCapslock_State(Self)) Begin
  1532            Add ePGEditStyle_Uppercase to iEditStyle
  1533        End  
  1534        Set ComEditStyle to (iEditStyle + ePGEditStyle_AutoHScroll)
  1535        //Format   
  1536        If (peItemType(Self)=ePGItype_Double) Begin
  1537            If (psFormat(Self)<>"") Begin
  1538                Set psFormat to (Private.psFormat(Self)) 
  1539            End
  1540        End
  1541        //Data Entry Width
  1542        If (piForm_Margin(Self)<>0) Begin 
  1543            Set piForm_Margin to (Private.piFormMargin(Self)) 
  1544        End
  1545        Set piValueBackgroundColor to (Private.piValueBackgroundColor(Self))        
  1546        //Create any child objects of this object...
  1547        If (bRecursive) Begin
  1548            Broadcast Send Private.Create Self True
  1549        End        
  1550    End_Procedure
  1551    
  1552    //OnChange
  1553    //Called whenever an item's value is changed and user exists the item
  1554    {MethodType=Event}
  1555    Procedure OnChange
  1556    End_Procedure   
  1557    
  1558    //OnEditAfter
  1559    //Called whenever an item's value has been editted. Setting llCancel to True will stop the edit
  1560    Procedure OnEditAfter String ByRef llNewValue Boolean ByRef llCancel
  1561    End_Procedure
  1562    
  1563    //OnMoveItemDataIn
  1564    //Called from DoMoveDataIn (of the property grid). This is called from OnCreate and can be used to set item data (appy from database,say)
  1565    {MethodType=Event}
  1566    Procedure OnMoveItemDataIn
  1567    End_Procedure
  1568    
  1569    //OnMoveItemDataOut
  1570    //Called from DoMoveDataOut (of the property grid). This can be used to save item data to the database, say
  1571    {MethodType=Event}
  1572    Procedure OnMoveItemDataOut
  1573    End_Procedure  
  1574       
  1575End_Class
  1576
  1577{DocStart = Class}
  1578//---------------------------------------------------
  1579//
  1580// Class        : cSigCJPropertyGridSubCategory
  1581//
  1582// Superclass   : cSigCJPropertyGridItem 
  1583//
  1584// Package      : cSigCJPropertyGrid.pkg
  1585//
  1586// Mixins       : 
  1587//
  1588// Description  : Property Grid Item in style of Category. Used for Sub Categorising items with Categories
  1589//
  1590// Properties   : psLabel               (String)   
  1591//                psHelpText            (String)  
  1592//                psToolTip             (String)  
  1593//                pbCreateExpanded      (Boolean) 
  1594//                pbLabelEmboldened     (Boolean) 
  1595//
  1596// Events       : 
  1597//
  1598// Methods      :      
  1599//
  1600// Notes        :
  1601//
  1602// To Do        :           
  1603//               
  1604//---------------------------------------------------
  1605{DocEnd} 
  1606
  1607Class cSigCJPropertyGridSubCategory is a cSigCJPropertyGridItem
  1608
  1609    Procedure Construct_Object
  1610        Forward Send Construct_Object
  1611        
  1612        Set Private.peItemType to ePGItype_Category
  1613        Set Private.pbLabelEmboldened to True
  1614    End_Procedure
  1615End_Class
  1616
  1617{DocStart = Class}
  1618//---------------------------------------------------
  1619// Mixin Class  : cSigCJPropertyGridItemButton_Mixin
  1620//---------------------------------------------------
  1621{DocEnd} 
  1622
  1623Class cSigCJPropertyGridItemButton_Mixin is a Mixin
  1624    
  1625    Procedure Define_Item_Button_Properties
  1626        { DesignTime=False }
  1627        Property String  Private.psButtonCaption    "..."
  1628        { DesignTime=False }
  1629        Property Boolean Private.pbButtonEnabled    True
  1630        { DesignTime=False }
  1631        Property String  Private.psButtonImage
  1632        { DesignTime=False }
  1633        Property Integer Private.piButtonID
  1634        { DesignTime=False }
  1635        Property String  Private.psButtonToolTip
  1636        { DesignTime=False }
  1637        Property Integer Private.piButtonWidth      20
  1638        
  1639        { Visibility=Private }
  1640        Property Handle  Private.phoButtonObject    (Create(Self, U_cSigCjComPropertyGridInPlaceButton))              
  1641    End_Procedure
  1642    
  1643    Procedure Set_Item_Button_Properties
  1644        Set psButtonCaption   to (Private.psButtonCaption(Self))    
  1645        Set pbButtonEnabled   to (Private.pbButtonEnabled(Self))
  1646        Set psButtonImage     to (Private.psButtonImage(Self))
  1647        Set piButtonWidth     to (Private.piButtonWidth(Self))
  1648        Set psButtonTooltip   to (Private.psButtonTooltip(Self))         
  1649    End_Procedure
  1650
  1651    { MethodType=Property Category="CodeJock"}
  1652    { InitialValue="..." }
  1653    Procedure Set psButtonCaption String sCaption
  1654        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1655            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1656                Set ComCaption of (Private.phoButtonObject(Self)) to sCaption
  1657            End
  1658        End
  1659        Set Private.psButtonCaption to sCaption
  1660    End_Procedure
  1661
  1662    { MethodType=Property Category="CodeJock"}
  1663    Function psButtonCaption Returns String
  1664        Function_Return (Private.psButtonCaption(Self))
  1665    End_Function
  1666
  1667    { MethodType=Property Category="CodeJock"}
  1668    { InitialValue=True }
  1669    Procedure Set pbButtonEnabled Boolean bEnabled
  1670        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1671            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1672                Set ComEnabled of (Private.phoButtonObject(Self)) to bEnabled
  1673            End
  1674        End
  1675        Set Private.pbButtonEnabled to bEnabled
  1676    End_Procedure
  1677
  1678    { MethodType=Property Category="CodeJock"}
  1679    Function pbButtonEnabled Returns Boolean
  1680        Function_Return (Private.pbButtonEnabled(Self))
  1681    End_Function
  1682    
  1683    { MethodType=Property Category="CodeJock"}
  1684    Procedure Set psButtonTooltip String sTooltip
  1685        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1686            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1687                Set ComToolTip of (Private.phoButtonObject(Self)) to sTooltip
  1688            End
  1689        End
  1690        Set Private.psButtonTooltip to sTooltip
  1691    End_Procedure
  1692
  1693    { MethodType=Property Category="CodeJock"}
  1694    Function psButtonTooltip Returns String
  1695        Function_Return (Private.psButtonTooltip(Self))
  1696    End_Function    
  1697    
  1698    { MethodType=Property Category="CodeJock"}
  1699    Procedure Set psButtonImage String sImage
  1700        Integer iIndex
  1701        
  1702        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1703            Get AddImage of ghoSigCjGlobalSetting sImage 0 0 to iIndex //Won't add it again if already uploaded once
  1704            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1705                Set ComIconIndex of (Private.phoButtonObject(Self)) to iIndex
  1706            End
  1707        End
  1708        Set Private.psButtonImage to sImage
  1709    End_Procedure
  1710
  1711    { MethodType=Property Category="CodeJock"}
  1712    Function psButtonImage Returns String
  1713        Function_Return (Private.psButtonImage(Self))
  1714    End_Function         
  1715
  1716    { MethodType=Property Category="CodeJock"}
  1717    Procedure Set piButtonID Integer iID
  1718        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1719            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1720                Set ComId of (Private.phoButtonObject(Self)) to iID
  1721            End
  1722        End
  1723        Set Private.piButtonID to iID
  1724    End_Procedure
  1725
  1726    { MethodType=Property Category="CodeJock"}
  1727    Function piButtonID Returns Integer
  1728        Function_Return (Private.piButtonID(Self))
  1729    End_Function     
  1730    
  1731    { MethodType=Property Category="CodeJock"}
  1732    Procedure Set piButtonWidth Integer iWidth
  1733        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1734            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1735                Set ComWidth of (Private.phoButtonObject(Self)) to iWidth
  1736            End
  1737        End
  1738        Set Private.piButtonWidth to iWidth
  1739    End_Procedure
  1740
  1741    { MethodType=Property Category="CodeJock"}
  1742    Function piButtonWidth Returns Integer
  1743        Function_Return (Private.piButtonWidth(Self))
  1744    End_Function      
  1745
  1746    {DocStart = Method}
  1747    //---------------------------------------------------
  1748    //
  1749    // Function     : piButtonIndex
  1750    //
  1751    // Scope        : Read Only 
  1752    //
  1753    // Paramaters   : None
  1754    //
  1755    // Returns      : Integer
  1756    //
  1757    // Purpose      : Retrieves index of button in array of item's buttons
  1758    //                
  1759    // Notes        : 
  1760    //               
  1761    //---------------------------------------------------
  1762    {DocEnd} 
  1763    
  1764    Function piButtonIndex Returns Integer
  1765        Integer iIndex
  1766        Move -1 to iIndex
  1767        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1768            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1769                Get ComIndex of (Private.phoButtonObject(Self)) to iIndex
  1770            End
  1771        End
  1772        Function_Return iIndex
  1773    End_Function
  1774
  1775    {DocStart = Method}
  1776    //---------------------------------------------------
  1777    //
  1778    // Function     : pvItem
  1779    //
  1780    // Scope        : Read Only 
  1781    //
  1782    // Paramaters   : None
  1783    //
  1784    // Returns      : Variant (IdDispatch)
  1785    //
  1786    // Purpose      : Retrieves the parent property grid item for this button (item that this button is drawn in).
  1787    //                
  1788    // Notes        : 
  1789    //               
  1790    //---------------------------------------------------
  1791    {DocEnd} 
  1792        
  1793    Function pvItem Returns Variant
  1794        Variant vItem
  1795        
  1796        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  1797            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  1798                Get ComItem of (Private.phoButtonObject(Self)) to vItem
  1799            End
  1800        End
  1801        Function_Return vItem
  1802    End_Function
  1803    
  1804    {MethodType=Event}
  1805    //Fired when ever a combo is dropped down or expand button clicked
  1806    Procedure OnClick
  1807    End_Procedure    
  1808    
  1809End_Class
  1810
  1811{DocStart = Class}
  1812//---------------------------------------------------
  1813//
  1814// Class        : cSigCJPropertyGridExpandBtnItem
  1815//
  1816// Superclass   : cSigCJPropertyGridItem 
  1817//
  1818// Package      : cSigCJPropertyGrid.pkg
  1819//
  1820// Mixins       : cSigCJPropertyGridItemButton_Mixin
  1821//
  1822// Description  : Property Grid Item with Expand (lookup) button '...'
  1823//
  1824// Properties   : psLabel                 (String)               
  1825//                psHelpText              (String)               
  1826//                psToolTip               (String)               
  1827//                pbCreateExpanded        (Boolean)              
  1828//                pbLabelEmboldened       (Boolean)              
  1829//                peItemType              (Integer)              
  1830//                pvValue                 (Variant)              
  1831//                pbDefaultAsInitialValue (Boolean)              
  1832//                pvDefaultValue          (Variant)              
  1833//                pvInitialValue          (Variant)              
  1834//                pvTag                   (Variant)              
  1835//                pbHidden                (Boolean)              
  1836//                pbReadOnly              (Boolean)              
  1837//                pbPassword_State        (Boolean)              
  1838//                pbCapslock_State        (Boolean)              
  1839//                piForm_Margin           (Integer)              
  1840//                piValueBackgroundColor  (Integer)              
  1841//                psButtonCaption         (String) 
  1842//                pbButtonEnabled         (Boolean)  
  1843//                psButtonImage           (String)  
  1844//                piButtonWidth           (Integer)  
  1845//                psButtonTooltip         (String) 
  1846//
  1847// Events       : OnClick
  1848//                OnChange         
  1849//                OnEditAfter      
  1850//                OnMoveItemDataIn 
  1851//                OnMoveItemDataOut
  1852//
  1853// Methods      : Procedure Set PropertyItemMask (String llMask String llLiteral Variant llPrompt)         
  1854//
  1855// Notes        :
  1856//
  1857// To Do        :           
  1858//               
  1859//---------------------------------------------------
  1860{DocEnd} 
  1861
  1862Class cSigCJPropertyGridExpandBtnItem is a cSigCJPropertyGridItem
  1863    Import_Class_Protocol cSigCJPropertyGridItemButton_Mixin
  1864
  1865    Procedure Construct_Object
  1866        Forward Send Construct_Object
  1867    
  1868        Send Define_Item_Button_Properties
  1869    End_Procedure
  1870
  1871    { MethodType=Method Visibility=Private }
  1872    Procedure Private.Create Handle hoParent Boolean bRecursive
  1873        Variant vButton
  1874        
  1875        If (hoParent=0) Begin
  1876            Procedure_Return
  1877        End
  1878               
  1879        Forward Send Private.Create hoParent bRecursive
  1880        Get ComAddInplaceButton ePGIBS_Expand to vButton
  1881        Set pvComObject of (Private.phoButtonObject(Self)) to vButton  
  1882        Send Set_Item_Button_Properties
  1883    End_Procedure
  1884    
  1885End_Class
  1886
  1887{DocStart = Class}
  1888//---------------------------------------------------
  1889//
  1890// Class        : cSigCJPropertyGridComboFormItem
  1891//
  1892// Superclass   : cSigCJPropertyGridItem 
  1893//
  1894// Package      : cSigCJPropertyGrid.pkg
  1895//
  1896// Mixins       : cSigCJPropertyGridItemButton_Mixin
  1897//
  1898// Description  : Property Grid Item with Drop Down ComboForm
  1899//
  1900// Properties   : psLabel                 (String)               
  1901//                psHelpText              (String)               
  1902//                psToolTip               (String)               
  1903//                pbCreateExpanded        (Boolean)              
  1904//                pbLabelEmboldened       (Boolean)              
  1905//                peItemType              (Integer)              
  1906//                pvValue                 (Variant)              
  1907//                pbDefaultAsInitialValue (Boolean)              
  1908//                pvDefaultValue          (Variant)              
  1909//                pvInitialValue          (Variant)              
  1910//                pvTag                   (Variant)              
  1911//                pbHidden                (Boolean)              
  1912//                pbReadOnly              (Boolean)              
  1913//                pbPassword_State        (Boolean)              
  1914//                pbCapslock_State        (Boolean)              
  1915//                piForm_Margin           (Integer)              
  1916//                piValueBackgroundColor  (Integer)              
  1917//                psButtonCaption         (String) 
  1918//                pbButtonEnabled         (Boolean)  
  1919//                psButtonImage           (String)  
  1920//                piButtonWidth           (Integer)  
  1921//                psButtonTooltip         (String) 
  1922//
  1923// Events       : OnClick
  1924//                OnChange         
  1925//                OnEditAfter      
  1926//                OnMoveItemDataIn 
  1927//                OnMoveItemDataOut
  1928//                OnAddLookupItems
  1929//
  1930// Methods      : Procedure Set PropertyItemMask     (String llMask String llLiteral Variant llPrompt)  
  1931//                Procedure Set LookupItemImage      (Integer iItemIndex String sImage)
  1932//                Procedure Set LookupItemData       (Integer iItemIndex Integer iItemData)
  1933//                Procedure AddLookupItem            (String sDescription Integer iItemData String sImage Variant vCode)
  1934//                Function  CodeFromDescription      (String sDescription Boolean ByRef bFound Returns Variant)
  1935//                Function  ItemDataFromDescription  (String sDescription Boolean ByRef bFound Returns Integer)
  1936//                Function  DescriptionFromCode      (Variant vCode Boolean ByRef bFound Returns String)
  1937//                Procedure ComboDeleteItems        
  1938//
  1939// Notes        :
  1940//
  1941// To Do        :           
  1942//               
  1943//---------------------------------------------------
  1944{DocEnd} 
  1945
  1946Class cSigCJPropertyGridComboFormItem is a cSigCJPropertyGridItem
  1947    Import_Class_Protocol cSigCJPropertyGridItemButton_Mixin
  1948    
  1949    Procedure Construct_Object
  1950        Forward Send Construct_Object
  1951    
  1952        Send Define_Item_Button_Properties
  1953        { DesignTime=False }
  1954        Property tdGridItemSelectionValue[] ptaGridItemSelectionValue  
  1955    End_Procedure
  1956    
  1957    Procedure End_Construct_Object
  1958        Send OnAddLookupItems
  1959        Forward Send End_Construct_Object
  1960    End_Procedure
  1961    
  1962    {DocStart = Method}
  1963    //---------------------------------------------------
  1964    //
  1965    // Procedure    : OnAddLookupItems
  1966    //
  1967    // Scope        : Public Event 
  1968    //
  1969    // Paramaters   : None
  1970    //
  1971    // Returns      : None
  1972    //
  1973    // Purpose      : Intended that you would call "Send AddLookupItem" from this event to populate the combo 
  1974    //                
  1975    // Notes        : If the item is bound to a data field that has a Field_Table_Object the combo will automatically 
  1976    //                be populated. If you want to add images you should forward Send OnAddLookupItems and then add the images
  1977    //               
  1978    //---------------------------------------------------
  1979    {DocEnd} 
  1980        
  1981    { MethodType=Event Visibility=Public }
  1982    Procedure OnAddLookupItems
  1983    End_Procedure
  1984
  1985    {DocStart = Method}
  1986    //---------------------------------------------------
  1987    //
  1988    // Procedure    : ComboDeleteItems
  1989    //
  1990    // Scope        : Public Method 
  1991    //
  1992    // Paramaters   : None
  1993    //
  1994    // Returns      : None
  1995    //
  1996    // Purpose      : Can be used to clear all of a comboforms data items
  1997    //                
  1998    // Notes        : 
  1999    //               
  2000    //---------------------------------------------------
  2001    {DocEnd}     
  2002    
  2003    Procedure ComboDeleteItems
  2004        Handle hoConstraint_s
  2005        Variant vConstraint_s
  2006        tdGridItemSelectionValue[] taGridItemSelectionValues
  2007
  2008        Get ComConstraints to vConstraint_s
  2009        Get Create U_cSigCjComPropertyGridItemConstraints to hoConstraint_s
  2010        Set pvComObject of hoConstraint_s to vConstraint_s
  2011        Send ComClear of hoConstraint_s  
  2012        Send Destroy of hoConstraint_s
  2013        //clear our internal array also
  2014        Set ptaGridItemSelectionValue to taGridItemSelectionValues     
  2015    End_Procedure
  2016    
  2017    {DocStart = Method}
  2018    //---------------------------------------------------
  2019    //
  2020    // Procedure    : DoAddLookupItems
  2021    //
  2022    // Scope        : Private 
  2023    //
  2024    // Paramaters   : None
  2025    //
  2026    // Returns      : None
  2027    //
  2028    // Purpose      : Called from Private.Create. Adds any lookup items to the list of constraints 
  2029    //                
  2030    // Notes        : Called internally. Developer does not need to concern themself with this
  2031    //               
  2032    //---------------------------------------------------
  2033    {DocEnd} 
  2034        
  2035    { MethodType=Method Visibility=Private }
  2036    Procedure DoAddLookupItems
  2037        Handle hoConstraint_s hoConstraint
  2038        Variant vConstraint_s vConstraint
  2039        Integer iItems iItemIndex
  2040        tdGridItemSelectionValue[] taGridItemSelectionValues
  2041        
  2042        If (not(IsNullComObject(pvComObject(Self)))) Begin
  2043            Get ptaGridItemSelectionValue to taGridItemSelectionValues
  2044            Move (SizeOfArray(taGridItemSelectionValues)) to iItems
  2045            Get ComConstraints to vConstraint_s
  2046            Get Create U_cSigCjComPropertyGridItemConstraints to hoConstraint_s
  2047            Set pvComObject of hoConstraint_s to vConstraint_s
  2048            Send ComClear of hoConstraint_s
  2049            Get Create U_cSigCjComPropertyGridItemConstraint to hoConstraint
  2050            For iItemIndex from 1 to iItems
  2051                Send ComAdd of hoConstraint_s taGridItemSelectionValues[iItemIndex-1].sDescription taGridItemSelectionValues[iItemIndex-1].iItemData
  2052                //now associate any iconindex
  2053                Get ComItem of hoConstraint_s iItemIndex to vConstraint
  2054                Set pvComObject of hoConstraint to vConstraint 
  2055                Set ComIconIndex of hoConstraint to taGridItemSelectionValues[iItemIndex-1].iIconIndex
  2056            Loop            
  2057            Send destroy of hoConstraint  
  2058            Send Destroy of hoConstraint_s
  2059        End
  2060    End_Procedure
  2061
  2062    {DocStart = Method}
  2063    //---------------------------------------------------
  2064    //
  2065    // Procedure    : AddLookupItem
  2066    //
  2067    // Scope        : Public 
  2068    //
  2069    // Paramaters   : sCaption, iData, sImage, vCode
  2070    //
  2071    // Returns      : None
  2072    //
  2073    // Purpose      : 'Registers' an item for inclusion in list of item constraints (lookup values) 
  2074    //                
  2075    // Notes        : vCode is added because it could be that the developer wants to display a descriptive value
  2076    //                whilst mapping to a code value in the background (the code being the value that ultimately
  2077    //                will be saved to the database)
  2078    //               
  2079    //---------------------------------------------------
  2080    {DocEnd} 
  2081        
  2082    { MethodType=Method Visibility=Public }
  2083    Procedure AddLookupItem String sDescription Integer iItemData String sImage Variant vCode
  2084        tdGridItemSelectionValue[] taGridItemSelectionValue
  2085        Integer iItems iIconIndex 
  2086        
  2087        Get AddImage of ghoSigCjGlobalSetting sImage 0 0 to iIconIndex //won't re-add it if already added
  2088        Get ptaGridItemSelectionValue to taGridItemSelectionValue
  2089        Move (SizeOfArray(taGridItemSelectionValue)) to iItems
  2090        Move sDescription to taGridItemSelectionValue[iItems].sDescription
  2091        Move iItemData to taGridItemSelectionValue[iItems].iItemData
  2092        Move iIconIndex to taGridItemSelectionValue[iItems].iIconIndex
  2093        Move vCode to taGridItemSelectionValue[iItems].vCode
  2094        Set ptaGridItemSelectionValue to taGridItemSelectionValue                    
  2095    End_Procedure
  2096
  2097    {DocStart = Method}
  2098    //---------------------------------------------------
  2099    //
  2100    // Procedure    : Set LookupItemImage
  2101    //
  2102    // Scope        : Public 
  2103    //
  2104    // Paramaters   : Integer iItemIndex String sImage
  2105    //
  2106    // Returns      : None
  2107    //
  2108    // Purpose      : Sets icon index for specified lookup item. 
  2109    //                
  2110    // Notes        : MUST be called AFTER AddLookupItem
  2111    //               
  2112    //---------------------------------------------------
  2113    {DocEnd} 
  2114        
  2115    Procedure Set LookupItemImage Integer iItemIndex String sImage
  2116        tdGridItemSelectionValue[] taGridItemSelectionValue
  2117        Integer iImageIndex
  2118        
  2119        Get AddImage of ghoSigCjGlobalSetting sImage 0 0 to iImageIndex
  2120        Get ptaGridItemSelectionValue to taGridItemSelectionValue
  2121        Move iImageIndex to taGridItemSelectionValue[iItemIndex-1].iIconIndex
  2122        Set ptaGridItemSelectionValue to taGridItemSelectionValue
  2123    End_Procedure
  2124
  2125    {DocStart = Method}
  2126    //---------------------------------------------------
  2127    //
  2128    // Procedure    : Set LookupItemData
  2129    //
  2130    // Scope        : Public 
  2131    //
  2132    // Paramaters   : Integer iItemIndex Integer iItemData
  2133    //
  2134    // Returns      : None
  2135    //
  2136    // Purpose      : Sets item data for specified lookup item. 
  2137    //                
  2138    // Notes        : MUST be called AFTER AddLookupItem
  2139    //               
  2140    //---------------------------------------------------
  2141    {DocEnd} 
  2142    
  2143    Procedure Set LookupItemData Integer iItemIndex Integer iItemData
  2144        tdGridItemSelectionValue[] taGridItemSelectionValue
  2145        
  2146        Get ptaGridItemSelectionValue to taGridItemSelectionValue
  2147        Move iItemData to taGridItemSelectionValue[iItemIndex-1].iItemData
  2148        Set ptaGridItemSelectionValue to taGridItemSelectionValue
  2149    End_Procedure    
  2150    
  2151
  2152    {DocStart = Method}
  2153    //---------------------------------------------------
  2154    //
  2155    // Function     : ConstraintDescriptionComparison
  2156    //
  2157    // Scope        : Private 
  2158    //
  2159    // Paramaters   : tdGridItemSelectionValue x2 (for comparison)
  2160    //
  2161    // Returns      : Integer
  2162    //
  2163    // Purpose      : To compare the Description elements of 2 structs. 
  2164    //                
  2165    // Notes        : Used internally from CodeFromDescription and ItemDataFromDescription
  2166    //               
  2167    //---------------------------------------------------
  2168    {DocEnd} 
  2169        
  2170    { MethodType=Method Visibility=Private }
  2171    Function ConstraintDescriptionComparison tdGridItemSelectionValue tDesc1 tdGridItemSelectionValue tDesc2 Returns Integer
  2172        Integer iRetVal
  2173        If (tDesc1.sDescription = tDesc2.sDescription) Begin
  2174            Move (EQ) to iRetVal
  2175        End  
  2176        Function_Return iRetVal
  2177    End_Function
  2178
  2179    {DocStart = Method}
  2180    //---------------------------------------------------
  2181    //
  2182    // Function     : CodeFromDescription
  2183    //
  2184    // Scope        : Public 
  2185    //
  2186    // Paramaters   : sDescription, bFound (byref)
  2187    //
  2188    // Returns      : Variant (vCode)
  2189    //
  2190    // Purpose      : If you have the current value of an property item and you know this is one of a list of constraints
  2191    //                you can call this function to return the 'Code' value that is associated with this 'Description' value 
  2192    //                
  2193    // Notes        : bFound is passed by reference and tells the developer if the value that they were looking for was found or not.
  2194    //                You can't rely on a return value of 0 (or blank) as an indication of whether it was found because these may be valid values  
  2195    //               
  2196    //---------------------------------------------------
  2197    {DocEnd} 
  2198        
  2199    { MethodType=Method Visibility=Public }
  2200    Function CodeFromDescription String sDescription Boolean ByRef bFound Returns Variant
  2201        Integer iSearchIndex
  2202        Variant vRetVal
  2203        tdGridItemSelectionValue[] taGridItemSelectionValues
  2204        tdGridItemSelectionValue tGridItemSelectionValue
  2205        
  2206        Move False to bFound
  2207        Get ptaGridItemSelectionValue to taGridItemSelectionValues
  2208        Move sDescription to tGridItemSelectionValue.sDescription
  2209        Move (SearchArray(tGridItemSelectionValue,taGridItemSelectionValues,Self,get_ConstraintDescriptionComparison)) to iSearchIndex
  2210        If (iSearchIndex <> -1) Begin
  2211            Move taGridItemSelectionValues[iSearchIndex].vCode to vRetVal
  2212            Move True to bFound
  2213        End
  2214        Function_Return vRetVal 
  2215    End_Function
  2216
  2217    {DocStart = Method}
  2218    //---------------------------------------------------
  2219    //
  2220    // Function     : ItemDataFromDescription
  2221    //
  2222    // Scope        : Public 
  2223    //
  2224    // Paramaters   : sDescription, bFound (byref)
  2225    //
  2226    // Returns      : Integer (iItemData)
  2227    //
  2228    // Purpose      : If you have the current value of an property item and you know this is one of a list of constraints
  2229    //                you can call this function to return the iItemData value that is associated with this 'Description' value 
  2230    //                
  2231    // Notes        : bFound is passed by reference and tells the developer if the value that they were looking for was found or not.
  2232    //                You can't rely on a return value of 0 (or blank) as an indication of whether it was found because these may be valid values  
  2233    //               
  2234    //---------------------------------------------------
  2235    {DocEnd} 
  2236        
  2237    { MethodType=Method Visibility=Public }
  2238    Function ItemDataFromDescription String sDescription Boolean ByRef bFound Returns Integer
  2239        Integer iRetVal iSearchIndex 
  2240        tdGridItemSelectionValue[] taGridItemSelectionValues
  2241        tdGridItemSelectionValue tGridItemSelectionValue
  2242        
  2243        Move False to bFound
  2244        Get ptaGridItemSelectionValue to taGridItemSelectionValues
  2245        Move sDescription to tGridItemSelectionValue.sDescription
  2246        Move (SearchArray(tGridItemSelectionValue,taGridItemSelectionValues,Self,get_ConstraintDescriptionComparison)) to iSearchIndex
  2247        If (iSearchIndex <> -1) Begin
  2248            Move taGridItemSelectionValues[iSearchIndex].iItemData to iRetVal
  2249            Move True to bFound 
  2250        End
  2251        Function_Return iRetVal 
  2252    End_Function
  2253
  2254    {DocStart = Method}
  2255    //---------------------------------------------------
  2256    //
  2257    // Function     : ConstraintCodeComparison
  2258    //
  2259    // Scope        : Private 
  2260    //
  2261    // Paramaters   : tdGridItemSelectionValue x2 (for comparison)
  2262    //
  2263    // Returns      : Integer
  2264    //
  2265    // Purpose      : To compare the Code elements of 2 structs. 
  2266    //                
  2267    // Notes        : Used internally from DescriptionFromCode
  2268    //               
  2269    //---------------------------------------------------
  2270    {DocEnd} 
  2271        
  2272    { MethodType=Method Visibility=Private }
  2273    Function ConstraintCodeComparison tdGridItemSelectionValue tCode1 tdGridItemSelectionValue tCode2 Returns Integer
  2274        Integer iRetVal
  2275        If (tCode1.vCode = tCode2.vCode) Begin
  2276            Move (EQ) to iRetVal
  2277        End  
  2278        Function_Return iRetVal
  2279    End_Function
  2280
  2281    {DocStart = Method}
  2282    //---------------------------------------------------
  2283    //
  2284    // Function     : DescriptionFromCode
  2285    //
  2286    // Scope        : Public 
  2287    //
  2288    // Paramaters   : vCode, bFound (byref)
  2289    //
  2290    // Returns      : sDescription
  2291    //
  2292    // Purpose      : If a property grid item has a combo form with descriptions and associated code values then you can call this
  2293    //                function to determine the description value for a specified code. This is most useful when populating the grid
  2294    //                from a database where the raw data is a code value but you wish to show a descriptive value in the control (think dbcomforms)
  2295    //                
  2296    // Notes        : bFound is passed by reference and tells the developer if the value that they were looking for was found or not.
  2297    //                You can't rely on a return value of 0 (or blank) as an indication of whether it was found because these may be valid values  
  2298    //               
  2299    //---------------------------------------------------
  2300    {DocEnd} 
  2301        
  2302    { MethodType=Method Visibility=Public }
  2303    Function DescriptionFromCode Variant vCode Boolean ByRef bFound Returns String
  2304        String  sRetVal
  2305        Integer iSearchIndex 
  2306        tdGridItemSelectionValue[] taGridItemSelectionValues
  2307        tdGridItemSelectionValue tGridItemSelectionValue
  2308        
  2309        Move False to bFound
  2310        Get ptaGridItemSelectionValue to taGridItemSelectionValues
  2311        Move vCode to tGridItemSelectionValue.vCode
  2312        Move (SearchArray(tGridItemSelectionValue,taGridItemSelectionValues,Self,get_ConstraintCodeComparison)) to iSearchIndex
  2313        If (iSearchIndex <> -1) Begin
  2314            Move taGridItemSelectionValues[iSearchIndex].sDescription to sRetVal
  2315            Move True to bFound 
  2316        End
  2317        Function_Return sRetVal 
  2318    End_Function
  2319
  2320    {DocStart = Method}
  2321    //---------------------------------------------------
  2322    //
  2323    // Function     : BindToDataBase
  2324    //
  2325    // Scope        : Public 
  2326    //
  2327    // Paramaters   : Integer hFile Integer iField
  2328    //
  2329    // Returns      : None
  2330    //
  2331    // Purpose      : Forward Send, but then because this is a combo item, see if there is a validation table for this field
  2332    //                If so, set the lookup items with the values from the validation table                
  2333    //
  2334    // Notes        : Set pbCapslock_State to False if there is a codevalidation table. It may be a capslock field, but this will
  2335    //                be for the code, not the description (that we will be displaying)
  2336    //               
  2337    //---------------------------------------------------
  2338    {DocEnd} 
  2339    
  2340    Procedure BindToDataBase Integer hFile Integer iField
  2341        Variant[][] vTableData
  2342        Integer iTableObject iItem
  2343        Handle hoDD
  2344        
  2345        Forward Send BindToDataBase hFile iField
  2346        Get Item_Server to hoDD
  2347        If (hoDD <> 0) Begin
  2348            Get Field_Table_Object of hoDD iField to iTableObject
  2349            If (iTableObject <> 0) Begin
  2350                Get TableData of iTableObject to vTableData
  2351                For iItem from 0 to (SizeOfArray(vTableData)-1)
  2352                    Send AddLookupItem vTableData[iItem][1] (iItem+1) '' vTableData[iItem][0]
  2353                Loop
  2354                //Finally, it may be that the field is capslock, but that this is for the code NOT the description...
  2355                Set pbCapslock_State to False
  2356            End
  2357        End
  2358    End_Procedure
  2359
  2360    {DocStart = Method}
  2361    //---------------------------------------------------
  2362    //
  2363    // Function     : ReadItemFromDatabase
  2364    //
  2365    // Scope        : Public 
  2366    //
  2367    // Paramaters   : None
  2368    //
  2369    // Returns      : None
  2370    //
  2371    // Purpose      : Forward Send, but then because this is a combo item, see if we have a description that matches our value
  2372    //                If so, display this instead               
  2373    //               
  2374    //---------------------------------------------------
  2375    {DocEnd} 
  2376    
  2377    { MethodType = Method Visibility=Public }
  2378    Procedure ReadItemFromDatabase
  2379        Handle  hoDD
  2380        Integer iField 
  2381        Variant vValue
  2382        Boolean bFound
  2383        String  sDescription
  2384        
  2385        Forward Send ReadItemFromDatabase
  2386        Get Item_Server to hoDD
  2387        Get Item_Data_Field to iField
  2388        If ((hoDD <> 0) and (iField <> 0)) Begin
  2389            Get pvValue to vValue
  2390            Get DescriptionFromCode vValue (&bFound) to sDescription 
  2391            If (bFound) Begin
  2392                Set pvInitialValue to sDescription   
  2393            End
  2394        End
  2395    End_Procedure 
  2396    
  2397    { MethodType = Method Visibility=Public }
  2398    Procedure MoveItemDataToDatabase 
  2399        Handle  hoDD
  2400        Integer iField
  2401        Variant vValue vCode
  2402        Boolean bFound
  2403        
  2404        Get Item_Server to hoDD
  2405        Get Item_Data_Field to iField
  2406        If ((hoDD <> 0) and (iField <> 0)) Begin
  2407            Get pvValue to vValue
  2408            Get CodeFromDescription vValue (&bFound) to vCode
  2409            If (bFound) Begin
  2410                Move vCode to vValue
  2411            End
  2412            Set Field_changed_Value of hoDD iField to vValue
  2413        End
  2414    End_Procedure
  2415    
  2416    { MethodType=Method Visibility=Private }
  2417    Procedure Private.Create Handle hoParent Boolean bRecursive
  2418        Variant vButton
  2419        Handle  hoButtons
  2420        
  2421        If (hoParent=0) Begin
  2422            Procedure_Return
  2423        End
  2424               
  2425        Forward Send Private.Create hoParent bRecursive
  2426        //If this is of peItemType ePGItype_Enum then we do not need to add a button - it will be added automatically
  2427        If (peItemType(Self) = ePGItype_Enum) Begin
  2428            Get Create U_cSigCjComPropertyGridInPlaceButtons to hoButtons
  2429            Set pvComObject of hoButtons to (ComInplaceButtons(Self))
  2430            Get ComItem of hoButtons 1 to vButton
  2431            Send Destroy of hoButtons
  2432        End
  2433        Else Begin
  2434            Get ComAddInplaceButton ePGIBS_Combo to vButton    
  2435        End        
  2436        Set pvComObject of (Private.phoButtonObject(Self)) to vButton  
  2437        Send DoAddLookupItems
  2438        Send Set_Item_Button_Properties
  2439    End_Procedure
  2440    
  2441End_Class
  2442
  2443{DocStart = Class}
  2444//---------------------------------------------------
  2445// Mixin Class  : cSigCJPropertyGridItemSpinAndSlider_Mixin
  2446//---------------------------------------------------
  2447{DocEnd} 
  2448
  2449Class cSigCJPropertyGridItemSpinAndSlider_Mixin is a Mixin
  2450    
  2451    Procedure Define_SpinForm_and_Slider_Properties
  2452        { DesignTime=False }
  2453        Property Integer Private.piMax      100 
  2454        { DesignTime=False }
  2455        Property Integer Private.piMin        1
  2456        { DesignTime=False }
  2457        Property Integer Private.piWidth     20   
  2458    End_Procedure
  2459
  2460    { MethodType=Property Category="CodeJock"}
  2461    { InitialValue=100 }    
  2462    Procedure Set piMaximum Integer iMax                      
  2463        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  2464            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  2465                Set ComMax of (Private.phoButtonObject(Self)) to iMax
  2466            End
  2467        End
  2468        Set Private.piMax to iMax
  2469    End_Procedure
  2470
  2471    { MethodType=Property Category="CodeJock"}
  2472    Function piMaximum Returns Integer
  2473        Function_Return (Private.piMax(Self))
  2474    End_Function
  2475        
  2476    { MethodType=Property Category="CodeJock"}
  2477    { InitialValue=1 }    
  2478    Procedure Set piMinimum Integer iMin                     
  2479        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  2480            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  2481                Set ComMin of (Private.phoButtonObject(Self)) to iMin
  2482            End
  2483        End
  2484        Set Private.piMin to iMin
  2485    End_Procedure
  2486    
  2487    { MethodType=Property Category="CodeJock"}
  2488    Function piMinimum Returns Integer
  2489        Function_Return (Private.piMin(Self))
  2490    End_Function
  2491    
  2492    { MethodType=Property Category="CodeJock"}  
  2493    Procedure Set piWidth Integer iWidth 
  2494        If (not(IsNullComObject(pvComObject(Self)))) Begin 
  2495            If (not(IsNullComObject(pvComObject(Private.phoButtonObject(Self))))) Begin
  2496                Set ComWidth of (Private.phoButtonObject(Self)) to iWidth
  2497            End
  2498        End
  2499        Set Private.piWidth to iWidth
  2500    End_Procedure
  2501    
  2502    { MethodType=Property Category="CodeJock"}
  2503    Function piWidth Returns Integer
  2504        Function_Return (Private.piWidth(Self))
  2505    End_Function    
  2506    
  2507    Procedure ApplySettings
  2508        Set piMinimum to (Private.piMin(Self))
  2509        Set piMaximum to (Private.piMax(Self))
  2510        Set piWidth   to (Private.piWidth(Self))
  2511    End_Procedure
  2512    
  2513End_Class
  2514
  2515{ OverrideProperty=pbCapslock_State          DesignTime=False }
  2516{ OverrideProperty=pbPassword_State          DesignTime=False }
  2517{ OverrideProperty=peItemType                DesignTime=False }
  2518{DocStart = Class}
  2519//---------------------------------------------------
  2520//
  2521// Class        : cSigCJPropertyGridSpinFormItem
  2522//
  2523// Superclass   : cSigCJPropertyGridItem 
  2524//
  2525// Package      : cSigCJPropertyGrid.pkg
  2526//
  2527// Mixins       : cSigCJPropertyGridItemSpinAndSlider_Mixin
  2528//
  2529// Description  : Property Grid Item with built in SpinForm Object
  2530//
  2531// Properties   : psLabel                 (String) 
  2532//                psHelpText              (String) 
  2533//                psToolTip               (String) 
  2534//                pbCreateExpanded        (Boolean)
  2535//                pbLabelEmboldened       (Boolean)
  2536//                peItemType              (Integer)
  2537//                pvValue                 (Variant)
  2538//                pbDefaultAsInitialValue (Boolean)
  2539//                pvDefaultValue          (Variant)
  2540//                pvInitialValue          (Variant)
  2541//                pvTag                   (Variant)
  2542//                pbHidden                (Boolean)
  2543//                pbReadOnly              (Boolean)
  2544//                pbPassword_State        (Boolean)
  2545//                pbCapslock_State        (Boolean)
  2546//                piForm_Margin           (Integer)
  2547//                piValueBackgroundColor  (Integer)
  2548//                piMin                   (Integer)
  2549//                piMax                   (Integer)
  2550//                piWidth                 (Integer)
  2551//
  2552// Events       : OnChange          
  2553//                OnEditAfter      
  2554//                OnMoveItemDataIn 
  2555//                OnMoveItemDataOut
  2556//
  2557// Methods      : Procedure Set PropertyItemMask (String llMask String llLiteral Variant llPrompt)  
  2558//
  2559// Notes        :
  2560//
  2561// To Do        :           
  2562//               
  2563//---------------------------------------------------
  2564{DocEnd}  
  2565Class cSigCJPropertyGridSpinFormItem is a cSigCJPropertyGridItem
  2566    Import_Class_Protocol cSigCJPropertyGridItemSpinAndSlider_Mixin
  2567    
  2568    Procedure Construct_Object
  2569        Forward Send Construct_Object
  2570        { Visibility=Private }
  2571        Property Handle Private.phoButtonObject     (Create(Self, U_cSigCjComPropertyGridInPlaceSpinButton))
  2572        
  2573        Send Define_SpinForm_and_Slider_Properties 
  2574    End_Procedure
  2575    
  2576    { MethodType=Method Visibility=Private }
  2577    Procedure Private.Create Handle hoParent Boolean bRecursive
  2578        Variant vButton
  2579        
  2580        Forward Send Private.Create hoParent bRecursive
  2581        Get ComAddSpinButton to vButton
  2582        Set pvComObject of (Private.phoButtonObject(Self)) to vButton
  2583        Send ApplySettings
  2584    End_Procedure    
  2585End_Class
  2586
  2587{ OverrideProperty=pbCapslock_State          DesignTime=False }
  2588{ OverrideProperty=pbPassword_State          DesignTime=False }
  2589{ OverrideProperty=peItemType                DesignTime=False }
  2590{DocStart = Class}
  2591//---------------------------------------------------
  2592//
  2593// Class        : cSigCJPropertyGridSliderCtlItem
  2594//
  2595// Superclass   : cSigCJPropertyGridItem 
  2596//
  2597// Package      : cSigCJPropertyGrid.pkg
  2598//
  2599// Mixins       : cSigCJPropertyGridItemSpinAndSlider_Mixin
  2600//
  2601// Description  : Property Grid Item with built in Slider Control
  2602//
  2603// Properties   : psLabel                 (String) 
  2604//                psHelpText              (String) 
  2605//                psToolTip               (String) 
  2606//                pbCreateExpanded        (Boolean)
  2607//                pbLabelEmboldened       (Boolean)
  2608//                peItemType              (Integer)
  2609//                pvValue                 (Variant)
  2610//                pbDefaultAsInitialValue (Boolean)
  2611//                pvDefaultValue          (Variant)
  2612//                pvInitialValue          (Variant)
  2613//                pvTag                   (Variant)
  2614//                pbHidden                (Boolean)
  2615//                pbReadOnly              (Boolean)
  2616//                pbPassword_State        (Boolean)
  2617//                pbCapslock_State        (Boolean)
  2618//                piForm_Margin           (Integer)
  2619//                piValueBackgroundColor  (Integer)
  2620//                piMin                   (Integer)
  2621//                piMax                   (Integer)
  2622//                piWidth                 (Integer)
  2623//
  2624// Events       : OnChange          
  2625//                OnEditAfter      
  2626//                OnMoveItemDataIn 
  2627//                OnMoveItemDataOut
  2628//
  2629// Methods      : Procedure Set PropertyItemMask (String llMask String llLiteral Variant llPrompt)  
  2630//
  2631// Notes        :
  2632//
  2633// To Do        :           
  2634//               
  2635//---------------------------------------------------
  2636{DocEnd} 
  2637Class cSigCJPropertyGridSliderCtlItem is a cSigCJPropertyGridItem
  2638    Import_Class_Protocol cSigCJPropertyGridItemSpinAndSlider_Mixin
  2639    
  2640    Procedure Construct_Object
  2641        Forward Send Construct_Object
  2642        { Visibility=Private }
  2643        Property Handle Private.phoButtonObject     (Create(Self, U_cSigCjComPropertyGridInPlaceSliderControl))
  2644        
  2645        Send Define_SpinForm_and_Slider_Properties 
  2646    End_Procedure
  2647    
  2648    { MethodType=Method Visibility=Private }
  2649    Procedure Private.Create Handle hoParent Boolean bRecursive
  2650        Variant vButton
  2651        
  2652        If (hoParent=0) Begin
  2653            Procedure_Return
  2654        End
  2655        
  2656        Forward Send Private.Create hoParent bRecursive
  2657        Get ComAddSliderControl to vButton
  2658        Set pvComObject of (Private.phoButtonObject(Self)) to vButton
  2659        Send ApplySettings
  2660    End_Procedure
  2661End_Class
  2662
  2663//==============================================================================
  2664//End of Package - cSigCJSlider.pkg
  2665//==============================================================================
  2666