DateTimePicker

The place for threads about TimoSoft DateTimeControls.
User avatar
itmg
Lieutenant
Posts: 13
Joined: 14 Jul 2009, 12:04

DateTimePicker

Post by itmg »

Hi,

when setting "CurrentDate = Null" I'm getting a run time error 94.
Do it only support a numeric 0 value, to show that's no date set?
The DateTime datafield in the sql server table, which the datetimepicker is accessing, have a null value (NULL), but the control shows #12/31/1899#.
I thought the behaviour of the control is identical with the DateTimePicker from Microsoft.

ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

I assume you have set AllowNullSelection set to True?
Nevertheless, I see what you mean. Microsoft has chosen the data type Variant for the Value property, so this property can be set to Empty (I guess this is what the NULL value gets translated to) and Empty means "no date selected". I have chosen the data type Date for the CurrentDate property, so this property cannot be set to Empty. To remove the check mark, the property "DateSelected" must be set to False. I did not think about data binding or better: I did not think about the situation that the database field that is bound to the CurrentDate property, contains NULL values.

Changing the type of the CurrentDate property cannot be done without breaking compatibility. The only thing I could do, is to add a new property of type Variant that can be used alternatively. Having two properties for the same task is no good design, but it's the only thing I could do.
Let me know whether you really need such a new property.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
itmg
Lieutenant
Posts: 13
Joined: 14 Jul 2009, 12:04

Re: DateTimePicker

Post by itmg »

When you adding a new property of type Variant, would it be used for databinding instead of the "currentDate" property.
The control must show a real NULL value and it must be able to set a real NULL value.

ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

This new property (let's call it "Value") could be used as a replacement for the "CurrentDate" and "DateSelected" properties. If "Value" was set to a Date value, the control would behave as if "DateSelected" was set to "True" and "CurrentDate" was set to the Date value. If "Value" was set to "Empty" (I assume this is what the NULL value gets translated to by COM), the control would behave as if "DateSelected" was set to "False".
The "Value" property would be supported for data binding, yes.

This is the behavior you need, right?
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
itmg
Lieutenant
Posts: 13
Joined: 14 Jul 2009, 12:04

Re: DateTimePicker

Post by itmg »

Yes! That would be great.
But "Value" should be to set to Null, not Empty.
In VB this should be True:

Code: Select all

VarType(DTPicker1.Value) = VbVarType.vbNull
Thanks a lot.

ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

Please have a look at the attached build of DateTimeControls. The DateTimePicker control now has a Value property that should behave exactly as described in this thread.
Attachments
DTCtls11075-Release.zip
DateTimeControls 1.1.0.75 Pre-Release
(196.04 KiB) Downloaded 540 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
itmg
Lieutenant
Posts: 13
Joined: 14 Jul 2009, 12:04

Re: DateTimePicker

Post by itmg »

Hi

I've tested it.
In the data binding dialog I can set the datasource and datafield for the bound property "value".
Wouldn't it be nicer the user can choose the default bound property? May be with an extra enum property.

During run time it's impossible to change the right data binding. The control binds "CurrentDate", always.

Best regards

ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

Currently the CurrentDate property is defined as default bound property. This is done by setting an IDL attribute (defaultbind) for this property. My knowledge about data binding is very limited, but I wouldn't expect that setting the defaultbind attribute prevents any other bindable property from being bound.
I'll remove the defaultbind attribute from the CurrentDate property (I hope this won't break binary compatibility). Maybe this helps.

I'll post a new build this evening.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

I've removed the defaultbind attribute from the "CurrentDate" property and set it for the "Value" property. I hope it will work now (can't test it myself here).
Attachments
DTCtls11075-Release.zip
DateTimeControls 1.1.0.75 Pre-Release
(198.6 KiB) Downloaded 536 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
itmg
Lieutenant
Posts: 13
Joined: 14 Jul 2009, 12:04

Re: DateTimePicker

Post by itmg »

Hi,
great job!
It works fantastic!
Thanks!

ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
jadranko
Cadet
Posts: 1
Joined: 10 Jan 2010, 21:17

Re: DateTimePicker

Post by jadranko »

Dear,

You did very good job.
However, I have to ask you one favor. If you have noticed, a lot of people search for datetime picker control that can be nullable and it is main reason why they don’t like MS DTPicker control. That means user has to be capable to delete value of date inside of control. Control in that case must show empty string instead of dimmed date. Deletion could be done either by pressing delete key till focus is inside of control or selecting check box (if property “CheckBox” is “True”). Dimmed valued of date is confusing users and sometime they are not aware that date is not selected.
Also, I suggest to have additional option for "Style" property that would cover both existing styles because sometimes user want to change date just for few days and sometimes they like to pick a date, thus both up-down and drop-down possibilities have to be present in the same time.

Is it possible to do that?
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

jadranko wrote:You did very good job.
Thanks.
jadranko wrote:However, I have to ask you one favor. If you have noticed, a lot of people search for datetime picker control that can be nullable and it is main reason why they don’t like MS DTPicker control. That means user has to be capable to delete value of date inside of control. Control in that case must show empty string instead of dimmed date. Deletion could be done either by pressing delete key till focus is inside of control or selecting check box (if property “CheckBox” is “True”). Dimmed valued of date is confusing users and sometime they are not aware that date is not selected.
My controls are based on the native Windows controls. Unfortunately the native date time picker control doesn't support this and I cannot think a reliable way how to provide such a feature without native support.
jadranko wrote:Also, I suggest to have additional option for "Style" property that would cover both existing styles because sometimes user want to change date just for few days and sometimes they like to pick a date, thus both up-down and drop-down possibilities have to be present in the same time.
Same here. It would be possible to display an up-down button next to the actual control, but this would look ugly. If you really need this, it's easy to implement it on your own. Just create a composited control that consists of my control and an up-down control and add a bit of logic to connect them.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
TISP
Cadet
Posts: 2
Joined: 22 Apr 2012, 14:26

Re: DateTimePicker

Post by TISP »

When setting the maxdate property, also the mindate property is set to 14-9-1752.
When setting the mindate property, also the maxdate property is set to 31-12-9999.
Would it be possible to leave the maxdate property unchanged when setting the mindate an to leave the mindate property unchanged when setting the maxdate? (As in the original date picker)

Many thanks in advance.
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

Hi,

I can reproduce this behavior. Looks like Microsoft messed up the API documentation. I'll provide a fix.

TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: DateTimePicker

Post by TiKu »

Version 1.3.1 has been released, it fixes the problem.

Regards
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply