Re: [Win32Lib] Month Control "fires" on its own??

new topic     » goto parent     » topic index » view thread      » older message » newer message

danielmoyer wrote:
> 
> I'm playing with the month control, and I have an "on change it" event get &
> write the date on a label; but I also allow the user to cause something else
> to write onto that label, (which I want to stay there until user does
> something to remove it), but for some reason the on change month control
> event seems to fire & re-write the date there, when the program is just
> "sitting there" doing nothing.
> 
> Anyone know what's going on & how to stop it?

I confirm your observations, but I don't know what is causing it. I suspect
it is WIndows updating the underlying MonthCalendar control and that is
triggering an implicit date selection event.

Anyhow, the way to work with this is to check the length of the 'params'
parameter in your event handler. If this is zero, then it is an
implicit date selection (e.g. The Next/Prev month was pressed). If 
the length is 2 then it is an explicit user selection.

procedure MonthCalendar2_onChange (integer self, integer event, sequence
 params)
    object aDate
    if length(params) > 0 then
      aDate = getSelectedDate(MonthCalendar2)
      setText(LText3, formatDate(aDate, LongDate))
    end if
 end procedure


-- 
Derek Parnell
Melbourne, Australia
irc://irc.sorcery.net:9000/euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu