Autor Beitrag
omega123
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Do 02.01.03 21:56 
Servus

wie kann ich einen text, den ich ein einem edit feld eingebe, in einem stringgdrid suchen und wenn er fündg wird, die zeeile makiert wird?
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Do 02.01.03 22:13 
ich programmiere gerade an der lösung.
ich werd sie dir dann mitteilen.
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Do 02.01.03 23:24 
ich hab mal nen bischen überlegt, und folgendes ist dabei rausgekommen:


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
var   anzzeile, anzspalte, aktspalte, aktzeile, i, a, b: integer;
begin
a := 0;
anzzeile := stringgrid1.RowCount;
anzspalte := stringgrid1.ColCount;
aktzeile := 0;
aktspalte := 0;
for a := 0 to anzspalte - 1 do
begin
  aktspalte := a;
    for i := 0 to anzzeile  - 1 do
    begin
      if stringgrid1.Cells[aktspalte, aktzeile] = edit1.text then
      begin
      stringgrid1.Row := aktzeile;
      stringgrid1.Col := aktspalte;
      end
      else
      begin
      aktzeile := aktzeile + 1;
      if aktzeile = stringgrid1.RowCount - 1 then
      begin
        aktspalte := aktspalte + 1;
        aktzeile := 0;
      end;
    end;
  end;
end;




ACHTUNG:
dieses beispiel hebt den 1. wert, der mit dem suchwort übereinstimmt hervor, alle folgenden werte werden ignoriert.
ich kann den quelltext auch so ändern, das er die koordinaten aller übereinstimmenden zellen in ein memo schreibt (auflistet).

sag, wenn du eine demo haben willst.
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Do 02.01.03 23:25 
Zitat:
..., den ich ein einem edit feld eingebe, in einem stringgdrid suchen und wenn er fündg wird, die zeeile makiert


statt zeile hab ich zelle gelesen, aber es sollte kein problem sein, den code so umzuändern, das die ganze zeile markiert wird.


oder heißt das doch zelle?
omega123 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Fr 03.01.03 02:38 
also so ist das schon super,

jetzt nur noch eine frage, ist es auch möglich, das

1. wieter sucht?
und
2. auch ungefähre übereinstimmungen anzeigt?
torstenheinze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 461



BeitragVerfasst: Fr 03.01.03 02:57 
mit dem weitersuchen, das geht, mann muss ein bischen an den if dingern rumwurschteln.


auf ähnlichkeinten überprüfen das geht so:

du ließt der aktuellen wert der in der aktuellen zelle steht und überprüfst mit einer anderen funktion. diese prüft, ob edit1.text und cells[x,y] ungefähr über einstimmen, ich kenne aber keine funktion dafür.

bischen googl'n oder forum suchen