DateTimePicker
DateTimePicker
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.
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
Re: DateTimePicker
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.
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!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
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.
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
Re: DateTimePicker
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?
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!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
Yes! That would be great.
But "Value" should be to set to Null, not Empty.
In VB this should be True:
Thanks a lot.
But "Value" should be to set to Null, not Empty.
In VB this should be True:
Code: Select all
VarType(DTPicker1.Value) = VbVarType.vbNull
ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
Re: DateTimePicker
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 973 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
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
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
Re: DateTimePicker
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.
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!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
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 961 times
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
Hi,
great job!
It works fantastic!
Thanks!
great job!
It works fantastic!
Thanks!
ButtonControls 1.4 Unicode
EditControls 1.4 Unicode
DateTimeControls 1.1 Unicode
Statusbar 1.2 Unicode
Re: DateTimePicker
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?
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?
Re: DateTimePicker
Thanks.jadranko wrote:You did very good job.
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: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.
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.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.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
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.
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.
Re: DateTimePicker
Hi,
I can reproduce this behavior. Looks like Microsoft messed up the API documentation. I'll provide a fix.
TiKu
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!
Boycott DRM! Boycott HDCP!
Re: DateTimePicker
Version 1.3.1 has been released, it fixes the problem.
Regards
TiKu
Regards
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Boycott DRM! Boycott HDCP!