Code: Select all
if ( ssCtrl in Shift ) and (Key = ord('A')) then
begin
ActiveEditor.RichViewEdit.SelectAll;
end;
But when Mouse not in Table then press ctrl+a is OK .
please help me
Code: Select all
if ( ssCtrl in Shift ) and (Key = ord('A')) then
begin
ActiveEditor.RichViewEdit.SelectAll;
end;
it's OK use an action with Ctrl+A shortcut.Sergey Tkachenko wrote:TRichViewEdit does not allow destroying a cell inplace editor inside OnKeyDown event (unfortunately it cannot be fixed because of VCL design).
Any method that moves the caret outside the cell, including SelectAll, destroys the cell inplace editor, so it cannot be called from OnKeyDown.
Solution:
1) (recommended) use an action or a menu item with Ctrl+A shortcut
2) Use PostMessage with a custom message to call SelectAll not in OnKeyDown, but after. Let me know if you need an example.
my version SCALRICH4.6.1Sergey Tkachenko wrote:What version of TRichView do you use? Newer versions have some changes fixing problems in OCX.
PS: making OCX requires a special permission from us.
It's OK if it is made for a private use or use inside a company.
If it is made for a public access (from web or as a part of your application), it is normally OK too, but we need to know details.
It's not OK if this OCX is used in development environment by people who are not registered TRichView users, it requires a separate license.
Code: Select all
RVA_GetRichViewEditFromPopupComponent :=
SRVGetRichViewEditFromPopupComponent;
RVA_GetRichViewEdit := SRVGetRichViewEdit;
I Has been sent to youSergey Tkachenko wrote:Hello,
In the new version of ScaleRichView, the codeis not needed - delete it.Code: Select all
RVA_GetRichViewEditFromPopupComponent := SRVGetRichViewEditFromPopupComponent; RVA_GetRichViewEdit := SRVGetRichViewEdit;
You can find updated ScaleRichView ActionTest demos here:
http://www.trichview.com/rvfiles/scaler ... _demos.zip
Please send me a project reproducing problems to email richviewgmailcom (insert @ and .).
Code: Select all
type
TrvActionAccess = class(TrvAction);
function TForm3.GetRVAControlFor(Action: TAction): TControl;
begin
if Action is TsrvAction then
Result := SRichViewEdit1
else if Action is TsrvAction then
Result := SRVGetRichViewEdit(SRichViewEdit1.RichViewEdit,
TrvActionAccess(Action).RequiresMainDoc)
else
Result := SRichViewEdit1.RichViewEdit;
end;
procedure TForm3.Timer1Timer(Sender: TObject);
var i: Integer;
begin
for i := 0 to srvActionsResource.ComponentCount-1 do
if srvActionsResource.Components[i] is TAction then
TAction(srvActionsResource.Components[i]).UpdateTarget(GetRVAControlFor(TAction(srvActionsResource.Components[i])));
end;
procedure TForm3.DoActionsExecute(Sender: TObject);
begin
TAction(Sender).ExecuteTarget(GetRVAControlFor(TAction(Sender)));
end;
Code: Select all
for i := 0 to srvActionsResource.ComponentCount-1 do
if srvActionsResource.Components[i] is TAction then
TAction(srvActionsResource.Components[i]).OnExecute := DoActionsExecute;
Code: Select all
function TTest_OCX.GetRVAControlFor(Action: TAction): TControl;
begin
if Action is TsrvAction then
Result := srv
else if Action is TsrvAction then
[color=red]Result := srv.RichViewEdit.SRVGetActiveEditor(TrvActionAccess(Action).RequiresMainDoc)[/color]
else
Result := srv.RichViewEdit;
end;
THANKSSergey Tkachenko wrote:Code: Select all
function TTest_OCX.GetRVAControlFor(Action: TAction): TControl; begin if Action is TsrvAction then Result := srv else if Action is TsrvAction then [color=red]Result := srv.RichViewEdit.SRVGetActiveEditor(TrvActionAccess(Action).RequiresMainDoc)[/color] else Result := srv.RichViewEdit; end;
Code: Select all
function OCXKeyEvent(var Message: TMessage): boolean;
procedure WndProc(var Message: TMessage); override;
Code: Select all
procedure TTest_OCX.WndProc(var Message: TMessage);
begin
if not OCXKeyEvent(Message) then
inherited;
end;
function TTest_OCX.OCXKeyEvent(var Message: TMessage):boolean;
var msg: TMsg;
begin
result := true;
case Message.Msg of
WM_GETDLGCODE: begin
Message.Result := DLGC_WANTTAB or DLGC_WANTARROWS;
end;
WM_CHAR: begin
if Message.WParam = 9 then
srv.ActiveEditor.InsertTab;
end;
WM_KEYDOWN: begin
if Message.WParam in
[
VK_LEFT,
VK_RIGHT,
VK_UP,
VK_DOWN,
VK_TAB,
VK_HOME,
VK_END,
VK_INSERT,
VK_PRIOR,
VK_NEXT
]
then begin
msg.hwnd := GetFocus;
msg.message := Message.Msg;
Msg.WParam := Message.WParam;
Msg.LParam := Message.LParam;
Msg.time := 0;
Msg.pt := point(0,0);
DispatchMessage(msg);
end;
end
else
result := false;
end;
end;
Code: Select all
for i := 0 to ComponentCount-1 do begin
if Components[i] is TsrvAction then
TsrvAction(Components[i]).Control := srv
else if Components[i] is TrvAction then
TrvAction(Components[i]).Control := srv;
if Components[i] is TAction then
TAction(Components[i]).OnExecute := DoActionsExecute;
Code: Select all
for i := 0 to ComponentCount-1 do
if Components[i] is TAction then
TAction(Components[i]).UpdateTarget(GetRVAControlFor(TAction(Components[i])));
kisshexuxia wrote:Can you send me the DEMO what have modified
I try to modif the code
1.2.replaceCode: Select all
if not Assigned(srvActionsResource) then begin Application.CreateForm(TsrvActionsResource, srvActionsResource); end;
Change the code in TTest_OCX.ActiveFormCreate to:Change the timer code:Code: Select all
for i := 0 to ComponentCount-1 do begin if Components[i] is TsrvAction then TsrvAction(Components[i]).Control := srv else if Components[i] is TrvAction then TrvAction(Components[i]).Control := srv; if Components[i] is TAction then TAction(Components[i]).OnExecute := DoActionsExecute;
3.Remove ActionList1 from the datamodule and insert it in TTest_OCX form instead (cut to the Clipboard and paste).Code: Select all
for i := 0 to ComponentCount-1 do if Components[i] is TAction then TAction(Components[i]).UpdateTarget(GetRVAControlFor(TAction(Components[i])));
4.modif the RVAPopupMenu1.ActionList to ActionList1.
it show class TsrvActionExport not found