viewpoint-particle

Author Topic: Calendar control - Bold/Color/etc  (Read 4236 times)

mcvpjd3

  • Newbie
  • *
  • Posts: 41
Calendar control - Bold/Color/etc
« on: April 22, 2014, 09:21:51 am »
I'm writing a script that has a couple of calendar controls on it. At the start they are disabled and only enabled as each one is required to be used, however, the difference between enabled and disabled is so small (just the month change arrows seem to change) that it's barely noticeable. So I was thinking I could make the one I want active bold and the others regular or change the colors or something, but I don’t see any way of doing that using the dialogcontrolset function. Am I missing something here or is that as intended?

Thanks

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Calendar control - Bold/Color/etc
« Reply #1 on: April 22, 2014, 09:37:17 am »
Unfortunately the Calendar Dialog control provided with WIL Dialogs are not very customizable. The only Calendar controls styles you modify in the callback procedure is the invisible or disabled styles. Maybe include a GROUPBOX control around each calendar that is invisible when inactive and visible when active.
Deana F.
Technical Support
Wilson WindowWare Inc.

mcvpjd3

  • Newbie
  • *
  • Posts: 41
Re: Calendar control - Bold/Color/etc
« Reply #2 on: April 22, 2014, 09:41:51 am »
:-) I've got a Groupbox round it that I was changing from Black text to Red, but was hoping to make it stand out a bit more - I'll think of something.

Thanks for the reply anyway.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Calendar control - Bold/Color/etc
« Reply #3 on: April 22, 2014, 09:42:48 am »
Another possible idea would be to create 4 Calendar controls. 2 unbolded font and 2  bolded font, then flip the invisible styles to switch from unbolded to bolded controls. For example: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.X+Update~Font~Style~in~Dialog.txt
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Calendar control - Bold/Color/etc
« Reply #4 on: April 22, 2014, 09:56:26 am »
Here is a code sample using the active Groupbox suggestion:

