Forum > Beginners

tStringGrids questions(Solved)

(1/1)

JLWest:
I have looked at the clean option and not sure if or how you would clean a single column.
Is that possible?

Thanks

howardpc:
There is a public method
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---[gzNormal]but can be changed to

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---[gzFixed] if you want to clean a fixed column.

JLWest:
@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

dsiders:

--- Quote from: JLWest 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

--- End quote ---

From the .CHM documentaiton:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TCustomStringGrid.CleanRemoves cell content using the specified options. DeclarationSource position: grids.pas line 1804 public procedure TCustomStringGrid.Clean; overload; procedure TCustomStringGrid.Clean(   CleanOptions: TGridZoneSet ); overload; procedure TCustomStringGrid.Clean(   aRect: TRect;   CleanOptions: TGridZoneSet ); overload; procedure TCustomStringGrid.Clean(   StartCol: Integer;   StartRow: Integer;   EndCol: Integer;   EndRow: Integer;   CleanOptions: TGridZoneSet ); overload; Arguments CleanOptions   Set with the grid zones affected in the method.  ArgumentsaRect    Rectangle with the bounds for the affected cells. CleanOptions    Set with the grid zones affected in the method. ArgumentsStartCol    Starting column number for the operation. StartRow    Starting row number for the operation. EndCol    Ending column number for the operation. EndRow    Ending row number for the operation. CleanOptions    Set with the grid zones affected in the method.  DescriptionCleans 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.  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 ('').  Some examples:  Clean all cells: // the same as grid.clean  grid.Clean([]);Clean all non-fixed cells: text  grid.Clean([gzNormal]);Clean all cells except grid column headers: grid.Clean([gzNormal, gzFixedRows]); --------------------------------------------------------------------------------Lazarus Component Library (LCL) Version 2.3.0-d31003464a Generated 2023-01-09  
And if the CCR docs were updated:

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

KodeZwerg:

--- Quote from: JLWest on January 10, 2023, 08:37:26 pm ---Where is that documented.
--- End quote ---
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.

Navigation

[0] Message Index

Go to full version