Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Stringgrid befüllen > massives Timingproblem (https://www.delphipraxis.net/25771-stringgrid-befuellen-massives-timingproblem.html)

richard_boderich 12. Jul 2004 10:52


Stringgrid befüllen > massives Timingproblem
 
Liste der Anhänge anzeigen (Anzahl: 1)
hallo leute,

hab echt timingprobleme mit einem stringgrid
progge grade an nen hexeditor, programm ist im anhang
einfach mal mit oeffnen ne datei waehlen,und mal mit maus auf das hexstringgrid klicken,
dann mal mit page down taste scrollen, guckt euch mal das scolling der einzellnen grids an

des linke offsetgrid ist kein problem, ascii grid rechts geht auch noch, aber das hexgrid in der mitte,
ist ja wohl unter aller bescheidenheit!

habe waehrend des scrollings schon nicht benoetigte ereignisse deaktiviert (z.b. onselectcell)

ich denke das problem muss an der while schleife liegen , die ich nutze um die grids mit daten aus einem array zu befuellen
das dauert denk ich einfach zu lange, waere dankbar für irgentwelche alternativen, vorschlaege, oder bemerkungen dazu.
muss doch was schnelleres dafür geben :)

Sharky 12. Jul 2004 11:14

Re: Stringgrid befüllen > massives Timingproblem
 
Hai richard,

selbst bei meinen 1280x1024 passt das Programm nicht auf den Bildschrim. :shock:
Wenn ich scrolle beweget sich der Vertikalescrollbalken nicht.

richard_boderich 12. Jul 2004 11:19

Re: Stringgrid befüllen > massives Timingproblem
 
hallo sharky,

super das du dich mal wieder so schnell meines problem's angenommnen hast :)

also das prog ist für ne aufloesung von 1600x1200 gedacht. die ich auf meinem desktop fahre

wenn du in dieser aufloesung arbeitest, solltest du ueberhaupt keine scrollbalken haben, die darstellung
der daten erfolgt derzeitnoch seitenweise, scrollen sollst du nur mit pagedown taste, alles
andere funzt noch nich, da das project noch im anfangststadion ist bzw. eine machbarkeits und designstudie
ist

Sharky 12. Jul 2004 11:24

Re: Stringgrid befüllen > massives Timingproblem
 
Zitat:

Zitat von richard_boderich
...wenn du in dieser aufloesung arbeitest, solltest du ueberhaupt keine scrollbalken haben, die darstellung...

Mein TFT kann nicht mehr ;-) Aber wenn ich eine 30 MB-Datei einlese ist der rechte Scrollbalken auf jeden fall zu sehen.
Habe es eben noch einmal versucht. Wenn ich mit PageDown nach unten gehe ist nicht von einem Timingproblem zu sehen. PageUp geht ja wohl noch nicht?

richard_boderich 12. Jul 2004 11:27

Re: Stringgrid befüllen > massives Timingproblem
 
kann nich sein ,habs grad nochma gecheckt, mit ner 800 mb film datei
ich hab keine scroll balken, muss wohl an der aufloesung liegen

richard_boderich 12. Jul 2004 12:52

Re: Stringgrid befüllen > massives Timingproblem
 
ok sharky hier ist der code

Delphi-Quellcode:
procedure Ausgabe();

begin

i:=0;
c:=0;


while i<=1408 do
begin

form1.stringgrid4.Cells[0,c]:=inttohex(filepos(f),16); {hexpos} // fehler : ich weiß muss inttohex(filepos(f)+i,16)

form1.stringgrid5.Cells[1,c]:=inttohex(matrix[i],2);
form1.stringgrid5.Cells[2,c]:=inttohex(matrix[i+1],2);
form1.stringgrid5.Cells[3,c]:=inttohex(matrix[i+2],2);
form1.stringgrid5.Cells[4,c]:=inttohex(matrix[i+3],2);
form1.stringgrid5.Cells[5,c]:=inttohex(matrix[i+4],2);
form1.stringgrid5.Cells[6,c]:=inttohex(matrix[i+5],2);
form1.stringgrid5.Cells[7,c]:=inttohex(matrix[i+6],2);
form1.stringgrid5.Cells[8,c]:=inttohex(matrix[i+7],2);

//form1.stringgrid5.Cells[9,c]:=' -  ';