Code: Winbatch
#DefineSubRoutine InitDialogConstants()
   ;DialogprocOptions Constants
   MSG_INIT=0                    ; The one-time initialization
   MSG_TIMER=1                   ; Timer event
   MSG_BUTTONPUSHED=2            ; Pushbutton or Picturebutton
   MSG_RADIOPUSHED=3             ; Radiobutton clicked
   MSG_CHECKBOX=4                ; Checkbox clicked
   MSG_EDITBOX=5                 ; Editbox or Multilinebox
   MSG_FILESELECT=6              ; Filelistbox
   MSG_ITEMSELECT=7              ; Itembox
   MSG_COMBOCHANGE=8             ; Combobox/Droplistbox
   MSG_CALENDAR=9                ; Calendar date change
   MSG_SPINNER=10                ; Spinner number change
   MSG_CLOSEVIA49=11             ; Close clicked (Enabled via DialogProcOptions 1002
   MSG_FILEBOXDOUBLECLICK=12     ; Get double-click message on a FileListBox
   MSG_ITEMBOXDOUBLECLICK=13     ; Get double-click message on an ItemBox
   MSG_COMEVENT=14               ; COMCONTROL Event notification from DialogObject (NOT DialogProcOptions)
   MSG_MENUITEM=15               ; MenuItem selected
   MSG_MENUITEMINIT=16           ; MenuItem initialized
   MSG_RESIZE=17                 ; Dialog resized
   MSG_RVITEMSELROW=18           ; Reportview item select row
   MSG_RVDBLCLICKROW=19          ; Reportview double-click row
   MSG_RVCHECKEDITEM=20          ; Reportview checked/unchecked Item
   MSG_RVITEMTEXT=21             ; Reportview changed text of first column
   MSG_RVHEADER=22               ; Reportview header clicked

   DPO_DISABLESTATE=1000         ; codes -1=GetSetting 0=EnableDialog 1=DisableDialog
   DPO_CHANGEBACKGROUND=1001     ; -1=Get Current otherise bitmap or color string
   DPO_CHANGESYSMENU=1002        ; -1=Get Current 0=none 1=close 2=close/min 3=close/max 4=close/min/max
   DPO_CHANGETITLE=1003          ; Set/Get Dialog Title - (-1 to get)
   DPO_GETNAME=1004              ; Returns the name associated with a control's number.
   DPO_GETNUMBER=1005            ; Returns the number associated with a control's name.
   DPO_GETCLIENTAREA=1007        ; Returns a space delimited list of the width and height of the client area.

   ;DialogControlState Constants
   DCSTATE_SETFOCUS=1            ; Give Control Focus
   DCSTATE_QUERYSTYLE=2          ; Query control's style
   DCSTATE_ADDSTYLE=3            ; Add control style
   DCSTATE_REMOVESTYLE=4         ; Remove control style
   DCSTATE_GETFOCUS=5            ; Get control that has focus
   DCSTATE_MOVEMOUSEOVER=6       ; Move the mouse over the control

   DCSTYLE_DEFAULT=0             ; Set Default Style
   DCSTYLE_INVISIBLE=1           ; Set Control Invisible
   DCSTYLE_DISABLED=2            ; Set Control Disabled
   DCSTYLE_NOUSERDATA=4          ; Note: Setable via DialogControlState function ONLY SPINNER control only
   DCSTYLE_READONLY=8            ; Sets control to read-only (user cannot type in data) EDITBOX MULTILINEBOX SPINNER
   DCSTYLE_PASSWORD=16           ; Sets 'password mode' where only *'s are displayed EDITBOX
   DCSTYLE_DEFAULTBUTTON=32      ; Sets a button as the default button PUSHBUTTON PICTUREBUTTON
   DCSTYLE_DIGITSONLY=64         ; Set edit box to accept digits only EDITMOX MULTILINEBOX
   DCSTYLE_FLAT=128              ; Makes a 'flat' hyperlink-looking button PUSHBUTTON PICTUREBUTTON
   DCSTYLE_NOADJUST=256          ; Turns off auto-height adjustment  ITEMBOX FILELISTBOX
   DCSTYLE_TEXTCENTER=512        ; Center text in control VARYTEXT STATICTEXT
   DCSTYLE_TEXTRIGHT=1024        ; Flush-Right text in control VARYTEXT STATICTEXT
   DCSTYLE_NOSELCURLEFT=2048     ; No selection, cursor left EDITBOX MULTILINEBOX
   DCSTYLE_NOSELCURRIGHT=4096    ; No selection, cursor right EDITBOX MULTILINEBOX
   DCSTYLE_SHIELD=8192           ; Display Security Shield icon on button (Vista only) PUSHBUTTON PICTUREBUTTON
   DCSTYLE_MENUCHECK=32768       ; Adds a check mark to the left of a menu item MENUITEM
   DCSTYLE_MENURADIO=65536       ; Adds a radio button like dot graphic to the left of a menu item MENUITEM
   DCSTYLE_MENUSEP=131072        ; Separator bar graphic MENUITEM
   DCSTYLE_MENUBREAK=262144      ; Column break MENUBAR
   DCSTYLE_NOHEADER=524288       ; No header bar REPORTVIEW
   DCSTYLE_COLHEADER=1048576     ; First row column header REPORTVIEW
   DCSTYLE_GRIDLINES=2097152     ; Grid lines REPORTVIEW
   DCSTYLE_SELONEROW=4194304     ; Only one row can be selected at a time REPORTVIEW
   DCSTYLE_SELALLROW = 8388608   ; Highlight complete row REPORTVIEW
   DCSTYLE_SORTASC=16777216      ; Ascending sort REPORTVIEW
   DCSTYLE_SORTDESC=33554432     ; Descending sort REPORTVIEW
   DCSTYLE_EDITCOL=67108864      ; Edit first columns text REPORTVIEW
   DCSTYLE_COLCHECKBOX=134217728 ; Add checkbox to first column REPORTVIEW
   DCSTYLE_INSHEADER=268435456   ; Include column header text REPORTVIEW

   ;DialogControlSet / DialogControlGet Constants
   DC_CHECKBOX=1             ; CHECKBOX REPORTVIEW
   DC_RADIOBUTTON=2          ; RADIOBUTTON
   DC_EDITBOX=3              ; EDITBOX MULTILINEBOX
   DC_TITLE=4                ; PICTURE RADIOBUTTON CHECKBOX PICTUREBUTTON VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON MENUITEM
   DC_ITEMBOXCONTENTS=5      ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_ITEMBOXSELECT=6        ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_CALENDAR=7             ; CALENDAR
   DC_SPINNER=8              ; SPINNER
   DC_MULTITABSTOPS=9        ; MULTILINEBOX
   DC_ITEMSCROLLPOS=10       ; ITEMBOX FILELISTBOX
   DC_BACKGROUNDCOLOR=11     ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FILELISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX REPORTVIEW
   DC_PICTUREBITMAP=12       ; PICTURE PICTUREBUTTON
   DC_TEXTCOLOR=13           ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FILELISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX REPORTVIEW
   DC_ITEMBOXADD=14          ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_ITEMBOXREMOVE=15       ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_RADIOVALUE=16          ; RADIOBUTTON
   DC_POSITION=17            ; ALL CONTROLS (Except MENUBAR and MENUITEM)
   DC_MENUNAMES=18           ; ALL CONTROLS
   DC_HANDLE=19              ; ALL CONTROLS (Except MENUBAR and MENUITEM)
   DC_RVCOLHEAD=20           ; REPORTVIEW
   DC_RVCOLWIDTH=21          ; REPORTVIEW
   DC_RVADDCOL=22            ; REPORTVIEW
   DC_RVREMOVECOL=23         ; REPORTVIEW
   DC_RVMATCHCOL=24          ; REPORTVIEW
   DC_RVCANCELEDIT=25        ; REPORTVIEW
   DC_RVCHECKEDROWS=26       ; REPORTVIEW
   DC_RVJUSTIFY=27           ; REPORTVIEW


   ;DialogObject constants
   DLGOBJECT_ADDEVENT=1      ; Call dialog callback when the specified event occurs
   DLGOBJECT_STOPEVENT=2     ; Stop calling dialog callback when an event previously requested with
   DLGOBJECT_GETOBJECT=3     ; Return an object references to the specified control
   DLGOBJECT_GETPICTURE=4    ; Create and return an object reference to a picture object

   ;Return code constants
   RET_DO_CANCEL=0           ; Cancels dialog
   RET_DO_DEFAULT= -1        ; Continue with default processing for control
   RET_DO_NOT_EXIT= -2       ; Do not exit the dialog
   return
#EndSubroutine
;============================================================
;============================================================
;============================================================


#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,MyDialog_ChangeInfo)
    InitDialogConstants()                                   ; Initialize Dialog Constants
   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   switch MyDialog_Message                                  ; Switch based on Dialog Message type
      case MSG_INIT                                         ; Standard Initialization message
;         DialogProcOptions(MyDialog_Handle,MSG_TIMER,1000)
         DialogProcOptions(MyDialog_Handle,MSG_BUTTONPUSHED,@TRUE)
;         DialogProcOptions(MyDialog_Handle,MSG_CALENDAR,@TRUE)
         return(RET_DO_DEFAULT)

     case MSG_BUTTONPUSHED
        if MyDialog_Name == "PushButton_OK"                ; OK
              return(RET_DO_DEFAULT)

        elseif MyDialog_Name == "PushButton_Cancel"        ; Cancel
              return(RET_DO_CANCEL)

        elseif MyDialog_Name == "PushButton_Switch"        ; Switch Calendars
              nStyle = DialogControlState( MyDialog_Handle, 'GroupBox_1', 2, 0)  ;2 - Query a control's style
              If nStyle & 1
                  DialogControlState(MyDialog_Handle,'GroupBox_1',4,1) ; Clear the invisible bit
                  DialogControlState(MyDialog_Handle,'Calendar_1',4,2 ); Enable calendar control
              Else
                  DialogControlState(MyDialog_Handle,'GroupBox_1',3,1) ; Set the invisible bit
                  DialogControlState(MyDialog_Handle,'Calendar_1',3,2) ; Disable calendar control
              EndIf
              nStyle = DialogControlState( MyDialog_Handle, 'GroupBox_2', 2, 0)  ;2 - Query a control's style
              If nStyle & 1
                  DialogControlState(MyDialog_Handle,'GroupBox_2',4,1) ; Clear the invisible bit
                  DialogControlState(MyDialog_Handle,'Calendar_2',4,2 ); Enable calendar control
              Else
                  DialogControlState(MyDialog_Handle,'GroupBox_2',3,1) ; Set the invisible bit
                  DialogControlState(MyDialog_Handle,'Calendar_2',3,2) ; Disable calendar control
              EndIf
              return(RET_DO_NOT_EXIT)

        endif                                              ; MyDialog_Name
        return(RET_DO_DEFAULT)

;     case MSG_CALENDAR
;        if MyDialog_Name == "Calendar_1"                   ; caVariable1
;              return(RET_DO_DEFAULT)

;        elseif MyDialog_Name == "Calendar_2"               ; caVariable2
;              return(RET_DO_DEFAULT)

;        endif                                              ; MyDialog_Name
;        return(RET_DO_DEFAULT)

   endswitch                                                ; MyDialog_Message
   return(RET_DO_DEFAULT)
#EndFunction                                                ; End of Dialog Callback MyDialogCallbackProc


MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog 1`
MyDialogX=002
MyDialogY=059
MyDialogWidth=426
MyDialogHeight=237
MyDialogNumControls=007
MyDialogProcedure=`MyDialogCallbackProc`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`115,205,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`179,205,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`041,033,100,104,CALENDAR,"Calendar_1",caVariable1,DEFAULT,DEFAULT,30,DEFAULT,"Minya Nouvelle|5632|40|2"`
MyDialog004=`183,037,100,098,CALENDAR,"Calendar_2",caVariable2,DEFAULT,DEFAULT,40,2,DEFAULT`
MyDialog005=`139,169,062,012,PUSHBUTTON,"PushButton_Switch",DEFAULT,"Switch Calendars",2,50,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog006=`037,021,108,126,GROUPBOX,"GroupBox_1",DEFAULT,"ACTIVE",DEFAULT,60,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog007=`177,021,112,124,GROUPBOX,"GroupBox_2",DEFAULT,"ACTIVE",DEFAULT,70,1,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")
Exit
Deana F.
Technical Support
Wilson WindowWare Inc.

....IFICantBYTE

  • Full Member
  • ***
  • Posts: 120
Re: Calendar control - Bold/Color/etc
« Reply #5 on: April 22, 2014, 11:59:00 pm »
Here is a UDF I made a long time ago to address the lack of colour selection in Dialog Calendar Controls, it is followed by an Example Dialog I just made..

Code: Winbatch
;-----------------------------------------------------------------------------------------------------------------------------------------;
;CalSetColor : Sets the colours of a Calendar control.                  ....IFICantBYTE                                                   ;
;-----------------------------------------------------------------------------------------------------------------------------------------;
;hCalCtrl  : Calendar Control handle                                                                                                      ;
;Component : A number representing the part of the Calendar Control you want to change....                                                ;
;            This can be one of the following MCSC_XXX  Win32 API values:                                                                 ;
;            BACKGROUND = 0 , TEXT = 1 , TITLE BACKGROUND = 2 , TITLE TEXT = 3 , MONTH BACKGROUND = 4 , TRAILING TEXT = 5                 ;
;RGB       : Can be either: "RED|GREEN|BLUE" value (use 0 to 255 for each seperated by | as a text string - ie: in quotes)                ;
;                            OR the decimal value of the RedGreenBlue combined values (as returned by this UDF or in memory locations)    ;
;-----------------------------------------------------------------------------------------------------------------------------------------;
;Returns   : The previous RGB value (as a decimal) OR -1 for failure                                                                      ;
;-----------------------------------------------------------------------------------------------------------------------------------------;
#DefineFunction CalSetColor(hCalCtrl,Component,RGB)
User32=StrCat(DirWindows(1),"User32.dll")
MCM_SETCOLOR = 4106 ;MCM_FIRST = 4096 + 10
If IsInt(RGB) == @FALSE
R = ItemExtract(1,rgb,"|")
G = ItemExtract(2,rgb,"|")
B = ItemExtract(3,rgb,"|")
RGB = B*256*256 + G*256 + R
EndIf
Return DllCall(User32,long:"SendMessageA",long:hCalCtrl,long:MCM_SETCOLOR,long:Component,long:RGB)
#EndFunction
;##########################################################################################################################################




;Example Dialog using above UDF:



;============================================================
;============================================================
;============================================================




#DefineSubRoutine InitDialogConstants()
   ;DialogprocOptions Constants
   MSG_INIT=0                    ; The one-time initialization
   MSG_TIMER=1                   ; Timer event
   MSG_BUTTONPUSHED=2            ; Pushbutton or Picturebutton
   MSG_RADIOPUSHED=3             ; Radiobutton clicked
   MSG_CHECKBOX=4                ; Checkbox clicked
   MSG_EDITBOX=5                 ; Editbox or Multilinebox
   MSG_FILESELECT=6              ; Filelistbox
   MSG_ITEMSELECT=7              ; Itembox
   MSG_COMBOCHANGE=8             ; Combobox/Droplistbox
   MSG_CALENDAR=9                ; Calendar date change
   MSG_SPINNER=10                ; Spinner number change
   MSG_CLOSEVIA49=11             ; Close clicked (Enabled via DialogProcOptions 1002
   MSG_FILEBOXDOUBLECLICK=12     ; Get double-click message on a FileListBox
   MSG_ITEMBOXDOUBLECLICK=13     ; Get double-click message on an ItemBox
   MSG_COMEVENT=14               ; COMCONTROL Event notification from DialogObject (NOT DialogProcOptions)
   MSG_MENUITEM=15               ; MenuItem selected
   MSG_MENUITEMINIT=16           ; MenuItem initialized
   MSG_RESIZE=17                 ; Dialog resized
   MSG_RVITEMSELROW=18           ; Reportview item select row
   MSG_RVDBLCLICKROW=19          ; Reportview double-click row
   MSG_RVCHECKEDITEM=20          ; Reportview checked/unchecked Item
   MSG_RVITEMTEXT=21             ; Reportview changed text of first column
   MSG_RVHEADER=22               ; Reportview header clicked

   DPO_DISABLESTATE=1000         ; codes -1=GetSetting 0=EnableDialog 1=DisableDialog
   DPO_CHANGEBACKGROUND=1001     ; -1=Get Current otherise bitmap or color string
   DPO_CHANGESYSMENU=1002        ; -1=Get Current 0=none 1=close 2=close/min 3=close/max 4=close/min/max
   DPO_CHANGETITLE=1003          ; Set/Get Dialog Title - (-1 to get)
   DPO_GETNAME=1004              ; Returns the name associated with a control's number.
   DPO_GETNUMBER=1005            ; Returns the number associated with a control's name.
   DPO_GETCLIENTAREA=1007        ; Returns a space delimited list of the width and height of the client area.

   ;DialogControlState Constants
   DCSTATE_SETFOCUS=1            ; Give Control Focus
   DCSTATE_QUERYSTYLE=2          ; Query control's style
   DCSTATE_ADDSTYLE=3            ; Add control style
   DCSTATE_REMOVESTYLE=4         ; Remove control style
   DCSTATE_GETFOCUS=5            ; Get control that has focus
   DCSTATE_MOVEMOUSEOVER=6       ; Move the mouse over the control

   DCSTYLE_DEFAULT=0             ; Set Default Style
   DCSTYLE_INVISIBLE=1           ; Set Control Invisible
   DCSTYLE_DISABLED=2            ; Set Control Disabled
   DCSTYLE_NOUSERDATA=4          ; Note: Setable via DialogControlState function ONLY SPINNER control only
   DCSTYLE_READONLY=8            ; Sets control to read-only (user cannot type in data) EDITBOX MULTILINEBOX SPINNER
   DCSTYLE_PASSWORD=16           ; Sets 'password mode' where only *'s are displayed EDITBOX
   DCSTYLE_DEFAULTBUTTON=32      ; Sets a button as the default button PUSHBUTTON PICTUREBUTTON
   DCSTYLE_DIGITSONLY=64         ; Set edit box to accept digits only EDITMOX MULTILINEBOX
   DCSTYLE_FLAT=128              ; Makes a 'flat' hyperlink-looking button PUSHBUTTON PICTUREBUTTON
   DCSTYLE_NOADJUST=256          ; Turns off auto-height adjustment  ITEMBOX FILELISTBOX
   DCSTYLE_TEXTCENTER=512        ; Center text in control VARYTEXT STATICTEXT
   DCSTYLE_TEXTRIGHT=1024        ; Flush-Right text in control VARYTEXT STATICTEXT
   DCSTYLE_NOSELCURLEFT=2048     ; No selection, cursor left EDITBOX MULTILINEBOX
   DCSTYLE_NOSELCURRIGHT=4096    ; No selection, cursor right EDITBOX MULTILINEBOX
   DCSTYLE_SHIELD=8192           ; Display Security Shield icon on button (Vista only) PUSHBUTTON PICTUREBUTTON
   DCSTYLE_MENUCHECK=32768       ; Adds a check mark to the left of a menu item MENUITEM
   DCSTYLE_MENURADIO=65536       ; Adds a radio button like dot graphic to the left of a menu item MENUITEM
   DCSTYLE_MENUSEP=131072        ; Separator bar graphic MENUITEM
   DCSTYLE_MENUBREAK=262144      ; Column break MENUBAR
   DCSTYLE_NOHEADER=524288       ; No header bar REPORTVIEW
   DCSTYLE_COLHEADER=1048576     ; First row column header REPORTVIEW
   DCSTYLE_GRIDLINES=2097152     ; Grid lines REPORTVIEW
   DCSTYLE_SELONEROW=4194304     ; Only one row can be selected at a time REPORTVIEW
   DCSTYLE_SELALLROW = 8388608   ; Highlight complete row REPORTVIEW
   DCSTYLE_SORTASC=16777216      ; Ascending sort REPORTVIEW
   DCSTYLE_SORTDESC=33554432     ; Descending sort REPORTVIEW
   DCSTYLE_EDITCOL=67108864      ; Edit first columns text REPORTVIEW
   DCSTYLE_COLCHECKBOX=134217728 ; Add checkbox to first column REPORTVIEW
   DCSTYLE_INSHEADER=268435456   ; Include column header text REPORTVIEW

   ;DialogControlSet / DialogControlGet Constants
   DC_CHECKBOX=1             ; CHECKBOX REPORTVIEW
   DC_RADIOBUTTON=2          ; RADIOBUTTON
   DC_EDITBOX=3              ; EDITBOX MULTILINEBOX
   DC_TITLE=4                ; PICTURE RADIOBUTTON CHECKBOX PICTUREBUTTON VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON MENUITEM
   DC_ITEMBOXCONTENTS=5      ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_ITEMBOXSELECT=6        ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_CALENDAR=7             ; CALENDAR
   DC_SPINNER=8              ; SPINNER
   DC_MULTITABSTOPS=9        ; MULTILINEBOX
   DC_ITEMSCROLLPOS=10       ; ITEMBOX FILELISTBOX
   DC_BACKGROUNDCOLOR=11     ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FILELISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX REPORTVIEW
   DC_PICTUREBITMAP=12       ; PICTURE PICTUREBUTTON
   DC_TEXTCOLOR=13           ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FILELISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX REPORTVIEW
   DC_ITEMBOXADD=14          ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_ITEMBOXREMOVE=15       ; ITEMBOX FILELISTBOX DROPLISTBOX REPORTVIEW
   DC_RADIOVALUE=16          ; RADIOBUTTON
   DC_POSITION=17            ; ALL CONTROLS (Except MENUBAR and MENUITEM)
   DC_MENUNAMES=18           ; ALL CONTROLS
   DC_HANDLE=19              ; ALL CONTROLS (Except MENUBAR and MENUITEM)
   DC_RVCOLHEAD=20           ; REPORTVIEW
   DC_RVCOLWIDTH=21          ; REPORTVIEW
   DC_RVADDCOL=22            ; REPORTVIEW
   DC_RVREMOVECOL=23         ; REPORTVIEW
   DC_RVMATCHCOL=24          ; REPORTVIEW
   DC_RVCANCELEDIT=25        ; REPORTVIEW
   DC_RVCHECKEDROWS=26       ; REPORTVIEW
   DC_RVJUSTIFY=27           ; REPORTVIEW


   ;DialogObject constants
   DLGOBJECT_ADDEVENT=1      ; Call dialog callback when the specified event occurs
   DLGOBJECT_STOPEVENT=2     ; Stop calling dialog callback when an event previously requested with
   DLGOBJECT_GETOBJECT=3     ; Return an object references to the specified control
   DLGOBJECT_GETPICTURE=4    ; Create and return an object reference to a picture object

   ;Return code constants
   RET_DO_CANCEL=0           ; Cancels dialog
   RET_DO_DEFAULT= -1        ; Continue with default processing for control
   RET_DO_NOT_EXIT= -2       ; Do not exit the dialog
   return
#EndSubroutine
;============================================================
;============================================================
;============================================================





InitDialogConstants()                                       ; Initialize Dialog Constants (need only be done once usually)

#DefineSubroutine CalExampleCallbackProc(CalExample_Handle,CalExample_Message,CalExample_Name,CalExample_EventInfo,CalExample_ChangeInfo)
   ON_EQUAL = @TRUE                                         ; Initialize variable ON_EQUAL
   switch CalExample_Message                                ; Switch based on Dialog Message type
      case MSG_INIT                                         ; Standard Initialization message
         DialogProcOptions(CalExample_Handle,MSG_TIMER,500)
         DialogProcOptions(CalExample_Handle,MSG_BUTTONPUSHED,@TRUE)
;         DialogProcOptions(CalExample_Handle,MSG_CALENDAR,@TRUE)
         hCal2 = DialogControlGet(CalExample_Handle,"Calendar_2",19);Get handle of Calendar control
         CalTitleColour = "255|100|100" ; initial different colour variable
         return(RET_DO_DEFAULT)

     case MSG_TIMER;We set a half second timer above
         CalTitleColour = CalSetColor(hCal2,2,CalTitleColour);Alternates between the previous and the current colours

              return(RET_DO_NOT_EXIT)

     case MSG_BUTTONPUSHED
        If CalExample_Name <> "PushButton_Cancel" Then RGBlist = AskColor("","Select one",1);Select a colour if any button other than Cancel was pushed


        if CalExample_Name == "PushButton_Cancel"      ; Cancel
              return(RET_DO_DEFAULT)

        elseif CalExample_Name == "PushButton_BG"              ; Background

        CalSetColor(hCal2,0,RGBlist)
              return(RET_DO_NOT_EXIT)


        elseif CalExample_Name == "PushButton_Text"        ; Text
        CalSetColor(hCal2,1,RGBlist)
              return(RET_DO_NOT_EXIT)

        elseif CalExample_Name == "PushButton_TBG"         ; Title Background
        CalSetColor(hCal2,2,RGBlist)
              return(RET_DO_NOT_EXIT)

        elseif CalExample_Name == "PushButton_TText"       ; Title Text
        CalSetColor(hCal2,3,RGBlist)
              return(RET_DO_NOT_EXIT)

        elseif CalExample_Name == "PushButton_MBG"         ; Month Background
        CalSetColor(hCal2,4,RGBlist)
              return(RET_DO_NOT_EXIT)

        elseif CalExample_Name == "PushButton_TrailText"   ; Trailing Text
        CalSetColor(hCal2,5,RGBlist)
              return(RET_DO_NOT_EXIT)

        endif                                              ; CalExample_Name
        return(RET_DO_DEFAULT)

;     case MSG_CALENDAR
;        if CalExample_Name == "Calendar_1"                 ; caVariable1
;              return(RET_DO_DEFAULT)

;        elseif CalExample_Name == "Calendar_2"             ; caVariable2
;              return(RET_DO_DEFAULT)

;        endif                                              ; CalExample_Name
;        return(RET_DO_DEFAULT)

   endswitch                                                ; CalExample_Message
   return(RET_DO_DEFAULT)
#EndSubroutine                                              ; End of Dialog Callback CalExampleCallbackProc

;============================================================
;============================================================
;============================================================



CalExampleFormat=`WWWDLGED,6.2`

CalExampleCaption=`DllCall modification of Calendar control`
CalExampleX=002
CalExampleY=035
CalExampleWidth=296
CalExampleHeight=149
CalExampleNumControls=012
CalExampleProcedure=`CalExampleCallbackProc`
CalExampleFont=`DEFAULT`
CalExampleTextColor=`DEFAULT`
CalExampleBackground=`DEFAULT,DEFAULT`
CalExampleConfig=0

CalExample001=`229,025,056,012,PUSHBUTTON,"PushButton_BG",DEFAULT,"Background",1,10,32,DEFAULT,DEFAULT,DEFAULT`
CalExample002=`249,127,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample003=`007,003,100,016,STATICTEXT,"StaticText_1",DEFAULT,"Why are there no options to change colours in a standard Calendar control?",DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample004=`115,005,176,012,STATICTEXT,"StaticText_2",DEFAULT,"With a Dll Call we can do it.. click a button to select and change colours:",DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample005=`007,027,096,084,CALENDAR,"Calendar_1",caVariable1,DEFAULT,DEFAULT,50,DEFAULT,DEFAULT`
CalExample006=`117,027,096,084,CALENDAR,"Calendar_2",caVariable2,DEFAULT,DEFAULT,60,DEFAULT,DEFAULT`
CalExample007=`017,129,190,012,STATICTEXT,"StaticText_3",DEFAULT,"Example of how the colour of a  calendar control can be modified by a DllCall()",DEFAULT,70,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample008=`229,041,056,012,PUSHBUTTON,"PushButton_Text",DEFAULT,"Text",2,80,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample009=`229,057,056,012,PUSHBUTTON,"PushButton_TBG",DEFAULT,"Title Background",3,90,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample010=`229,073,056,012,PUSHBUTTON,"PushButton_TText",DEFAULT,"Title Text",4,100,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample011=`229,089,056,012,PUSHBUTTON,"PushButton_MBG",DEFAULT,"Month Background",5,110,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
CalExample012=`229,105,056,012,PUSHBUTTON,"PushButton_TrailText",DEFAULT,"Trailing Text",6,120,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("CalExample")


Exit
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

mcvpjd3

  • Newbie
  • *
  • Posts: 41
Re: Calendar control - Bold/Color/etc
« Reply #6 on: April 23, 2014, 02:05:12 am »
Brilliant - just what I need - Thanks :-)

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Calendar control - Bold/Color/etc
« Reply #7 on: April 23, 2014, 07:19:30 am »
IFICantBYTE, Thanks for sharing!
Deana F.
Technical Support
Wilson WindowWare Inc.