1. [WIN] MonthCalendar Control: getSelected, how?
- Posted by DanMoyer at PRODIGY.NET Aug 02, 2001
- 561 views
In trying to use the MonthCalendar control, I was thinking I could get info about which date was user clicked on by using "SelectedDate = getSelectedDate( MonthCalendar2 )", by putting it in an "onChange[MonthCalendar2]" event routine, but it doesn't seem to work. Is that wrong approach?? (I tried putting it in "onClick", too, but that didn't work for me either.) Below is full test code. Dan Moyer -- code generated by Win32Lib IDE v0.10.5 include Win32Lib.ew without warning ---- -- Window Window1 global constant Window1 = create( Window, "Window1", 0, Default, Default, 592, 301, 0 ) global constant MonthCalendar2 = create( MonthCalendar, "MonthCalendar2", Window1, 4, 4, 250, 200, 0 ) global constant MleText3 = create( MleText, "MleText3", Window1, 272, 8, 304, 196, 0 ) ---- -- variable structures for dated notes: sequence CalendarDates, CalendarNotes CalendarDates = {} CalendarNotes = {} ---- procedure Window1_onOpen () setText( MleText3, "beginning" ) -- test to see it written end procedure onOpen[Window1] = routine_id("Window1_onOpen") ---- procedure MonthCalendar2_onChange () sequence SelectedDate integer DateInfoLocation SelectedDate = getSelectedDate( MonthCalendar2 ) DateInfoLocation = find(SelectedDate, CalendarDates) if DateInfoLocation then wPuts( MleText3, CalendarNotes[DateInfoLocation] ) else setText( MleText3, "nothing" ) wPuts( MleText3, "nothing") -- tried first end if end procedure onChange[MonthCalendar2] = routine_id("MonthCalendar2_onChange") ---- WinMain( Window1, Normal )
2. Re: [WIN] MonthCalendar Control: getSelected, how?
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 03, 2001
- 486 views
There is a bug in the notification handler for Calendars. To fix it, find the function "fDoMCN_SELCHANGE" and insert this line as the first line in the function. id = getId( fetch(lParam, NMHDR_hwndFrom ) ) ----- Original Message ----- From: <DanMoyer at PRODIGY.NET> To: "EUforum" <EUforum at topica.com> Subject: [WIN] MonthCalendar Control: getSelected, how? > > In trying to use the MonthCalendar control, I was thinking I could get info > about which date was user clicked on by using "SelectedDate = > getSelectedDate( MonthCalendar2 )", by putting it in an > "onChange[MonthCalendar2]" event routine, but it doesn't seem to work. Is > that wrong approach?? (I tried putting it in "onClick", too, but that > didn't work for me either.) > > Below is full test code. > > Dan Moyer > > -- code generated by Win32Lib IDE v0.10.5 > > include Win32Lib.ew > without warning > > ---- > -- Window Window1 > global constant Window1 = create( Window, "Window1", 0, Default, Default, > 592, 301, 0 ) > global constant MonthCalendar2 = create( MonthCalendar, "MonthCalendar2", > Window1, 4, 4, 250, 200, 0 ) > global constant MleText3 = create( MleText, "MleText3", Window1, 272, 8, > 304, 196, 0 ) > ---- > -- variable structures for dated notes: > sequence CalendarDates, CalendarNotes > CalendarDates = {} > CalendarNotes = {} > ---- > procedure Window1_onOpen () > setText( MleText3, "beginning" ) -- test to see it written > end procedure > onOpen[Window1] = routine_id("Window1_onOpen") > > ---- > procedure MonthCalendar2_onChange () > sequence SelectedDate > integer DateInfoLocation > > SelectedDate = getSelectedDate( MonthCalendar2 ) > DateInfoLocation = find(SelectedDate, CalendarDates) > if DateInfoLocation then > wPuts( MleText3, CalendarNotes[DateInfoLocation] ) > else > setText( MleText3, "nothing" ) > wPuts( MleText3, "nothing") -- tried first > end if > end procedure > onChange[MonthCalendar2] = routine_id("MonthCalendar2_onChange") > > ---- > > WinMain( Window1, Normal ) > > > > >
3. Re: [WIN] MonthCalendar Control: getSelected, how?
- Posted by DanMoyer at PRODIGY.NET Aug 03, 2001
- 516 views
Derek, Thanks, I presume that will be fixed in some new version. And was I right to try to use "onChange" to pickup selection? Dan ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: [WIN] MonthCalendar Control: getSelected, how? > > There is a bug in the notification handler for Calendars. > > To fix it, find the function "fDoMCN_SELCHANGE" and insert this line as the > first line in the function. > > id = getId( fetch(lParam, NMHDR_hwndFrom ) ) > > > ----- Original Message ----- > From: <DanMoyer at PRODIGY.NET> > To: "EUforum" <EUforum at topica.com> > Sent: Friday, August 03, 2001 7:57 AM > Subject: [WIN] MonthCalendar Control: getSelected, how? > > > > > > In trying to use the MonthCalendar control, I was thinking I could get > info > > about which date was user clicked on by using "SelectedDate = > > getSelectedDate( MonthCalendar2 )", by putting it in an > > "onChange[MonthCalendar2]" event routine, but it doesn't seem to work. Is > > that wrong approach?? (I tried putting it in "onClick", too, but that > > didn't work for me either.) > > > > Below is full test code. > > > > Dan Moyer > > <snip>
4. Re: [WIN] MonthCalendar Control: getSelected, how?
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 03, 2001
- 469 views
Hi Dan, ----- Original Message ----- From: <DanMoyer at PRODIGY.NET> To: "EUforum" <EUforum at topica.com> Subject: Re: [WIN] MonthCalendar Control: getSelected, how? > Thanks, I presume that will be fixed in some new version. And was I right > to try to use "onChange" to pickup selection? Yes, this has been fixed in future versions. You will be able to also use onClick in the new version. The difference is that onClick only fires when a specific date has been 'clicked' where the onChange fires for explicit clicks AND also month-button clicks. ---------- Derek
5. Re: [WIN] MonthCalendar Control: getSelected, how?
- Posted by DanMoyer at PRODIGY.NET Aug 04, 2001
- 452 views
----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> > > Hi Dan, > > ----- Original Message ----- > From: <DanMoyer at PRODIGY.NET> > > > > Thanks, I presume that will be fixed in some new version. And was I right > > to try to use "onChange" to pickup selection? > > Yes, this has been fixed in future versions. > > You will be able to also use onClick in the new version. The difference is > that onClick only fires when a specific date has been 'clicked' where the > onChange fires for explicit clicks AND also month-button clicks. > Thats's a nice touch! > > ---------- > Derek > > > > >