View Issue Details

IDProjectCategoryView StatusLast Update
0019035LazarusDatabase Componentspublic2012-11-20 15:56
ReporterTony WhymanAssigned ToVincent Snijders 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version1.1 (SVN) 
Summary0019035: TIntegerField not recognised by IDE
DescriptionWhen a unit contains a published TIntegerField (typically a Delphi import), the corresponding form cannot be displayed and an error is returned reporting that the IntegerField unit is not known to the IDE.

The problem seems to be that in the "db" unit, TIntegerField is defined to be an equivalent type to TLongintField i.e.

TIntegerField = TLongintField;

It thus cannot be registered by RegisterNoIcon as a distinct type to TLongIntField. Fixing this bug probably requires a class definition i.e.

TIntegerField = class(TLongintField);

and a corresponding

RegisterNoIcon([TIntegerField]);
TagsNo tags attached.
Fixed in Revision39321
LazTarget-
Widgetset
Attached Files
  • dbctrls.pp.patch (1,516 bytes)
    Index: dbctrls.pp
    ===================================================================
    --- dbctrls.pp	(revision 38293)
    +++ dbctrls.pp	(working copy)
    @@ -1295,22 +1295,24 @@
     var
       FieldClasses: TFpList;
     
    -procedure RegFields(const AFieldClasses: array of TFieldClass);
    -var I: Integer;
    -    FieldClass: TFieldClass;
    +procedure RegField(const FieldClass: TFieldClass);
     begin
       if FieldClasses = nil then FieldClasses := TFpList.Create;
    -  for I := Low(AFieldClasses) to High(AFieldClasses) do begin
    -    FieldClass := AFieldClasses[I];
    -    if (FieldClass <> Nil) And (FieldClasses.IndexOf(FieldClass) = -1) then
    -    begin
    -      FieldClasses.Add(FieldClass);
    -      RegisterNoIcon([FieldClass]);
    -      RegisterClass(FieldClass);
    -    end;
    +  if (FieldClass <> Nil) And (FieldClasses.IndexOf(FieldClass) = -1) then
    +  begin
    +    FieldClasses.Add(FieldClass);
    +    RegisterNoIcon([FieldClass]);
    +    RegisterClass(FieldClass);
       end;
     end;
     
    +procedure RegFields(const AFieldClasses: array of TFieldClass);
    +var I: Integer;
    +begin
    +  for I := Low(AFieldClasses) to High(AFieldClasses) do
    +    RegField(AFieldClasses[I]);
    +end;
    +
     function ExtractFieldName(const Fields: string; var StartPos: Integer): string;
     var
       i: Integer;
    @@ -1350,6 +1352,7 @@
         TDBImage,TDBListBox,TDBLookupListBox,TDBComboBox,TDBLookupComboBox,
         TDBCheckBox, TDBRadioGroup, TDBCalendar,TDBGroupBox]);
       RegFields(DefaultFieldClasses);
    +  RegField(TIntegerField);
     end;
     
     function TFieldDataLink.FieldCanModify: boolean;
    
    dbctrls.pp.patch (1,516 bytes)

Activities

Vincent Snijders

2011-03-30 22:21

manager   ~0046976

Maybe this issue needs to be fixed in the db unit. Therefor I move it to the FPC project.

FPC team, feel free to move it back to the Lazarus project, if you don't think so.

Joost van der Sluis

2011-04-28 20:00

manager   ~0047883

Michael, what do you think of this?

Michael Van Canneyt

2011-04-28 20:12

administrator   ~0047886

I declared TIntegerField as a descendent of TLongintField.

Tony Whyman

2012-05-24 15:21

reporter   ~0059908

The problem seems to only be half fixed in 2.6.0.

The problem is that TIntegerField has not been added to the DefaultFieldClasses set in the DB unit. It is thus not registered (using RegisterNoIcon) by Lazarus as (in the DBCtrls Unit) this only registers the fields in the DefaultFieldClasses set.

Either TIntegerField needs to be added to DefaultFieldClasses, or maybe there should be an AdditionalFieldClasses set (of which TIntegerField is a member) and Lazarus registers both sets.

Michael Van Canneyt

2012-06-08 10:05

administrator   ~0060368

This needs to be handled in the Lazarus DBCtrls unit, so I'm reassigning it to Vincent.

2012-08-21 16:18

 

dbctrls.pp.patch (1,516 bytes)
Index: dbctrls.pp
===================================================================
--- dbctrls.pp	(revision 38293)
+++ dbctrls.pp	(working copy)
@@ -1295,22 +1295,24 @@
 var
   FieldClasses: TFpList;
 
