Module Calendar_Categories.vw

     1//==============================================================================
     2// Contributions
     3// =============
     4//
     5// When       Who          What
     6// ========== ============ =====================================================
     7// 2009-01-09 Nick Wright  Original Implementation
     8//
     9//==============================================================================
    10
    11Use DfAllEnt.pkg
    12
    13Use CAL_CATS.DD
    14Use cSigCjPushButton.pkg
    15Use cSigCjLabel.pkg
    16Use cHexLib.Pkg
    17Use TrckBr.pkg
    18Use cSigCjColorPicker.pkg
    19Use DfCentry.pkg
    20
    21Deferred_View Activate_oSigCjCalendarDemo_Categories_View for ;
    22Object oSigCjCalendarDemo_Categories_View is a dbView
    23    Set Border_Style to Border_Thick
    24    Set Size to 145 345
    25    Set Location to 3 4
    26    Set Label to "Codejock Demo - Calendar Categories"
    27    Set Icon to "SIG.ico" 
    28
    29    
    30    Object oCal_Cats_DD is a Cal_Cats_DataDictionary
    31
    32        Procedure OnNewCurrentRecord RowID riOldRec RowID riNewRec
    33            Forward Send OnNewCurrentRecord riOldRec riNewRec
    34
    35            If (Operation_Mode <> Mode_Saving ) Begin
    36                Send ShowColors of oSigCJLabel1
    37                Set piSelectedColor of oCal_Cats_BorderColor  to CAL_CATS.BORDERColour
    38                Set piSelectedColor of oCAL_CATS_ColorLIGHT   to CAL_CATS.ColourLIGHT
    39                Set piSelectedColor of oCAL_CATS_ColorDARK    to CAL_CATS.ColourDARK
    40                Send MoveSlider
    41            End
    42       
    43        End_Procedure
    44
    45    End_Object
    46
    47    Set Main_DD to oCal_Cats_DD
    48    Set Server to oCal_Cats_DD
    49
    50    Object oHex is a cHexLib
    51    End_Object
    52
    53    Object oCAL_CATS_ID is a dbForm
    54        Entry_Item CAL_CATS.ID
    55        Set Location to 10 70
    56        Set Size to 13 38
    57        Set Label to "ID:"
    58        Set Label_Col_Offset to 2
    59        Set Label_Justification_Mode to JMode_Right
    60    End_Object
    61
    62    Object oCAL_CATS_SHORT_DESC is a dbForm
    63        Entry_Item CAL_CATS.SHORT_DESC
    64        Set Location to 26 70
    65        Set Size to 13 102
    66        Set Label to "Short Description:"
    67        Set Label_Col_Offset to 2
    68        Set Label_Justification_Mode to JMode_Right
    69    End_Object
    70
    71    Object oCAL_CATS_LONG_DESC is a dbForm
    72        Entry_Item CAL_CATS.LONG_DESC
    73        Set Location to 42 70
    74        Set Size to 13 246
    75        Set Label to "Long Description:"
    76        Set Label_Col_Offset to 2
    77        Set Label_Justification_Mode to JMode_Right
    78    End_Object
    79
    80    Object oCAL_CATS_BORDERColor is a cSigCJColorPicker
    81        Set Size to 16 95
    82        Set Location to 58 70
    83        Set Transparent_State to True
    84        Set psCaption to "Border Color"
    85        #IF (SigCj_Codejock_Version < 150001) 
    86            Set peAppearance to OLExtpAppearanceOffice2007
    87        #ELSE
    88            Set peAppearance to OLExtpAppearanceResource
    89        #ENDIF 
    90        Set pbFlatStyle to True
    91        
    92        Procedure OnClick 
    93            Send Update_Cols
    94        End_Procedure
    95        
    96        Procedure OnKeyPress
    97            Send Update_Cols
    98        End_Procedure
    99        
   100        Procedure Update_Cols
   101            Integer iColor
   102        
   103            Get piSelectedColor to iColor
   104            Set Field_Changed_Value of oCal_Cats_DD Field CAL_CATS.BORDERColour to iColor
   105            Send ShowColors of oSigCJLabel1
   106        End_Procedure
   107
   108    End_Object
   109
   110    Object oCAL_CATS_ColorLIGHT is a cSigCJColorPicker
   111        Set Size to 16 95
   112        Set Location to 74 70
   113        Set Transparent_State to True    
   114        Set psCaption to "Light Color"
   115        #IF (SigCj_Codejock_Version < 150001) 
   116            Set peAppearance to OLExtpAppearanceOffice2007
   117        #ELSE
   118            Set peAppearance to OLExtpAppearanceResource
   119        #ENDIF 
   120        Set pbFlatStyle to True
   121            
   122        Procedure OnClick 
   123            Send Update_Cols
   124        End_Procedure
   125        
   126        Procedure OnKeyPress
   127            Send Update_Cols
   128        End_Procedure
   129
   130        Procedure Update_Cols
   131            Integer iColor
   132        
   133            Get piSelectedColor to iColor
   134            Set Field_Changed_Value of oCal_Cats_DD Field CAL_CATS.ColourLIGHT to iColor
   135            Send ShowColors of oSigCJLabel1
   136        End_Procedure
   137
   138    End_Object
   139            
   140    Object oCAL_CATS_ColorDARK is a cSigCJColorPicker
   141        Set Size to 16 95
   142        Set Location to 90 70
   143        Set Transparent_State to True
   144        Set psCaption to "Dark Color"
   145        Set pbFlatStyle to True
   146        #IF (SigCj_Codejock_Version < 150001) 
   147            Set peAppearance to OLExtpAppearanceOffice2007
   148        #ELSE
   149            Set peAppearance to OLExtpAppearanceResource
   150        #ENDIF 
   151            
   152        Procedure OnClick 
   153            Send Update_Cols
   154        End_Procedure
   155        
   156        Procedure OnKeyPress
   157            Send Update_Cols
   158        End_Procedure
   159
   160        Procedure Update_Cols
   161            Integer iColor
   162        
   163            Get piSelectedColor to iColor
   164            Set Field_Changed_Value of oCal_Cats_DD Field CAL_CATS.ColourDARK to iColor
   165            Send ShowColors of oSigCJLabel1
   166        End_Procedure
   167
   168    End_Object
   169            
   170    Object oCAL_CATS_GRADIENTFACTOR is a dbForm
   171        Entry_Item CAL_CATS.GRADIENTFACTOR
   172        Set Location to 109 70
   173        Set Size to 13 29
   174        Set Label to "Gradient Factor:"
   175
   176        Procedure Exiting Handle hoDestination Returns Integer
   177            Integer iRet
   178            
   179            Forward Get msg_Exiting hoDestination to iRet
   180            Send ShowColors of oSigCJLabel1
   181            Send MoveSlider
   182            
   183            Procedure_Return iRet
   184        End_Procedure
   185
   186    End_Object
   187
   188    Object obtnSave is a Button
   189        Set Location to 127 119
   190        Set Label to "Save"
   191        Set peAnchors to anBottomRight
   192    
   193        Procedure OnClick
   194            Send Request_Save
   195        End_Procedure
   196    
   197    End_Object
   198    Object obtnClear is a Button
   199        Set Location to 127 177
   200        Set Label to "Clear"
   201        Set peAnchors to anBottomRight
   202    
   203        Procedure OnClick
   204            Send Clear
   205        End_Procedure
   206    
   207    End_Object
   208    
   209    Object obtnDelete is a Button
   210        Set Location to 127 235
   211        Set Label to "Delete"
   212        Set peAnchors to anBottomRight
   213    
   214        Procedure OnClick
   215            Send Request_Delete
   216        End_Procedure
   217    
   218    End_Object
   219    
   220    Object obtnClose is a Button
   221        Set Location to 127 291
   222        Set Label to "Close"
   223        Set peAnchors to anBottomRight
   224    
   225        Procedure OnClick
   226            Send Close_Panel
   227        End_Procedure
   228    
   229    End_Object
   230
   231    Object oSigCJLabel1 is a cSigCJLabel
   232        Set Size to 52 149
   233        Set Location to 58 168
   234        Set peAnchors to anTopLeftRight
   235    
   236        Property Boolean pbCreated
   237    
   238        Procedure OnCreate
   239            Forward Send OnCreate
   240            Handle hoMarkUpContext 
   241            Variant vMarkUpContext vMe
   242            String sLabel
   243
   244            Forward Send OnCreate
   245
   246            Set ComEnableMarkup to True
   247            
   248            Get ComMarkupContext to vMarkUpContext
   249            Get Create U_cSigCjComMarkupContext to hoMarkUpContext
   250                Set pvComObject of hoMarkUpContext to vMarkUpContext
   251
   252                Get pvComObject to vMe
   253
   254                Send ComSetMethod of hoMarkUpContext vMe "MakeShapeRed"
   255            Send Destroy of hoMarkUpContext  
   256            Set pbCreated to True
   257            
   258        End_Procedure
   259
   260        Procedure ShowColors
   261            Integer iDark iLight iBorder
   262            Number nGradient
   263            String sDark sLight sBorder sLabel
   264            
   265            If (pbCreated(Self)) Begin
   266                Get Field_Current_Value of oCal_Cats_DD Field CAL_CATS.ColourDARK to iDark
   267                Get Field_Current_Value of oCal_Cats_DD Field CAL_CATS.ColourLIGHT to iLight
   268                Get Field_Current_Value of oCal_Cats_DD Field CAL_CATS.BORDERColour to iBorder
   269                Get Field_Current_Value of oCal_Cats_DD Field CAL_CATS.GRADIENTFACTOR to nGradient
   270                
   271                Get HexColor of oHex iDark to sDark
   272                Get HexColor of oHex iLight to sLight
   273                Get HexColor of oHex iBorder to sBorder
   274                
   275                Move "" to sLabel
   276                Move (sLabel + '+sBorder+'" CornerRadius="5" >') to sLabel
   277                Move (sLabel + '	') to sLabel
   278                Move (sLabel + '		') to sLabel
   279                Move (sLabel + '			+sLight+'" Offset="0"/>') to sLabel
   280                Move (sLabel + '			+sDark+'" Offset="'+String(nGradient)+'"/>') to sLabel
   281                Move (sLabel + '		') to sLabel
   282                Move (sLabel + '	') to sLabel
   283                Move (sLabel + '') to sLabel
   284                Move (sLabel + '') to sLabel
   285                  
   286                Set ComCaption to sLabel
   287            End
   288        End_Procedure
   289    
   290    End_Object
   291
   292    Procedure Close_panel
   293        Set pbCreated of oSigCJLabel1 to False
   294        Forward Send Close_Panel
   295    End_Procedure
   296
   297
   298    Object oTrackBar1 is a TrackBar
   299        Set Size to 68 99
   300        Set Location to 52 318
   301        Set Orientation_Mode to slVert
   302        Set Maximum_Position to 100
   303        
   304        Set Visible_Tick_State to False
   305        Set pbTooltips to False
   306    
   307        //OnSetPosition is always called when the slider changes.
   308    
   309        Procedure OnSetPosition
   310            Number nPos
   311        
   312            Get Current_Position to nPos
   313            
   314            Set Field_Changed_Value of oCAL_CATS_DD Field CAL_CATS.GRADIENTFACTOR to (nPos/100)
   315            Send ShowColors of oSigCJLabel1
   316           
   317        End_Procedure
   318    
   319    End_Object
   320
   321    Object oCal_Cats_Category_Set is a dbComboForm
   322        Entry_Item Cal_Cats.Category_Set
   323        Set Location to 10 160
   324        Set Size to 13 120
   325        Set Label to "Category Set:"
   326        Set Label_Col_Offset to 2
   327        Set Label_Justification_Mode to JMode_Right
   328    End_Object
   329    
   330    Procedure MoveSlider
   331        Number nPos
   332        Get Field_Current_Value of oCal_Cats_DD Field CAL_CATS.GRADIENTFACTOR to nPos
   333        Set Current_Position of oTrackBar1 to (nPos*100)
   334    End_Procedure
   335
   336Cd_End_Object
   337