Recent

Author Topic: tStringGrids questions(Solved)  (Read 536 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
tStringGrids questions(Solved)
« on: January 10, 2023, 07:35:58 pm »
I have looked at the clean option and not sure if or how you would clean a single column.
Is that possible?

Thanks
« Last Edit: January 10, 2023, 08:53:23 pm by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: tStringGrids questions
« Reply #1 on: January 10, 2023, 07:43:40 pm »
There is a public method
Code: Pascal  [Select][+][-]
  1. procedure Clean(StartCol,StartRow,EndCol,EndRow: integer; CleanOptions: TGridZoneSet); overload;
which does what you ask for.
The last parameter is normally set to
Code: Pascal  [Select][+][-]
  1. [gzNormal]
but can be changed to
Code: Pascal  [Select][+][-]
  1. [gzFixed]
if you want to clean a fixed column.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: tStringGrids questions
« Reply #2 on: January 10, 2023, 08:37:26 pm »
@howardpc - Where is that documented. I hunted all over for something like this. Probably didn't know the proper syntax for the google search.

Thanks

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: tStringGrids questions
« Reply #3 on: January 10, 2023, 08:57:19 pm »
@howardpc - Where is that documented. I hunted all over for something like this. Probably didn't know the proper syntax for the google search.

Thanks

From the .CHM documentaiton:

Code: Text  [Select][+][-]
  1. TCustomStringGrid.Clean
  2. Removes cell content using the specified options.
  3.  
  4. Declaration
  5. Source position: grids.pas line 1804
  6.  
  7. public procedure TCustomStringGrid.Clean; overload;
  8.  
  9. procedure TCustomStringGrid.Clean(
  10.   CleanOptions: TGridZoneSet
  11. ); overload;
  12.  
  13. procedure TCustomStringGrid.Clean(
  14.   aRect: TRect;
  15.   CleanOptions: TGridZoneSet
  16. ); overload;
  17.  
  18. procedure TCustomStringGrid.Clean(
  19.   StartCol: Integer;
  20.   StartRow: Integer;
  21.   EndCol: Integer;
  22.   EndRow: Integer;
  23.   CleanOptions: TGridZoneSet
  24. ); overload;
  25.  
  26. Arguments
  27.  
  28. CleanOptions  
  29.  Set with the grid zones affected in the method.
  30.  
  31.  
  32. Arguments
  33. aRect  
  34.  Rectangle with the bounds for the affected cells.
  35.  
  36. CleanOptions  
  37.  Set with the grid zones affected in the method.
  38.  
  39. Arguments
  40. StartCol  
  41.  Starting column number for the operation.
  42.  
  43. StartRow  
  44.  Starting row number for the operation.
  45.  
  46. EndCol  
  47.  Ending column number for the operation.
  48.  
  49. EndRow  
  50.  Ending row number for the operation.
  51.  
  52. CleanOptions  
  53.  Set with the grid zones affected in the method.
  54.  
  55.  
  56. Description
  57. Cleans all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. See TGridZoneSet for more information.
  58.  
  59. The cleaning operation does not change the number of rows and columns on the grid control. It replaces the content for the affected cells with empty strings ('').
  60.  
  61. Some examples:
  62.  
  63. Clean all cells:
  64.  
  65. // the same as grid.clean
  66.   grid.Clean([]);
  67. Clean all non-fixed cells:
  68.  
  69. text
  70.  
  71. grid.Clean([gzNormal]);
  72. Clean all cells except grid column headers:
  73.  
  74. grid.Clean([gzNormal, gzFixedRows]);
  75.  
  76. --------------------------------------------------------------------------------
  77. Lazarus Component Library (LCL) Version 2.3.0-d31003464a Generated 2023-01-09
  78.  

And if the CCR docs were updated:

https://dsiders.gitlab.io/lazdocsnext/lcl/grids/tcustomstringgrid.clean.html

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2007
  • Fifty shades of code.
    • Delphi & FreePascal
Re: tStringGrids questions
« Reply #4 on: January 10, 2023, 09:01:50 pm »
Where is that documented.
At official documentation for the TStringGrid, your specific method you find here.
I hope this helps.
Steps to reproduce using official help ->
1. Open the official TStringGrid documentiation.
2. Search for your method (Clean), you will find out that it is not listed here so go one step above from where TStringGrid comes from
3. You will land at TCustomStringGrid and there you find "Clean" listed.

I hope it helps and sorry that I also answered.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

 

TinyPortal © 2005-2018