-procedure RegFields(const AFieldClasses: array of TFieldClass);
-var I: Integer;
-    FieldClass: TFieldClass;
+procedure RegField(const FieldClass: TFieldClass);
 begin
   if FieldClasses = nil then FieldClasses := TFpList.Create;
-  for I := Low(AFieldClasses) to High(AFieldClasses) do begin
-    FieldClass := AFieldClasses[I];
-    if (FieldClass <> Nil) And (FieldClasses.IndexOf(FieldClass) = -1) then
-    begin
-      FieldClasses.Add(FieldClass);
-      RegisterNoIcon([FieldClass]);
-      RegisterClass(FieldClass);
-    end;
+  if (FieldClass <> Nil) And (FieldClasses.IndexOf(FieldClass) = -1) then
+  begin
+    FieldClasses.Add(FieldClass);
+    RegisterNoIcon([FieldClass]);
+    RegisterClass(FieldClass);
   end;
 end;
 
+procedure RegFields(const AFieldClasses: array of TFieldClass);
+var I: Integer;
+begin
+  for I := Low(AFieldClasses) to High(AFieldClasses) do
+    RegField(AFieldClasses[I]);
+end;
+
 function ExtractFieldName(const Fields: string; var StartPos: Integer): string;
 var
   i: Integer;
@@ -1350,6 +1352,7 @@
     TDBImage,TDBListBox,TDBLookupListBox,TDBComboBox,TDBLookupComboBox,
     TDBCheckBox, TDBRadioGroup, TDBCalendar,TDBGroupBox]);
   RegFields(DefaultFieldClasses);
+  RegField(TIntegerField);
 end;
 
 function TFieldDataLink.FieldCanModify: boolean;
dbctrls.pp.patch (1,516 bytes)

Vincent Snijders

2012-08-21 16:19

manager   ~0061796

Michael and Tony, like in the attached patch?

Marco van de Voort

2012-10-07 14:17

manager   ~0062969

As far as I can test it works.

Issue History

Date Modified Username Field Change
2011-03-30 15:33 Tony Whyman New Issue
2011-03-30 22:21 Vincent Snijders Note Added: 0046976
2011-03-30 22:21 Vincent Snijders Project Lazarus => FPC
2011-04-02 10:16 Joost van der Sluis Status new => assigned
2011-04-02 10:16 Joost van der Sluis Assigned To => Joost van der Sluis
2011-04-28 20:00 Joost van der Sluis Assigned To Joost van der Sluis => Michael Van Canneyt
2011-04-28 20:00 Joost van der Sluis Note Added: 0047883
2011-04-28 20:12 Michael Van Canneyt Fixed in Revision => 17381.
2011-04-28 20:12 Michael Van Canneyt Status assigned => resolved
2011-04-28 20:12 Michael Van Canneyt Fixed in Version => 2.5.1
2011-04-28 20:12 Michael Van Canneyt Resolution open => fixed
2011-04-28 20:12 Michael Van Canneyt Note Added: 0047886
2011-04-28 20:12 Michael Van Canneyt Target Version => 2.6.0
2011-04-29 13:42 Jonas Maebe FPCOldBugId => 0
2011-04-29 13:42 Jonas Maebe Category IDE => Database Components
2011-04-29 13:42 Jonas Maebe Product Version 0.9.30 =>
2011-12-01 13:23 Marco van de Voort Fixed in Version 2.5.1 => 2.6.0
2012-05-24 15:21 Tony Whyman Status resolved => feedback
2012-05-24 15:21 Tony Whyman Resolution fixed => reopened
2012-05-24 15:21 Tony Whyman Note Added: 0059908
2012-06-08 10:05 Michael Van Canneyt Status feedback => assigned
2012-06-08 10:05 Michael Van Canneyt Assigned To Michael Van Canneyt => Vincent Snijders
2012-06-08 10:05 Michael Van Canneyt Note Added: 0060368
2012-06-19 10:24 Marco van de Voort Project FPC => Lazarus
2012-08-21 16:18 Vincent Snijders File Added: dbctrls.pp.patch
2012-08-21 16:19 Vincent Snijders LazTarget => -
2012-08-21 16:19 Vincent Snijders Note Added: 0061796
2012-08-21 16:19 Vincent Snijders Status assigned => feedback
2012-08-21 16:19 Vincent Snijders Target Version 2.6.0 =>
2012-10-07 14:17 Marco van de Voort Note Added: 0062969
2012-11-20 15:55 Vincent Snijders Fixed in Revision 17381. => 39321
2012-11-20 15:55 Vincent Snijders Status feedback => resolved
2012-11-20 15:55 Vincent Snijders Fixed in Version 2.6.0 => 1.1 (SVN)
2012-11-20 15:55 Vincent Snijders Resolution reopened => fixed