Max tracker jumps to available max when click to min picker (DateTimeRangeTracker)

Jan 15, 2013 at 6:26 AM

Hello

I choose the available range from 1. July 2012 to 1. August 2012 using the test project 'TestDateTimeRangeTrackBar'. Then I choose a range between available min/max using the trackers. Then I click to the min (left) DateTimePicker. Now the max (right) tracker jumps to the end.

This issue doesn't exist when I choose a larger available range.

What's the problem? Can anyone help me?

Thanks, Bernhard

 

 

Jan 16, 2013 at 3:57 AM

Bernhard:

I had never noticed that before.

I investigated the problem using a simple Windows Forms application that had nothing to do with NodeXL, and I found some odd behavior on the part of the DateTimePicker control that is used internally by the DateTimeRangeTrackBar.  Here is what I did:

1. Create an empty Windows Forms application.

2. Drop a DateTimePicker control onto the form.

3. Set the MinDate and MaxDate properties to 7/1/2012 and 8/1/2012, respectively.

4. Handle the ValueChanged event by writing the Value property to Debug.WriteLine().  (The DateTimeRangeTracker uses this event to make adjustments to its range.)

5. Run the program.

6. Manually change the date in the control to 7/1/2012.  The ValueChanged event fires with a Value property of 7/1/2012, as expected.

7. Manually open the control's calendar.  The ValueChanged event fires twice, once with a Value property of 8/1/2012 (completely unexpected, and wrong) and again with a Value of 7/1/2012, which is correct.

I suspect this is a bug in the DateTimePicker.  In any case, the DateTimeRangeTrackBar responds to the first ValueChanged event, the one with the incorrect Value, by adjusting its range incorrectly.  And that's the problem you're seeing.

I don't have an immediate fix for this, although I've recorded it as a bug.  If you need it fixed immediately, please note that the source code is included in the download.

Thanks for letting us know about this.

-- Tony

Jan 16, 2013 at 10:09 AM

Hi Tony

Thanks for your reply!

I also think that's an issue of the DateTimePicker.

I try to fix it myself with ignoring the first 'phantom' event or like that.

 

Kind regards, Bernhard