SelectAll in Table is ERROR

General TRichView support forum. Please post your questions here
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

SelectAll in Table is ERROR

Post by kisshexuxia »

code in SRichViewEdit1.ONkeydown

Code: Select all

  
  if  ( ssCtrl in Shift ) and (Key = ord('A')) then
    begin
      ActiveEditor.RichViewEdit.SelectAll;
    end;
When I Move Mouse in Table,then press ctrl+a TO SelectAll is ERROR
But when Mouse not in Table then press ctrl+a is OK .

please help me
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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.
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

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.
it's OK use an action with Ctrl+A shortcut.
my code in OCX then the up,down,left ,right. is not work
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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.
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

Sergey 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.
my version SCALRICH4.6.1
RichViewv13.10.1
it have registered
i have a other version
Richview13.11.1
SCALRICH4.7

what version have some changes fixing problems in OCX
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Download newest versions of TRichView, RichViewActions and ScaleRichView from the same links as you received when registered.
The newest version of TRichView is 13.13, SRV 4.8.

If the problem still exists, please send a simple project reproducing it to richviewgmailcom
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

Hi Sergey Tkachenko

I try to new versions of TRichView is 13.13, SRV 4.8.

It¡¯s error too.

I write a demo



1. Click button to open form2,when only open one form2,the popupmenu is right,but key left,up,down,right is not work.

2. when open two form2(click twice open button ),don¡¯t close one , the popupmenu is¡¯t work .

I put a time to made to work but it error in new versions(in ocx and dll the dmActionsSRVAlpha don't work)

SRVGetRichViewEdit don¡¯t in SclRView.pas



3. when the focus on second form I uses popupmenu paste(don¡¯t use CRTL+V), but the content is on first form
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Hello,

In the new version of ScaleRichView, the code

Code: Select all

RVA_GetRichViewEditFromPopupComponent := 
   SRVGetRichViewEditFromPopupComponent; 
  RVA_GetRichViewEdit := SRVGetRichViewEdit;
is not needed - delete it.

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 .).
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

Sergey Tkachenko wrote:Hello,

In the new version of ScaleRichView, the code

Code: Select all

RVA_GetRichViewEditFromPopupComponent := 
   SRVGetRichViewEditFromPopupComponent; 
  RVA_GetRichViewEdit := SRVGetRichViewEdit;
is not needed - delete it.

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 .).
I Has been sent to you
but i don't know how to modif this demos

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;
In FormCreate:

Code: Select all

  for i := 0 to srvActionsResource.ComponentCount-1 do
    if srvActionsResource.Components[i] is TAction then
      TAction(srvActionsResource.Components[i]).OnExecute := DoActionsExecute;
[/quote]
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

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;
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

Sergey 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;
THANKS
the error in OCX ,please help me thank you very much
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I found the solution in the Internet. Here it is with some modifications:

In TTest_OCX declaration:

Code: Select all

    function OCXKeyEvent(var Message: TMessage): boolean;
    procedure WndProc(var Message: TMessage); override;
Implementation:

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;
kisshexuxia
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

thanks It's OK to press left,up, down,right.
But the RVAPopupMenu still work error,when I open two form2 and work on the second form2 . copy ,cut,paste is't work on the
RVAPopupMenu. When i press paste (RVAPopupMenu),it paste on the first
form2.i find when i open two form2 ,it error.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

By default, all actions works with the focused editor. So all buttons and menus in inactive forms work with the editor on the active form.

I assume that you have TRVAControlPanel on the form, with DefaultControl property assigned. In the new version of RichViewActions, the first created RVAControlPanel becomes default, so in this case all actions will work with the first created editor.

I suggest making the following changes:
1) Create only one copy of srvActionsResource (in the code you send to me, you create a new copy TTest_OCX.ActiveFormCreate each time; change the code to create srvActionsResource only if it equals to nil)
2) Do not place TRVAControlPanel on TTest_OCX. Place it on this datamodule instead. Do not assign RVAControlPanel.DefaultControl.
3) Remove ActionList from the datamodule and insert it in TTest_OCX form instead (cut to the Clipboard and paste).
4) Change the code in TTest_OCX.ActiveFormCreate to:

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;
5) Change the timer code:

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
Posts: 29
Joined: Mon May 07, 2012 2:36 am

Post by kisshexuxia »

kisshexuxia wrote:Can you send me the DEMO what have modified
I try to modif the code
1.

Code: Select all

if not Assigned(srvActionsResource) then
  begin
       Application.CreateForm(TsrvActionsResource, srvActionsResource);
  end;
2.replace
Change the code in TTest_OCX.ActiveFormCreate to:

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;
Change the timer code:

Code: Select all

 for i := 0 to ComponentCount-1 do
     if Components[i] is TAction then
TAction(Components[i]).UpdateTarget(GetRVAControlFor(TAction(Components[i])));
3.Remove ActionList1 from the datamodule and insert it in TTest_OCX form instead (cut to the Clipboard and paste).
4.modif the RVAPopupMenu1.ActionList to ActionList1.
it show class TsrvActionExport not found
Post Reply