1. [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 )

new topic     » topic index » view message » categorize

2. 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>
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 )
>
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: [WIN] MonthCalendar Control: getSelected, how?

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>

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN] MonthCalendar Control: getSelected, how?

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: [WIN] MonthCalendar Control: getSelected, how?

----- 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
>
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu