Forum > Beginners

StringGrid Clear?

(1/1)

pentilisea:
Hi again,
getting along with StringGrid fine although...

I configured StringGrid1 with the Object Inspector

The StringGrid displays my diverse calculation. All good.

Before loading next file I clear all Edits and so on.

When I do StringGrid1.Clear, it clears fine, but I can't
restore the original settings I did with Object Inspector.

The following lines leaves the first row0 (?) with titles ok,
loding new file OK, but it does not write again the results into
Row 1 - etc...


--- 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";}};} ---for c := spins downto 0 do begin  StringGrid1.DeleteRow(1);  StringGrid1.Refresh;  end;
The Grid is configured to have 100 rows to start with.

Well, how do I clear,clean or empty the written rows and start
again with the original code? (which of course fails after a StringGrid1.Clear event)


--- 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";}};} ---   StringGrid1.Cells[1, spins] := Edit1.text;   StringGrid1.Cells[2, spins] := inttostr(spins);   StringGrid1.Cells[3, spins] := IntToStr(beton);   StringGrid1.Cells[4, spins] := IntToStr(wager);   StringGrid1.Cells[5, spins] := IntToStr(loss);   StringGrid1.Cells[6, spins] := IntToStr(win);   StringGrid1.Cells[7, spins] := IntToStr(budget);   StringGrid1.Cells[8, spins] := mode;   StringGrid1.Cells[9, spins] := Label1.Caption;   StringGrid1.Refresh;
Thanks for your consideration and time.
   For better understanding see attachments.
   
   Klaus     



cdbc:
Hi
Fwiw, I've got three utility functions to do that:
--- 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 CreateGridHeaders(aGrid: TStringGrid;ColHeaders: array of string;ColWidths: IntegerArray);- procedure ClearGrid(aGrid: TStringGrid;aSaveHeaders: boolean = true);- procedure PopulateGrid(aGrid: TStringGrid;anObject: TYourDataObject);Mind you I am a lazy bast***  :D  Can't be bothered to write the same over and over again... Remember, RowCount is your friend  ;)
Regards Benny

Navigation

[0] Message Index

Go to full version