Anonymous | Login | Signup for a new account | 2019-02-21 03:49 CET |
Main | My View | View Issues | Change Log | Roadmap | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||
0006067 | [JEDI VCL] 00 JVCL Components | major | always | 2013-01-19 08:42 | 2015-09-14 13:20 | ||
Reporter | tetardd | View Status | public | ||||
Assigned To | obones | ||||||
Priority | normal | Resolution | fixed | ||||
Status | resolved | Product Version | 3.47 | ||||
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; |
||||||
Additional Information | |||||||
Tags | No tags attached. | ||||||
Attached Files |
![]() |
||||||
|
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |