Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {TStringGrid}
- function TStringGrid.Search(AText: String; AStart: TPoint): TPoint;
- var
- iii: Integer;
- jjj: Integer;
- begin
- result.X := 0;
- result.Y := 0;
- //baris pertama;
- for iii := AStart.X to ColCount - 1 do
- begin
- if Pos(LowerCase(AText), LowerCase(Cells[iii, AStart.Y])) > 0 then
- begin
- Col := iii;
- Row := AStart.Y;
- result := SetSearchResult(Point(iii, AStart.Y));
- Repaint;
- exit;
- end;
- end;
- //baris berikutnya;
- for iii := 0 to ColCount - 1 do
- begin
- for jjj := AStart.Y + 1 to RowCount - 1 do
- if Pos(LowerCase(AText), LowerCase(Cells[iii, jjj])) > 0 then
- begin
- Col := iii;
- Row := jjj;
- result := SetSearchResult(Point(iii, jjj));
- Repaint;
- exit;
- end;
- end;
- end;
- function TStringGrid.SetSearchResult(FPoint: TPoint): TPoint;
- begin
- //posisi normal;
- result := Point(FPoint.X + 1, FPoint.Y);
- //posisi column di ujung;
- if FPoint.X = ColCount then
- result := Point(0, FPoint.Y + 1);
- //posisi diakhir grid;
- if (FPoint.X = ColCount) and (FPoint.Y = RowCount) then
- result := Point(0, 0);
- end;
Add Comment
Please, Sign In to add comment