Clear all bold dates in CalendarGadget?

Just starting out? Need help? Post your questions and find answers here.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Clear all bold dates in CalendarGadget?

Post by Dude »

I have a CalendarGadget which sets dates as bold that are read from a list. However, I'd like to "reset" the Calendar by clearing all bold dates later.

SetGadgetItemState() only clears specific dates, but it used to clear the entire CalendarGadget() of bold dates in older versions of PureBasic; so there must be some quick API way to bulk-remove them without freeing and recreating the gadget? Recreating means I lose the current view of the user (even more so when the gadget shows multiple months). MSDN says to use RemoveAllBoldedDates() but that isn't an API call that I can find?

[Edit] Okay, I came up with the following, which is pretty much instant, but still... :?

Code: Select all

Procedure ClearAllBoldCalendarDates(gad)
  first=Date(1970,1,1,0,0,0)
  last=Date(2038,1,19,3,14,7)
  For d=first To last Step 86400
    SetGadgetItemState(gad,d,#PB_Calendar_Normal)
  Next
EndProcedure