form1.stringgrid5.Cells[10,c]:=inttohex(matrix[i+8],2);
form1.stringgrid5.Cells[11,c]:=inttohex(matrix[i+9],2);
form1.stringgrid5.Cells[12,c]:=inttohex(matrix[i+10],2);
form1.stringgrid5.Cells[13,c]:=inttohex(matrix[i+11],2);
form1.stringgrid5.Cells[14,c]:=inttohex(matrix[i+12],2);
form1.stringgrid5.Cells[15,c]:=inttohex(matrix[i+13],2);
form1.stringgrid5.Cells[16,c]:=inttohex(matrix[i+14],2);
form1.stringgrid5.Cells[17,c]:=inttohex(matrix[i+15],2);

//form1.stringgrid5.Cells[18,c]:=' -  ';

form1.stringgrid5.Cells[19,c]:=inttohex(matrix[i+16],2);
form1.stringgrid5.Cells[20,c]:=inttohex(matrix[i+17],2);
form1.stringgrid5.Cells[21,c]:=inttohex(matrix[i+18],2);
form1.stringgrid5.Cells[22,c]:=inttohex(matrix[i+19],2);
form1.stringgrid5.Cells[23,c]:=inttohex(matrix[i+20],2);
form1.stringgrid5.Cells[24,c]:=inttohex(matrix[i+21],2);
form1.stringgrid5.Cells[25,c]:=inttohex(matrix[i+22],2);
form1.stringgrid5.Cells[26,c]:=inttohex(matrix[i+23],2);

//form1.stringgrid5.Cells[27,c]:=' -  ';

form1.stringgrid5.Cells[28,c]:=inttohex(matrix[i+24],2);
form1.stringgrid5.Cells[29,c]:=inttohex(matrix[i+25],2);
form1.stringgrid5.Cells[30,c]:=inttohex(matrix[i+26],2);
form1.stringgrid5.Cells[31,c]:=inttohex(matrix[i+27],2);
form1.stringgrid5.Cells[32,c]:=inttohex(matrix[i+28],2);
form1.stringgrid5.Cells[33,c]:=inttohex(matrix[i+29],2);
form1.stringgrid5.Cells[34,c]:=inttohex(matrix[i+30],2);
form1.stringgrid5.Cells[35,c]:=inttohex(matrix[i+31],2);



 {asc anzeige }
temp0:=matrix[i];
temp1:=matrix[i+1];
temp2:=matrix[i+2];
temp3:=matrix[i+3];
temp4:=matrix[i+4];
temp5:=matrix[i+5];
temp6:=matrix[i+6];
temp7:=matrix[i+7];
temp8:=matrix[i+8];
temp9:=matrix[i+9];
temp10:=matrix[i+10];
temp11:=matrix[i+11];
temp12:=matrix[i+12];
temp13:=matrix[i+13];
temp14:=matrix[i+14];
temp15:=matrix[i+15];
temp16:=matrix[i+16];
temp17:=matrix[i+17];
temp18:=matrix[i+18];
temp19:=matrix[i+19];
temp20:=matrix[i+20];
temp21:=matrix[i+21];
temp22:=matrix[i+22];
temp23:=matrix[i+23];
temp24:=matrix[i+24];
temp25:=matrix[i+25];
temp26:=matrix[i+26];
temp27:=matrix[i+27];
temp28:=matrix[i+28];
temp29:=matrix[i+29];
temp30:=matrix[i+30];
temp31:=matrix[i+31];


if temp0 < 21 then temp0:=46;
if temp1< 21 then temp1:=46;
if temp2< 21 then temp2:=46;
if temp3<21 then temp3:=46;
if temp4<21 then temp4:=46;
if temp5<21 then temp5:=46;
if temp6<21 then temp6:=46;
if temp7<32 then temp7:=46;
if temp8<32 then temp8:=46;
if temp9<32 then temp9:=46;
if temp10<32 then temp10:=46;
if temp11<32 then temp11:=46;
if temp12<32 then temp12:=46;
if temp13<32 then temp13:=46;
if temp14<32 then temp14:=46;
if temp15<32 then temp15:=46;
if temp16< 32 then temp16:=46;
if temp17< 32 then temp17:=46;
if temp18< 32 then temp18:=46;
if temp19<32 then temp19:=46;
if temp20<32 then temp20:=46;
if temp21<32 then temp21:=46;
if temp22<32 then temp22:=46;
if temp23<32 then temp23:=46;
if temp24<32 then temp24:=46;
if temp25<32 then temp25:=46;
if temp26<32 then temp26:=46;
if temp27<32 then temp27:=46;
if temp28<32 then temp28:=46;
if temp29<32 then temp29:=46;
if temp30<32 then temp30:=46;
if temp31<32 then temp31:=46;



