View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001922 | JEDI VCL | 03 Donations | public | 2004-07-03 04:26 | 2004-09-03 06:39 |
Reporter | tlsi2000 | Assigned To | remkobonte | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0001922: Suggestions for TJvDateTimePicker and TJvDBDateTimePicker | ||||
Description | Suggestions for TJvDateTimePicker and TJvDBDateTimePicker For those of us who didn't have anything else to do, I needed some changes to these controls to fix some issues that I was having. These are by no means a final solution, but are submitted to provide some support for others who are more in tune with the official version of this code. In order to add to the capabilities of these controls, the following are submitted as suggestions, but can only be considered a 'work in progress'. | ||||
Additional Information | 1) fixes 'must be in showcheckbox mode' errors for database usage 2) fixes non-editing response for first up/down click on control 3) fixes disabled control when value becomes equal to NullDate during editing | ||||
Tags | No tags attached. | ||||
2004-07-03 04:26
|
JvDateTimePicker.txt (3,192 bytes)
Suggestions for TJvDateTimePicker and TJvDBDateTimePicker For those of us who didn't have anything else to do, I needed some changes to these controls to fix some issues that I was having. These are by no means a final solution, but are submitted to provide some support for others who are more in tune with the official version of this code. In order to add to the capabilities of these controls, the following are submitted as suggestions, but can only be considered a 'work in progress'. //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes 'must be in showcheckbox mode' errors for database usage // notes: // sets default (arbitrary) date/time part for 'other' part DB field // (date or time) to make the working value non-zero // does not fix when DB field value is both 'date AND time', // and happens to be null or equal to the NullDate value // add 'FDKeepDate: TDateTime' in private section of class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.DataChange(Sender: TObject); begin if FDataLink.Field <> nil then begin if Kind = dtkDate then begin if IsDateAndTimeField then DateTime := FDataLink.Field.AsDateTime else // changed line DateTime := Trunc(FDataLink.Field.AsDateTime) + EncodeTime(12, 0, 0, 0); end else begin if IsDateAndTimeField then begin // added/changed lines DateTime := FDataLink.Field.AsDateTime; FKeepDate := Trunc(DateTime); DateTime := Trunc(Now) + Frac(DateTime); end else DateTime := Trunc(Now) + Frac(FDataLink.Field.AsDateTime); end; end else if csDesigning in ComponentState then begin DateTime := Now; end; CheckNullValue; end; //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes non-editing response for first up/down click on control // notes: // added 'CNNotify' to class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.CNNotify(var Msg: TWMNotify); begin with Msg, NMHdr^ do case code of MCN_LAST: begin FDataLink.Edit; end; end; inherited; end; //----------------------------------------------------------------- // TJvDateTimePicker // fixes disabled control when value becomes equal to NullDate during editing // notes: // removes null text for duration of editing // add 'FDKeepNullText: String' in private section of class //----------------------------------------------------------------- procedure TJvDateTimePicker.CNNotify(var Msg: TWMNotify); ... begin with Msg, NMHdr^ do case code of ... // added lines NM_SETFOCUS: begin FKeepNullText := NullText; NullText := ''; inherited; end; NM_KILLFOCUS: begin NullText := FKeepNullText; inherited; end; ... else inherited; end; end; |
2004-07-03 04:28
|
JvDateTimePicker.txt (3,192 bytes)
Suggestions for TJvDateTimePicker and TJvDBDateTimePicker For those of us who didn't have anything else to do, I needed some changes to these controls to fix some issues that I was having. These are by no means a final solution, but are submitted to provide some support for others who are more in tune with the official version of this code. In order to add to the capabilities of these controls, the following are submitted as suggestions, but can only be considered a 'work in progress'. //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes 'must be in showcheckbox mode' errors for database usage // notes: // sets default (arbitrary) date/time part for 'other' part DB field // (date or time) to make the working value non-zero // does not fix when DB field value is both 'date AND time', // and happens to be null or equal to the NullDate value // add 'FDKeepDate: TDateTime' in private section of class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.DataChange(Sender: TObject); begin if FDataLink.Field <> nil then begin if Kind = dtkDate then begin if IsDateAndTimeField then DateTime := FDataLink.Field.AsDateTime else // changed line DateTime := Trunc(FDataLink.Field.AsDateTime) + EncodeTime(12, 0, 0, 0); end else begin if IsDateAndTimeField then begin // added/changed lines DateTime := FDataLink.Field.AsDateTime; FKeepDate := Trunc(DateTime); DateTime := Trunc(Now) + Frac(DateTime); end else DateTime := Trunc(Now) + Frac(FDataLink.Field.AsDateTime); end; end else if csDesigning in ComponentState then begin DateTime := Now; end; CheckNullValue; end; //----------------------------------------------------------------- // TJvDBDateTimePicker // fixes non-editing response for first up/down click on control // notes: // added 'CNNotify' to class //----------------------------------------------------------------- procedure TJvDBDateTimePicker.CNNotify(var Msg: TWMNotify); begin with Msg, NMHdr^ do case code of MCN_LAST: begin FDataLink.Edit; end; end; inherited; end; //----------------------------------------------------------------- // TJvDateTimePicker // fixes disabled control when value becomes equal to NullDate during editing // notes: // removes null text for duration of editing // add 'FDKeepNullText: String' in private section of class //----------------------------------------------------------------- procedure TJvDateTimePicker.CNNotify(var Msg: TWMNotify); ... begin with Msg, NMHdr^ do case code of ... // added lines NM_SETFOCUS: begin FKeepNullText := NullText; NullText := ''; inherited; end; NM_KILLFOCUS: begin NullText := FKeepNullText; inherited; end; ... else inherited; end; end; |
|
2) fixed in CVS 3) fixed in CVS |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-07-03 04:26 | tlsi2000 | New Issue | |
2004-07-03 04:26 | tlsi2000 | File Added: JvDateTimePicker.txt | |
2004-07-03 04:28 | tlsi2000 | File Added: JvDateTimePicker.txt | |
2004-08-24 10:23 | remkobonte | Status | new => assigned |
2004-08-24 10:23 | remkobonte | Assigned To | => remkobonte |
2004-09-03 06:39 | AHUser | Status | assigned => resolved |
2004-09-03 06:39 | AHUser | Resolution | open => fixed |
2004-09-03 06:39 | AHUser | Note Added: 0005158 | |
2005-02-26 10:26 | remkobonte | Relationship added | related to 0002686 |