Calendar back/forward buttons
Calendar back/forward buttons
Is there a way to know if the user clicks the back/forward buttons in the CalendarGadget to go back/forward a month?
-
- Enthusiast
- Posts: 665
- Joined: Fri Sep 12, 2003 10:40 pm
- Location: Tallahassee, Florida
http://msdn.microsoft.com/library/defau ... ittest.asp
http://msdn.microsoft.com/library/defau ... stinfo.asp
http://msdn.microsoft.com/library/defau ... ittest.asp
what you have to do is look for a left click, send the hit test message with the point you get from where the mouse is.
http://msdn.microsoft.com/library/defau ... stinfo.asp
http://msdn.microsoft.com/library/defau ... ittest.asp
Members
cbSize
Size of this structure, in bytes.
pt
POINT structure that contains information about the point to be hit-tested.
uHit
Output member that receives a bit flag representing the result of the hit-test operation. This value will be one of the following:
MCHT_CALENDARBK
The given point was in the calendar's background.
MCHT_CALENDARDATE
The given point was on a particular date within the calendar. The SYSTEMTIME structure at lpMCHitTest>st is set to the date at the given point.
MCHT_CALENDARDATENEXT
The given point was over a date from the next month (partially displayed at the end of the currently displayed month). If the user clicks here, the month calendar will scroll its display to the next month or set of months.
MCHT_CALENDARDATEPREV
The given point was over a date from the previous month (partially displayed at the end of the currently displayed month). If the user clicks here, the month calendar will scroll its display to the previous month or set of months.
MCHT_CALENDARDAY
The given point was over a day abbreviation ("Fri", for example). The SYSTEMTIME structure at lpMCHitTest>st is set to the corresponding date in the top row.
MCHT_CALENDARWEEKNUM
The given point was over a week number (MCS_WEEKNUMBERS style only). The SYSTEMTIME structure at lpMCHitTest>st is set to the corresponding date in the leftmost column.
MCHT_NOWHERE
The given point was not on the month calendar control, or it was in an inactive portion of the control.
MCHT_TITLEBK
The given point was over the background of a month's title.
MCHT_TITLEBTNNEXT
The given point was over the button at the top right corner of the control. If the user clicks here, the month calendar will scroll its display to the next month or set of months.
MCHT_TITLEBTNPREV
The given point was over the button at the top left corner of the control. If the user clicks here, the month calendar will scroll its display to the previous month or set of months.
MCHT_TITLEMONTH
The given point was in a month's title bar, over a month name.
MCHT_TITLEYEAR
The given point was in a month's title bar, over the year value.
st
SYSTEMTIME structure that receives date and time information specific to the location that was hit-tested.
what you have to do is look for a left click, send the hit test message with the point you get from where the mouse is.
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
Here is some PB4 Beta3 code...
Code: Select all
#MCHT_TITLE = $10000
#MCHT_NEXT = $1000000
#MCHT_PREV = $2000000
#MCHT_TITLEBTNPREV = #MCHT_TITLE | #MCHT_PREV | 3
#MCHT_TITLEBTNNEXT = #MCHT_TITLE | #MCHT_NEXT | 3
#MCM_HITTEST = #MCM_FIRST + 14
Structure _MCHITTESTINFO
cbSize.l
pt.POINT
uHIt.l
st.SYSTEMTIME
EndStructure
mcht._MCHITTESTINFO\cbSize = SizeOf(_MCHITTESTINFO)
If OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered,"CalendarGadget Hit Test") And CreateGadgetList(WindowID(0))
CalendarGadget(1, 50, 20, 200, 180)
TextGadget(2, 10, 230, 200, 25, "")
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget And EventGadget() = 1
SetGadgetText(2, "")
; --> Get mouse location
mcht\pt\x = DesktopMouseX()
mcht\pt\y = DesktopMouseY()
; --> Convert mouse location to CalendarGadget coordinates
ScreenToClient_(GadgetID(1), @mcht\pt)
SendMessage_(GadgetID(1), #MCM_HITTEST, 0, @mcht)
Select mcht\uHit
Case #MCHT_TITLEBTNNEXT
SetGadgetText(2, "Calendar last changed by button Next")
Case #MCHT_TITLEBTNPREV
SetGadgetText(2, "Calendar last changed by button Previous")
EndSelect
EndIf
Until event = #PB_Event_CloseWindow
EndIf
End
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
I have nothing to do today, so here is the above code in PB3.94
Code: Select all
#MCHT_TITLE = $10000
#MCHT_NEXT = $1000000
#MCHT_PREV = $2000000
#MCHT_TITLEBTNPREV = #MCHT_TITLE | #MCHT_PREV | 3
#MCHT_TITLEBTNNEXT = #MCHT_TITLE | #MCHT_NEXT | 3
#MCM_HITTEST = $1000 + 14
Structure _MCHITTESTINFO
cbSize.l
pt.POINT
uHIt.l
st.SYSTEMTIME
EndStructure
mcht._MCHITTESTINFO\cbSize = SizeOf(_MCHITTESTINFO)
If OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered,"CalendarGadget Hit Test") And CreateGadgetList(WindowID(0))
CalendarGadget(1, 50, 20, 200, 180)
TextGadget(2, 10, 230, 200, 25, "")
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget And EventGadgetID() = 1
SetGadgetText(2, "")
; --> Get mouse location
mcht\pt\x = DesktopMouseX()
mcht\pt\y = DesktopMouseY()
; --> Convert mouse location to CalendarGadget coordinates
ScreenToClient_(GadgetID(1), @mcht\pt)
SendMessage_(GadgetID(1), #MCM_HITTEST, 0, @mcht)
Select mcht\uHit
Case #MCHT_TITLEBTNNEXT
SetGadgetText(2, "Calendar last changed by button Next")
Case #MCHT_TITLEBTNPREV
SetGadgetText(2, "Calendar last changed by button Previous")
EndSelect
EndIf
Until event = #PB_Event_CloseWindow
EndIf
End