home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
CODEPAGE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-02-28
|
3KB
|
114 lines
//---------------------------------------------------------------------------
// Borland C++Builder
// Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
//---------------------------------------------------------------------------
// Codepage.pas
//
// VCL Class Browser
//---------------------------------------------------------------------------
unit CodePage;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Menus,Registry;
type
TCodePageForm = class(TForm)
CodePage: TRichEdit;
SourceRichEdit1: TRichEdit;
PopupMenu1: TPopupMenu;
FindText1: TMenuItem;
FindDialog1: TFindDialog;
Exit1: TMenuItem;
procedure FindText1Click(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
procedure Exit1Click(Sender: TObject);
private
I:Integer;
public
{ Public declarations }
end;
var
CodePageForm: TCodePageForm;
implementation
{$R *.DFM}
procedure TCodePageForm.FindText1Click(Sender: TObject);
begin
I:=0;
FindDialog1.Execute;
end;
procedure TCodePageForm.FindDialog1Find(Sender: TObject);
var
FoundOne:Boolean;
J, PosReturn, SkipChars: Integer;
begin
FoundOne:=false;
if CodePage.Visible=true then
begin
while I < (CodePage.Lines.Count+1) do
begin
PosReturn := Pos(FindDialog1.FindText,CodePage.Lines[I]);
if PosReturn <> 0 then {found!}
begin
FoundOne:=true;
Skipchars := 0;
for J := 0 to I - 1 do
Skipchars := Skipchars + Length(CodePage.Lines[J]);
SkipChars := SkipChars + (I*2);
SkipChars := SkipChars + PosReturn - 1;
CodePage.SetFocus;
CodePage.SelStart := SkipChars;
CodePage.SelLength := Length(FindDialog1.FindText);
Inc(I);
Exit;
end;
Inc(I);
end;
end;
if SourceRichEdit1.Visible=true then
begin
while I < (SourceRichEdit1.Lines.Count+1) do
begin
PosReturn := Pos(FindDialog1.FindText,SourceRichEdit1.Lines[I]);
if PosReturn <> 0 then {found!}
begin
FoundOne:=true;
Skipchars := 0;
for J := 0 to I - 1 do
Skipchars := Skipchars + Length(SourceRichEdit1.Lines[J]);
SkipChars := SkipChars + (I*2);
SkipChars := SkipChars + PosReturn - 1;
SourceRichEdit1.SetFocus;
SourceRichEdit1.SelStart := SkipChars;
SourceRichEdit1.SelLength := Length(FindDialog1.FindText);
Inc(I);
Exit;
end;
Inc(I);
end;
end;
if FoundOne=false then
begin
MessageDlg('No Match Found!!' ,mtError, [mbOk], 0);
Exit;
end;
end;
procedure TCodePageForm.Exit1Click(Sender: TObject);
begin
Hide;
end;
end.