
01.06.2009, 22:22
|
 |
Гуру
|
|
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
|
|
Ну вот гдето так:
Код:
unit Unit24;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ActnList, PlatformDefaultStyleActnCtrls, ActnMan, StdCtrls;
type
TForm24 = class(TForm)
FindDialog1: TFindDialog;
Memo1: TMemo;
Edit1: TEdit;
Memo2: TMemo;
Edit2: TEdit;
ActionManager1: TActionManager;
Action1: TAction;
procedure Action1Execute(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form24: TForm24;
implementation
Uses StrUtils;
{$R *.dfm}
procedure TForm24.Action1Execute(Sender: TObject);
begin
if not FindDialog1.Execute then Exit;
end;
procedure TForm24.FindDialog1Find(Sender: TObject);
Var i: Integer;
begin
if Form24.ActiveControl = Memo1
then begin
Memo1.SelStart := PosEx(FindDialog1.FindText, Memo1.Text, Succ(Memo1.SelStart+Memo1.SelLength))-1;
if Memo1.SelStart = -1 then Exit;
Memo1.SelLength := Length(FindDialog1.FindText);
Memo1.SetFocus;
end;
end;
end.
Код:
object Form24: TForm24
Left = 0
Top = 0
Caption = 'Form24'
ClientHeight = 260
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 16
Top = 16
Width = 281
Height = 89
Lines.Strings = (
'Memo1')
TabOrder = 0
end
object Edit1: TEdit
Left = 16
Top = 112
Width = 281
Height = 21
TabOrder = 1
Text = 'Edit1'
end
object Memo2: TMemo
Left = 16
Top = 136
Width = 281
Height = 89
Lines.Strings = (
'Memo2')
TabOrder = 2
end
object Edit2: TEdit
Left = 16
Top = 232
Width = 281
Height = 21
TabOrder = 3
Text = 'Edit2'
end
object FindDialog1: TFindDialog
OnFind = FindDialog1Find
Left = 304
Top = 16
end
object ActionManager1: TActionManager
Left = 336
Top = 16
StyleName = 'Platform Default'
object Action1: TAction
Caption = 'Action1'
ShortCut = 114
OnExecute = Action1Execute
end
end
end
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
|