0

I make one component in Delphi 10 Seattle. My component is one panel contains one TDBGrid (from TCustomDBGrid) and one TEdit Controls. When i put my component to form, everything is fine, if i don't change Grid Columns. but when i changed bounded DBGrid Columns, an error happens on run time with message: "Error reading TColumn.MyGrid.Expanded: Property MyGrid.Expanded dos not exist. ..." For found error, i opened form as text and see this codes:

MyGrid.Columns = <
  item
    MyGrid.Expanded = False
    MyGrid.FieldName = 'Sid'
    MyGrid.Visible = True
  end
  item
    MyGrid.Expanded = False
    MyGrid.FieldName = 'UserName'
    MyGrid.Visible = True
  end>
FilterDataSource = DataSource1

Thus, my component not worked correctly.

  • Well, does your TMyGrid declare an Expanded property, and is it correctly streamed when it is used on a form? Same q for your FieldName - TCustomDBGrid does not have a FieldName property last time I looked ... – MartynA May 30 '16 at 21:46
  • My Dataset is an table with some fields. i need to set just 2 fields in grid, thus, in Columns property (in MyGrid), i add this fields. – Asghar Nemati May 31 '16 at 19:40
  • Well, you may think you've done things correctly, but obviously Delphi thinks differently. You should listen to what the error messages are trying to tell you, in particular "Property MyGrid.Expanded do[e]s not exist". "My Dataset is an table with some fields." - but is your custom grid aware that the dataset it is connected to can only be of that type? – MartynA May 31 '16 at 19:44
  • Thank's for your reply. I try to check all of my known properties and features but i can't find reason. First, i must told to you, my posted code (to above), not mine. This code generated by delphi compiler. For better observation, put one dbGrid to a form and set its columns to one or two fields. then push Alt + 12 keys to view form as text. Then visit dbgrid columns declaration. Well, the problem is here. Generated code for common dbgrid and MyDbGrid is differ and it related to "Bounded Component". I checked TLabledEdit (My component is one dbgrid on a panel) but not found solution. – Asghar Nemati May 31 '16 at 20:40
  • If you add an MCVE to your q (google it if you don't know what it means) then maybe I or someone else could help you. But until then, it's a problem that only you seem to have and therefore one that only you can debug. – MartynA Jun 04 '16 at 21:30
  • Of curse. I'll try make it in 2-3 days. – Asghar Nemati Jun 07 '16 at 20:04
  • This is simple TPanelGrid: – Asghar Nemati Jul 09 '16 at 23:03
  • If you take a look at my q and the second answer, by @SertacAkyuz in particular, his TMyPanel2 works for me - see if it works for you. – MartynA Jul 14 '16 at 18:55

1 Answers1

0

I wrote my own component embedding a TDBGrid in a TPanel and a project to test it. I got the same error as you when I tried to reload my project when the grid included persisted TColumns.

So, I posted my own q here

How to correctly stream a TCollection property of a subcomponent, e.g. the Columns property of an embedded TDBGrid

and got an answer from Delphi MVP Uwe Raabe basically saying that the cause is a problem in the VCL streaming code of TDBGridColumns and suggesting that I file a problem report ot EMBA's Quality Portal. SO I don't think there is much that can be done about the problem until EMBA fix it.

Community
  • 1
  • 1
MartynA
  • 30,454
  • 4
  • 32
  • 73