Sign in to follow this  
Followers 0
BugFix

Create mask for MonthCal

1 post in this topic

Hi,

if you want to mark several days in an MonthCal (with _GUICtrlMonthCal_SetDayState), you must create an mask with this days in.

The following function creates the mask.

;===============================================================================
; Function Name:   _GetHexMask($sDays [, $Delim=Default])
; Description:     creates mask to mark days with _GUICtrlMonthCal_SetDayState in MonthCal
; Parameter(s):    $sDays    string with days to mark
;                  $Delim    delimiter in string, 'Default' (char from 'GUIDataSeparatorChar')
; Return Value(s): Hexstring for $aMasks
; Author(s):       BugFix (bugfix@autoit.de)
;===============================================================================
Func _GetHexMask($sDays, $Delim=Default)
    If $Delim = Default Then $Delim = Opt('GUIDataSeparatorChar')
    $aDays = StringSplit($sDays, $Delim, 2)
    Local $aHex[8] = [0,0,0,0,0,0,0,0], $pos, $out = ''
    For $i = 0 To UBound($aDays) -1
        Select
            Case $aDays[$i] < 5
                $pos = 0
            Case $aDays[$i] < 9
                $pos = 1
            Case $aDays[$i] < 13
                $pos = 2
            Case $aDays[$i] < 17
                $pos = 3
            Case $aDays[$i] < 21
                $pos = 4
            Case $aDays[$i] < 25
                $pos = 5
            Case $aDays[$i] < 29
                $pos = 6
            Case Else
                $pos = 7
        EndSelect
        $aDays[$i] -= $pos * 4
        $aHex[$pos] += 2 ^ ($aDays[$i]-1)
    Next
    For $i = 0 To UBound($aHex) -1
        $out = Hex($aHex[$i], 1) & $out
    Next
    Return '0x' & $out
EndFunc  ;==>_GetHexMask

_GetHexMask.au3


Best Regards BugFix  

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0