form1.stringgrid6.Cells[1,c]:=chr(temp0);
form1.stringgrid6.Cells[2,c]:=chr(temp1);
form1.stringgrid6.Cells[3,c]:=chr(temp2);
form1.stringgrid6.Cells[4,c]:=chr(temp3);
form1.stringgrid6.Cells[5,c]:=chr(temp4);
form1.stringgrid6.Cells[6,c]:=chr(temp5);
form1.stringgrid6.Cells[7,c]:=chr(temp6);
form1.stringgrid6.Cells[8,c]:=chr(temp7);
form1.stringgrid6.Cells[9,c]:=chr(temp8);
form1.stringgrid6.Cells[10,c]:=chr(temp9);
form1.stringgrid6.Cells[11,c]:=chr(temp10);
form1.stringgrid6.Cells[12,c]:=chr(temp11);
form1.stringgrid6.Cells[13,c]:=chr(temp12);
form1.stringgrid6.Cells[14,c]:=chr(temp13);
form1.stringgrid6.Cells[15,c]:=chr(temp14);
form1.stringgrid6.Cells[16,c]:=chr(temp15);
form1.stringgrid6.Cells[17,c]:=chr(temp16);
form1.stringgrid6.Cells[18,c]:=chr(temp17);
form1.stringgrid6.Cells[19,c]:=chr(temp18);
form1.stringgrid6.Cells[20,c]:=chr(temp19);
form1.stringgrid6.Cells[21,c]:=chr(temp20);
form1.stringgrid6.Cells[22,c]:=chr(temp21);
form1.stringgrid6.Cells[23,c]:=chr(temp22);
form1.stringgrid6.Cells[24,c]:=chr(temp23);
form1.stringgrid6.Cells[25,c]:=chr(temp24);
form1.stringgrid6.Cells[26,c]:=chr(temp25);
form1.stringgrid6.Cells[27,c]:=chr(temp26);
form1.stringgrid6.Cells[28,c]:=chr(temp27);
form1.stringgrid6.Cells[29,c]:=chr(temp28);
form1.stringgrid6.Cells[30,c]:=chr(temp29);
form1.stringgrid6.Cells[31,c]:=chr(temp30);
form1.stringgrid6.Cells[32,c]:=chr(temp31);

inc(i,32);
inc(c,1);
end;
end;

Sharky 12. Jul 2004 12:58

Re: Stringgrid befüllen > massives Timingproblem
 
Hai richard_boderich,

versuche mal vor deiner While-Schleife:
Delphi-Quellcode:
  StringGrid4.Cols.BeginUpdate;
  StringGrid4.Rows.BeginUpdate;
und danach:
Delphi-Quellcode:
  StringGrid4.Cols.EndUpdate;
  StringGrid4.Rows.EndUpdate;

richard_boderich 12. Jul 2004 13:10

Re: Stringgrid befüllen > massives Timingproblem
 
grueß gott sharky!

also, wie du siehst, ist die procedure ausgabe nicht bestandteil der form,
ich muss deinen aufruf also jeweil's umwandeln von
Delphi-Quellcode:
 
StringGrid4.Cols.beginUpdate;
in

Delphi-Quellcode:
form1.StringGrid4.Cols.beginUpdate;
desweiteren, versteht ich nich wieso bei grid 4 und nicht grid 5 ?

naja, hab das so gemacht wie du gesagt hast, und bekomme jetz compilerfehlermeldung


Code:
"[" erwartet aber "." gefunden

Sharky 12. Jul 2004 13:27

Re: Stringgrid befüllen > massives Timingproblem
 
Zitat:

Zitat von richard_boderich
...desweiteren, versteht ich nich wieso bei grid 4 und nicht grid 5 ?

Da habe ich mich verguckt ;-)
Ich sehe eben das man das für jede Zeile und Spalte angeben muss.
Dann mache schnell eine eigene Procedure für das Grid.
Z.B.:
Delphi-Quellcode:
procedure SGBeginUpdate (sg : TStringGrid);
var
  ndx : Integer;
begin
  for ndx := 0 to sg.RowCount -1 do
  begin
    sg.Rows[ndx].BeginUpdate;
  end;
end;

procedure SGEndUpdate (sg : TStringGrid);
var
  ndx : Integer;
