danielmj,
Cita:
Empezado por danielmj
...Sobre usar el FindDialog...si puedo prescindir del FindDialog...mejor...
|
Revisa este código:
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
ComboBox1: TComboBox;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Items.LoadFromFile('Search_Parameters.txt');
RichEdit1.Lines.LoadFromFile('Search_File.txt');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
FoundAt: LongInt;
StartPos, ToEnd: Integer;
begin
with RichEdit1 do
begin
if SelLength <> 0 then
StartPos := SelStart + SelLength
else
StartPos := 0;
FoundAt := FindText(ComboBox1.Text, StartPos, Length(RichEdit1.Text), []);
if FoundAt <> -1 then
begin
SetFocus;
SelStart := FoundAt;
SelLength := Length(ComboBox1.Text);
end
else
SelStart := 0;
end;
end;
end.
El código anterior
es la versión 2 del código sugerido en el
Msg #5 sin la utilización del componente TFindDialog y con la capacidad de hacer Búsquedas Cíclicas de tipo Case Insensitive, funcionando correctamente según lo esperado en
Delphi 7, Delphi 2010 y Delphi XE4 bajo Windows 7 Professional x32.
Espero sea útil
Nelson.