کنترل Ctrl+Z,Ctrl+E,Ctrl+Ent در RichEdit
سلام
میخوام بشه بیش از یک مرحله RichEdit رو Undo کرد.البته کامپوننت اینطوری دیدم اما نمی دونم قابل اطمینان هست یا نه(نصبش نکردم)
علوه بر این برای سازگاری با قسمتهای دیگه برنامه نیاز دارم Ctrl+E (وسط چین) , Ctrl+Ent رو خودم بررسی کنم و وقتی فشار داده شدند فشار کلیدهایی رو شبیه سازی کنم.
بلد نیستم کامپوننت رو سفارشی کنم.از این صفحه هم نفهمیدم چطور کار کنم.
می دونم WM_Undo هم داریم اما چطور این کار رو بکنم؟ و کارکترهای دیگه هم که گفتم چی؟
نقل قول: کنترل Ctrl+Z,Ctrl+E,Ctrl+Ent در RichEdit
onShortCut فرم رو میشه استفاده کرد؟
نقل قول: کنترل Ctrl+Z,Ctrl+E,Ctrl+Ent در RichEdit
به این کدر رسیدم:
private
procedure AppMessage(var Msg: TMsg; var Handled: Boolean);
..
procedure TEditorForm.FormCreate(Sender: TObject);
Application.OnMessage := AppMessage;
procedure TEditorForm.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.hwnd = RichEdit1.Handle) //if the focus is in the RichEdit1
and (Msg.Message=WM_KEYDOWN) then //if the user pressed a key
begin
if (GetKeyState(VK_CONTROL) < 0)//control isdown
and (Msg.wParam<>17)//Ctrl Without Key
and ((Msg.wParam=69)//Center:E
or (Msg.wParam=76)//Left:L
or (Msg.wParam=82)//Right:R
or (Msg.wParam=89)//Y:Redo
or (Msg.wParam=90))//Z:Undo
then
Begin
if Msg.wParam=89 then
Redo;
if Msg.wParam=90 then
Undo;
Handled := True;
End;
end;
end;
فکر نمی کردم تایپ لاتین وسط فارسی در ریچ ادیت اینقدر سخت باشه.کلا کامپوننت پیچیده ایه هست.