Recent

Author Topic: [Solved] Trying to implement TStringGrid with rowhide. Problem with runtime  (Read 1176 times)

br4d

  • New Member
  • *
  • Posts: 26
Please bear with my poor english.

I want to extend TStringGrid to have a hide row function (new class TStringGridExt).
The idea I've got from older post in this forum is to use a container to store the hidden row.

For the container I've chosen another TStringGrid (also it is a TStringGrid with a variable backUp of type StringGrid).
This way I can simply check visually how the class work by assigning a second StringGrid created at design time as backUp.

Everything has worked well, but now I need to use a backUp TStringGrid which is created on run time. Thus not visible nor accessible visually.

Code: Pascal  [Select][+][-]
  1.  
  2. if (backUp = nil) then
  3.     backUp:= TStringGrid.Create(Self.Parent); //Self is a TStringGrid
  4.  
  5.  
  6. if (backUp.RowCount=0) then exit; //this line will create an error.            
  7.  

What have I missed by the manual creation of backUp?

Thanks,
Brad
« Last Edit: February 16, 2022, 07:35:52 am by br4d »

br4d

  • New Member
  • *
  • Posts: 26
Nevermind.
My mistake was not understanding that the Create constructor won't be executed for a component defined at design time.

Also the backUp is not properly initialized (but not nil).

Thanks for reading



 

TinyPortal © 2005-2018