I use the DateTimeChangedListener in DateControl.
When I use the mouse in the calendar I always get two events instead of one.
Using the keyboard gives no problem.
Is this normal?
I made a workaround which seems ok, but I am not sure about it.
Our own programs uses another (home made) date control, so we don't really have large experience with the standard .
However searching the Internet seems to show that you are not the only one with such problems (and I can also reproduce it).
Regarding your work-around, why not just do something when the time is different from the previous one (i.e. rather than toggling between erroneous and valid):
facts
previousGmtTimeValue :gmtTimeValue:=0. % zero will serve well as an initial valuepredicates
onDateControlDateTimeChanged :dateControl::dateTimeChangedListener.
clauses
onDateControlDateTimeChanged(_Source):-T= dateControl_ctl:gmtTimeValue,if previousGmtTimeValue <>Tthen
stdio::write(T,"\n")end if,
previousGmtTimeValue :=T.
I used my solution because I am not absolutely sure that two timevalues for one event are ALWAYS equal.
Because - according to the helpfile - GMT-based date/time information is stored in gmtTime type objects with 100-nanosecond precision.
Is there one object used twice? Or two objects and could they have different values?
Perhaps I am seeing a ghost, but if it happens that they are unequal then your code-suggestion could give problems.
Because the two work-arounds have a different meaning:
Your solution says: act if there is a time-difference.
My solution says: act if we are here for the first time in this event.