mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
64 lines
1.3 KiB
ObjectPascal
64 lines
1.3 KiB
ObjectPascal
unit fSelectTextRange;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
|
ButtonPanel, Buttons;
|
|
|
|
type
|
|
|
|
{ TfrmSelectTextRange }
|
|
|
|
TfrmSelectTextRange = class(TForm)
|
|
btpPanel: TButtonPanel;
|
|
edtSelectText: TEdit;
|
|
lblSelectText: TLabel;
|
|
procedure edtSelectTextExit(Sender: TObject);
|
|
private
|
|
FSelStart,
|
|
FSelFinish: LongInt;
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
function ShowSelectTextRangeDlg(const ACaption, AText: UTF8String;
|
|
out iSelStart, iSelFinish: LongInt): Boolean;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
function ShowSelectTextRangeDlg(const ACaption, AText: UTF8String;
|
|
out iSelStart, iSelFinish: LongInt): Boolean;
|
|
begin
|
|
with TfrmSelectTextRange.Create(Application) do
|
|
try
|
|
Caption:= ACaption;
|
|
edtSelectText.Text:= AText;
|
|
|
|
Result:= (ShowModal = mrOK);
|
|
|
|
if Result then
|
|
begin
|
|
iSelStart:= FSelStart;
|
|
iSelFinish:= FSelFinish;
|
|
Result:= (FSelFinish >= FSelStart);
|
|
end;
|
|
finally
|
|
Free;
|
|
end;
|
|
end;
|
|
|
|
{ TfrmSelectTextRange }
|
|
|
|
procedure TfrmSelectTextRange.edtSelectTextExit(Sender: TObject);
|
|
begin
|
|
FSelStart:= edtSelectText.SelStart + 1;
|
|
FSelFinish:= edtSelectText.SelStart + edtSelectText.SelLength;
|
|
end;
|
|
|
|
end.
|
|
|