Module cSigCJMethods_Mixin.pkg

     1//==============================================================================
     2// Project      : SigCj - VDF Classes for Codejock
     3// File         : cSigCJMethods_Mixin.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 VDFBase.pkg
    37
    38Class cSigCJMethods_Mixin is a Mixin
    39
    40//=============================================================================
    41//Property support    
    42//=============================================================================
    43
    44    //-------------------------------------------------------------------------
    45    //Main object based properties
    46    
    47    { Visibility=Private }
    48    Procedure Set SigCJProperty Overloaded Handle hmPrivateProperty Handle hmCOMProperty Variant vValue
    49        Set hmPrivateProperty to vValue
    50        If (IsComObjectCreated(Self)) Begin
    51            Set hmCOMProperty to vValue
    52        End
    53    End_Procedure
    54    
    55    { Visibility=Private }
    56    Function SigCJProperty Overloaded Handle hmPrivateProperty Handle hmCOMProperty Returns Variant
    57        Variant vValue
    58        If (IsComObjectCreated(Self)) Begin
    59            Get hmCOMProperty to vValue
    60        End
    61        Else Begin
    62            Get hmPrivateProperty to vValue
    63        End
    64        Function_Return vValue
    65    End_Function
    66    
    67    //-------------------------------------------------------------------------
    68    //Sub object based properties
    69    
    70    { Visibility=Private }
    71    Procedure Set SigCJProperty Overloaded Handle hmPrivateProperty Handle hmCOMProperty Handle hObject Variant vValue
    72        Set hmPrivateProperty to vValue
    73        If (IsComObjectCreated(Self)) Begin
    74            Set hmCOMProperty of hObject to vValue
    75        End
    76    End_Procedure
    77    
    78    { Visibility=Private }
    79    Function SigCJProperty Overloaded Handle hmPrivateProperty Handle hmCOMProperty Handle hObject Returns Variant
    80        Variant vValue
    81        If (IsComObjectCreated(Self)) Begin
    82            Get hmCOMProperty of hObject to vValue
    83        End
    84        Else Begin
    85            Get hmPrivateProperty to vValue
    86        End
    87        Function_Return vValue
    88    End_Function
    89    
    90//=============================================================================
    91//Time support    
    92//=============================================================================
    93
    94    Function SigCj_GetHours String sTime Returns Integer
    95        Integer iHours
    96        String  sDigit1 sDigit2 
    97
    98        //If there are any data errors we will return zero
    99
   100        Move (Mid(sTime,1,1)) to sDigit1
   101        Move (Mid(sTime,1,2)) to sDigit2
   102        If (((Ascii(sDigit1) > 47) and (Ascii(sDigit1) < 58)) and ((Ascii(sDigit2) > 47) and (Ascii(sDigit2) < 58))) Begin 
   103            Move (Left(sTime,2)) to iHours      //both characters are digits so convert to integer
   104            If (iHours > 23) Move 23 to iHours  //if more than 23 return 23
   105        End
   106
   107        Function_Return iHours
   108    End_Function
   109
   110    //-------------------------------------------------------------------------
   111
   112    Function SigCj_GetMinutes String sTime Returns Integer
   113        Integer iMins iLen
   114        String  sDigit1 sDigit2 sMins
   115
   116        //If there are any data errors we will return zero
   117
   118        Move (Length(sTime)) to iLen
   119        If ((iLen = 4) or (iLen = 5) or (iLen = 6) or (iLen = 8)) Begin
   120            If ((iLen = 5) or (iLen = 8)) Move (Mid(sTime,2,4)) to sMins //formatted with :'s
   121            Else                          Move (Mid(sTime,2,3)) to sMins //no :'s
   122
   123            Move (Mid(sMins,1,1)) to sDigit1
   124            Move (Mid(sMins,1,2)) to sDigit2
   125            If (((Ascii(sDigit1) > 47) and (Ascii(sDigit1) < 58)) and ((Ascii(sDigit2) > 47) and (Ascii(sDigit2) < 58))) Begin 
   126                Move sMins to iMins                 //both characters are digits so convert to integer
   127                If (iMins > 59) Move 59 to iMins    //if more than 59 return 59
   128            End
   129        End
   130
   131        Function_Return iMins
   132    End_Function
   133
   134    //-------------------------------------------------------------------------
   135
   136End_Class 
   137
   138//==============================================================================
   139//End of Package - cSigCJMethods_Mixin.pkg
   140//==============================================================================
   141