View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006067 | JEDI VCL | 00 JVCL Components | public | 2013-01-19 08:42 | 2015-09-14 13:20 |
Reporter | tetardd | Assigned To | obones | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.47 | ||||
Target Version | Fixed in Version | 3.48 | |||
Summary | 0006067: TJvDateTimePicker causes Exception when using NullDate | ||||
Description | The following code (with a form with a simple TJvDateTimePicker and a TBUtton) causes an Exception (cannot set the date) when the button is clicked: ********************************************************** unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, JvExComCtrls, JvDateTimePicker; type TForm22 = class(TForm) id_ExpEndDate: TJvDateTimePicker; Button1: TButton; procedure FormCreate(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form22: TForm22; implementation {$R *.dfm} procedure TForm22.FormCreate(Sender: TObject); begin id_ExpEndDate.NullText := 'No date selected'; id_ExpEndDate.NullDate := 0.0; id_ExpEndDate.MinDate := Date; id_ExpEndDate.DropDownDate := Date; end; procedure TForm22.Button1Click(Sender: TObject); begin id_ExpEndDate.Date := id_ExpEndDate.NullDate; end; ************************************ This is the code that I propose should be changed in TJvDateTimePicker: function TJvDateTimePicker.MsgSetDateTime(Value: TSystemTime): Boolean; var LNullText: string; begin Result := inherited MsgSetDateTime(Value); (* Initial code: This is wrong because if the VCL's MsgSetDateTime reports an error, we will have an exception, and because the VCL's code does not know about NullDate, it will report an error. if FMsgSetDateTimeEmptyNullText then LNullText := '' else LNullText := FNullText; CheckNullValue(LNullText, Format, Kind, SystemTimeToDateTime(Value), NullDate); *) // Proposed changes by David Tetard: if not Result then begin if FMsgSetDateTimeEmptyNullText then LNullText := '' else LNullText := FNullText; Result := CheckNullValue(LNullText, Format, Kind, SystemTimeToDateTime(Value), NullDate); end; end; | ||||
Tags | No tags attached. | ||||
2013-01-22 17:27
|
JvDateTimePicker.pas (13,207 bytes) |
|
After some more testing, my solution was not entirely satisfactory. My last attachment is yet another proposed fix (see changed in code by looking for "Tetard"). |
|
This is now fixed in GIT |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-01-19 08:42 | tetardd | New Issue | |
2013-01-22 17:27 | tetardd | File Added: JvDateTimePicker.pas | |
2013-01-22 17:28 | tetardd | Note Added: 0020412 | |
2013-12-13 10:40 | obones | Status | new => acknowledged |
2013-12-13 12:15 | obones | Note Added: 0020808 | |
2013-12-13 12:15 | obones | Status | acknowledged => resolved |
2013-12-13 12:15 | obones | Fixed in Version | => Daily / GIT |
2013-12-13 12:15 | obones | Resolution | open => fixed |
2013-12-13 12:15 | obones | Assigned To | => obones |
2015-09-14 13:20 | obones | Fixed in Version | Daily / GIT => 3.48 |