Recent

Author Topic: How can I disable mbMiddle Paste in SynEdit/SynMemo  (Read 4572 times)

sapper

  • New Member
  • *
  • Posts: 35
How can I disable mbMiddle Paste in SynEdit/SynMemo
« on: March 22, 2014, 03:31:36 am »
The CodeTyphon IDE has an option for it so it's possible but how is it done.

I've tried using a  MouseActions for a SynMemo but must be doing something wrong.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5798
    • wiki
Re: How can I disable mbMiddle Paste in SynEdit/SynMemo
« Reply #1 on: March 22, 2014, 11:42:45 am »
You need to set emUseMouseActions im SynEdit.MouseActions

Then edit the actions.

It seems that something broke the property editor though. So you may have to edit them in code.

Also MouseTextActions is not published, only public.

--------------
Publish that field, and recompile the IDE.

Set the option emUseMouseActions, and then in the designer, right click the SynEdit, and "reset mouse actions"

You may have to then select another component, and return to the SynEdit so the Object Inspector is updated.

Then edit the actions
« Last Edit: March 22, 2014, 12:08:04 pm by Martin_fr »

sapper

  • New Member
  • *
  • Posts: 35
Re: How can I disable mbMiddle Paste in SynEdit/SynMemo
« Reply #2 on: March 23, 2014, 06:11:24 am »
Quote
You need to set emUseMouseActions im SynEdit.MouseActions

Should this be in SynEdit.MouseOptions?

Is it correct that once I do that, all the MouseActions are disabled and I have to edit the MouseActions to get back the ones I do want like scroll etc?


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5798
    • wiki
Re: How can I disable mbMiddle Paste in SynEdit/SynMemo
« Reply #3 on: March 23, 2014, 03:05:14 pm »
Yes, emUseMouseActions  is in  SynEdit.MouseOptions. I mixed up the fields.

Yes, if you set this, then all mouse behaviour goes via actions.
BUT you do not have to create all of them by hand.

- First set emUseMouseActions 
- Then right click the SynEdit on the designer. There is an entry "Reset Mouse Actions". This will create all mouse actions, according to the current config (as it would be if emUseMouseActions was not set)


"Reset Mouse Actions" only works if emUseMouseActions is set. SO the above order is important.

--------------------
You still need to publish MouseTextActions or you can not edit it. (It will be published in 1.2.2)

The middle mouse action is in MouseTextActions. It can be removed, once you did the above steps. Once removed you have exactly what you want.

-------------------------
Note: This is a collection, and the collection property editor has a bug. It does not always update.

After "Reset Mouse Actions" select the form in the designer, then back to the synedit.
Then open ('...') the MouseSelActions, ignore what the property editor shows, close it.
And now you can go for the MouseTextActions (open with '...')

-------------------------

I know, that even ignoring the bugs above, it seems complicated to have to  do this using mouse actions.

But in the past, I encountered lots and lots of different requests, how people wanted SynEdit to deal with various Mouse input.
Adding more and more Options, would not have been practical. So there needed to be something more flexible.

sapper

  • New Member
  • *
  • Posts: 35
Re: How can I disable mbMiddle Paste in SynEdit/SynMemo
« Reply #4 on: March 24, 2014, 01:26:18 am »
Thanks for your help.

I was going to try doing it in code since I didn't want to rebuild CodeTyphon's BigIde.

I decided to follow your instructions and rebuild the Lazarus IDE and now see the MouseTextActions etc in the property editor so I can change them.

I did wonder why the keycommands were there but no Mouse ones.

edit:

The MouseOptions don't appear in the property editor for SynMemo. Is that correct?

edit2:

This code ok?
Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
var
  i : integer;
  s : string;
begin
  SynMemo1.MouseOptions:=[emUseMouseActions];
  Synmemo1.ResetMouseActions;
  for i:= 0 to SynMemo1.MouseTextActions.Count - 1  do
  begin
    s := SynMemo1.MouseTextActions.Items[i].DisplayName;
    if  s = 'Quick Paste Selection' then
    SynMemo1.MouseTextActions.Items[i].Command:=emcNone; //Synmemo1.MouseTextActions.Delete(i);
  end;
end;   
           
« Last Edit: March 24, 2014, 12:38:03 pm by sapper »