unit keys;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl, ComCtrls, ExtCtrls, JvComponentBase,
JvComputerInfoEx, JvExStdCtrls, JvListBox, JvDriveCtrls, JvListComb,
JvCombobox, ToolWin, JvExComCtrls, JvToolBar, JvButton, JvCtrls,
JvFooter, JvExExtCtrls, JvExtComponent, JvSpeedbar, RichEditBrowser,
JvComCtrls, JvComponentPanel, JvExControls, JvLookOut;
type
TForm1 =
Class(TForm);
RichEdit1: TRichEdit;
procedure RichEdit1OnKeyup(Sender: TObject;
var Key: word; Shift: TShiftState);
procedure RichEdit1OnKeydown(Sender: TObject;
var Key: word; Shift: TShiftState);
implementation
uses unit5;
// ======
einfügen =======================================
procedure TForm1.RichEdit1OnKeyup(Sender: TObject;
var Key: word; Shift: TShiftState);
var
selstart: integer;
tempstr1: PChar;
begin
if key = VK_RETURN
then
begin
tempstr1 := '
';
SendMessage(RichEdit1.Handle, EM_Getsel, longint(@selstart), 0);
SendMessage(RichEdit1.Handle, EM_Replacesel, 0, LongInt(tempstr1));
SendMessage(RichEdit1.Handle, EM_Setsel, selstart + 4, Selstart + 3);
key := 0;
end;
end;
// ====== </p> schliessen ====================================
procedure TForm1.RichEdit1OnKeydown(Sender: TObject;
var Key: word; Shift: TShiftState);
var
selstart: integer;
tempstr2: PChar;
begin
if key = VK_RETURN
then
begin
tempstr2 := '
</p>' ;
SendMessage(RichEdit1.Handle, EM_Getsel, longint(@selstart), 0);
SendMessage(RichEdit1.Handle, EM_Replacesel, 0, LongInt(tempstr2));
SendMessage(RichEdit1.Handle, EM_Setsel, selstart + 4, Selstart + 4);
key := 0;
end;
end;
end.