Re: Month Calendar control: make dates bold? Notification delay in Win32Lib?
- Posted by Jonas Temple <jtemple at yhti.net> Feb 23, 2005
- 566 views
danielmoyer wrote: > > > Thanks Jonas, > > I've used the SetSelectedDate() in Win32Lib to move the date around > programmatically, but what I'm trying to do is not *set* the date, (as in > make the calendar show that date with an ellipse around it), but rather make > specified dates show up in bold print (so as to specify "something special" > about those dates). > > I copied a bunch of stuff like what you suggested above from the MS site, > including "Processing the MCN_GETDAYSTATE Notification Message", and > "MCN_GETDAYSTATE Notification ", "NMDAYSTATE Structure", "NMHDR Structure ", > "SYSTEMTIME structure", etc, but I don't know how to translate it all (or > even your simpler suggestion) into Euphoria code. > > Probably this is something that could/should be added to Win32Lib? > > But in the meantime, any help from anyone in xlating the C stuff into > Euphoria would be appreciated. > > Dan > Dan, I've been trying desperately to come up with a working example of using either MCM_SETDAYSTATE or MCN_GETDAYSTATE. I can't figure out MCM_SETDAYSTATE. But in reality, would you really want to set that many days states at one time (for multiple months)? I think the better solution is to use (as you said) MCN_GETDAYSTATE. First thing, your calendar control will need to have the MCS_DAYSTATE style. Then, you would need to code a notification routine for the MCN_GETDAYSTATE:
-------------------------------------------------------------------------------- -- Set day state function CalendarCC_onDayState(integer id, atom hWnd, atom wParam, atom lParam) atom hwndFrom, idFrom, code, cDayState, daystates, year, month, dayofweek, day, hour, minute, second, millisecond trace(1) -- Get the structure data hwndFrom = peek4u(lParam) idFrom = peek4u(lParam+4) code = peek4u(lParam+8) year = peek2u(lParam+12) month = peek2u(lParam+14) dayofweek = peek2u(lParam+16) day = peek2u(lParam+18) hour = peek2u(lParam+20) minute = peek2u(lParam+22) second = peek2u(lParam+24) cDayState = peek4u(lParam+26) daystates = peek4u(lParam+30) return kReturnNow end function void = setNotifyHandler(MCN_GETDAYSTATE, routine_id("CalendarCC_onDayState"))
Now, you're probably saying "Where's the rest of the routine"? Well I coded the above just to make sure I was receiving the notification. The first thing I noticed was that when the calendar control is initially displayed my program receives no MCN_GETDAYSTATE notification. I'm not sure if this means Windows assumes you used MCM_SETDAYSTATE for the initial calendar or not. When I change the month then I do get MCN_GETDAYSTATE but the year, month and day values are for the previous month displayed, not the new month being displayed. It's like the notification is an "after" notification, not a "before". So the long of the short is, I'm still working on an example. If anyone knows why the delay of notification is happening then that would be great. BTW, this example uses words.e by Bernie Ryan. Jonas Temple http://www.yhti.net/~jktemple