Jump to content


Gerry

Member Since 07 Jul 2009
Offline Last Active Mar 13 2023 01:57 PM
-----

Topics I've Started

Non data aware items

28 August 2009 - 01:45 PM

To keep you bussy this weekend, I have a simple question, hope there is also a simple answer:

Why isn’t it possible to add 'non data aware' items to the 'data aware' inspector?

TNxDBDateItem and null values

13 July 2009 - 11:38 AM

Sorry to bother you again…

While testing my own application I found a (serious) bug in you data aware inspector.

Using your TNxDBInspector and a TNxDBDateItem I enter a date in the database field and post the record. Using the keyboard I clear the value in the editor of TNxDBDateItem and post the record again. Now the field value is 31 December 1899.

Cause of the problem:

function TNxDateItem.GetAsDateTime: TDateTime;
begin
try
Result := StrToDateTime(Value);
except
Result := 0; // GJK: This is 31 December 1899
end;
end;

Looking further into the problem I see your (inspector) items have no real support for database NULL values. I’m a little surprised no-one else noticed this problem.


TNxDBDateItem bug

10 July 2009 - 11:29 AM

Another day, another bug…

I have a DB Inspector with two items, the first is a TNxDBDateItem (Birthday) and as a “child� item a TNxDBTextItem (Place of birth). The value of both fields is null.

In collapsed state (place of birth item is not visible) I can enter the birthday date without any problem.

In expanded state (place of birth item is visible) I can enter the first 2 digits but when I press the ‘-‘ separator the place of birth disappears (collapsed state) and the date of birth becomes today…

When I enter an invalid date (like 'djkhfskjhfsdh') and exit the grid (item), the field value becomes today and I don't get a warning..

DisplayText data aware items

08 July 2009 - 11:05 PM

Dear Bojan,

TField objects have a property OnGetText where you can change the edit / display string of the field value. Unfortunately this is not (yet) supported in NxDbInspector. I had to overwrite the GetDisplayText method to get this feature supported (see below). This patch works for me but it's only part of the solution. There are more data aware item classes. I hope you can update your code soon.

Thanks,

Gerry

=== My Patch ===

function TNxDBTextItem.GetDisplayText: WideString;
begin

with GetParentControl as TNextDBInspector do begin
if (DataSource <> Nil) and (DataSource.DataSet <> Nil) and (DataSource.DataSet.Active) then
Result := DataSource.DataSet.FieldByName(FieldName).DisplayText else
Result := Value;
end;

end; { .GetDisplayText }