begin
  for ndx := 0 to sg.RowCount -1 do
  begin
    sg.Rows[ndx].EndUpdate;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  SGBeginUpdate(Form1.StringGrid5);
  //Jetzt füllst Du dein HEX-Grid;
  SGEndUpdate(Form1.StringGrid5);
end;
Aber ob es wirklich daran liegt kann ich nicht sagen ;-)

richard_boderich 12. Jul 2004 13:50

Re: Stringgrid befüllen > massives Timingproblem
 
hi sharky,


also es funktioniert jetz, aber ich habe noch nich begriffen warum

ich habe in der delphi hilfe gesucht, habe update aber nur im zusammenhang
mit kompletten grids gefunden, aber nich im context mit zellen

wenn ich das richtig blicke, dann sorgt update dafürdas nur die geanderten regionen
eines objects neu gezeichnet werden,

aber

> in der dephi hilfe steht zum context stringgrids und update, "haufige oder unoetige aufrufe von update, koennen die anwendung
drastisch verlangsamen" :!:

kannst dur mir erklaeren , was genau das update macht und warum es jetz schneller lauft, und nich langsamer,
denn eigentlich fuehre ich jetzt noch mehr code aus??? :gruebel:

PS: du bist der beste, ich kauf dir jetz n neues AQUARIUM *blubb....blub,blub* :-D

Sharky 12. Jul 2004 13:56

Re: Stringgrid befüllen > massives Timingproblem
 
Hai richard_boderich,

Zitat:

Zitat von richard_boderich
...ich habe in der delphi hilfe gesucht, habe update aber nur im zusammenhang
mit kompletten grids gefunden,...

TStringGrid.Update verwende ich ja auch nicht ;-) Diese Methode zwingt das Grid sich neu zu zeichnen.

Normalerweise wird das TStringGrid jedesmal wenn Du den Inhalt einer Celle änderst komplett neu gezeichnet.
TStringGrid.Rows.BeginUpdate verhindert das neu Zeichnen des Grids solange bis TStringGrid.Rows.EndUpdate aufgerufen wird.

Du sagst quasi: "Hallo StringGrid, jetzt kommen Daten aber ich möchte nicht das du sie darstellst bis ich es dir sage"
Und da das Zeichen sehr viel Zeit braucht bist Du so einfach schneller. Und für jede Zeile des StringGrids .BeginUpDate aufrufen geht im vergleich dazu sehr sehr schnell.

BTW: Du kannst bei deinem Code meine Procedure auch noch aufrufen bevor Du deinen beiden anderen StringGrids (als Parameter immer der Name des entsprechenden SG) mit Daten füllst. Dann wird das ganze noch flüssiger.

Also ganz am Anfang deiner Routine:
Delphi-Quellcode:
begin
  SGBeginUpdate(Form1.StringGrid4);
  SGBeginUpdate(Form1.StringGrid5);
  SGBeginUpdate(Form1.StringGrid6);
  .
  // Jetzt das füllen der drei StringGrids
  .
  SGEndUpdate(Form1.StringGrid4);
  SGEndUpdate(Form1.StringGrid5);
  SGEndUpdate(Form1.StringGrid6);
end;

richard_boderich 12. Jul 2004 14:45

Re: Stringgrid befüllen > massives Timingproblem
 
hallo sharky,

also, das ganze funktioniert nur, wenn ich die ondrawcell und onselectcell

auf nil setze, sonst leider nich , ich koennte mal mein komplettes project posten ,wenn das helfen wuerde ??

mytar 12. Jul 2004 15:28

Re: Stringgrid befüllen > massives Timingproblem
 
Such mal die Property ControlsEnabled, ich hoffe die gibts bei TStringGrid.

mytar

Sharky 12. Jul 2004 20:48

Re: Stringgrid befüllen > massives Timingproblem
 
Zitat:

Zitat von richard_boderich
... ich koennte mal mein komplettes project posten ,wenn das helfen wuerde ??

:shok: sende es mir mal an meine iMehl-Adresse. Dann versuche ich mal mir das ganze anzusehen.

Sharky 12. Jul 2004 20:50

Re: Stringgrid befüllen > massives Timingproblem
 
Zitat:

Zitat von mytar
...ich hoffe die gibts bei TStringGrid....

Gibt es sie oder nicht?

Hai mytar,
bitte schaue doch, bevor Du etwas schreibst, ob es auch geht. Danke :-D


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:38 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz