Jump to content

Recommended Posts

Posted (edited)

Could someone else running Windows Vista please confirm the help file example for _GUICtrlMonthCal_SetColor does not in face change the calendar's background color? I'm thinking it might be Vista related because I ran the same code in a VM of Windows XP, and it changed the color just fine...

here's the help file example for the lazy:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
    Local $hMonthCal

 ; Create GUI
    GUICreate("Month Calendar Set Color", 400, 300)
    $hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)
    
 ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

 ; Get/Set calendar color
    MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
    _GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)
    MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))

 ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc;==>MemoWrite
Edited by kid sinister
Posted (edited)

#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

_ThemeLevel(1)

Global $iMemo

_Main()

Func _Main()
    Local $hMonthCal

   ; Create GUI
    GUICreate("Month Calendar Set Color", 400, 300)
    $hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)
    
   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

   ; Get/Set calendar color
    MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
    _GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)
    MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc  ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc  ;==>MemoWrite
 
; Functionality :
; just info about possibility to turn off theme-using in scripts/compiled-exe with using GUI stuff
; This info was produced by Holger
Func _ThemeLevel($nFlag = 0)
    ; $nFlag = 0  ; Visual styles are completely disabled in the running script
    ; $nFlag = 1; Nonclient areas of the GUI can use visual styles
    ; $nFlag = 2; Controls can use visual styles (like Buttons, Progressbar, Group-ctrl's, etc.)
    ; $nFlag = 4; Web content displayed ??? (info from MSDN) can use visual styles
    ;
    ; These flags can be combined with BitOr(...)

    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $nFlag)
EndFunc   ;==>_ThemeLevel

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
×
×
  • Create New...