Recent

Author Topic: Disable tooltip text under mouse while selecting text?  (Read 2544 times)

SuperSathanas

  • Newbie
  • Posts: 2
Disable tooltip text under mouse while selecting text?
« on: June 30, 2023, 02:56:01 pm »
I'm using Lazarus 2.2.6. If it matters at all, I'm using it with Linux Mint 21.1 Vera with Mate Desktop, Debian 12 Bookworm with Gnome, and Windows 10 (sparingly and begrudgingly).

I'm experiencing the mild inconvenience of having my text selections with the mouse in the source editor interrupted by tooltip text if I let the mouse hover over a word for too long. Some obvious solutions are to use the keyboard to select text and/or to adjust the delay before the tooltip is displayed. However, in my ideal world, tooltip display is almost immediate and I select text with the mouse, so I figured I'd try to achieve that before resigning to sucking it up and changing my ways.

I've looked through all the options and don't see anything that seems relevant. Is there a way to keep the tooltip from displaying while I'm selecting text in the source editor?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9844
  • Debugger - SynEdit - and more
    • wiki
Re: Disable tooltip text under mouse while selecting text?
« Reply #1 on: June 30, 2023, 03:51:51 pm »
I am not aware of a setting.

You can (at least as workaround) increase the time before the hint shows up: Tools > Options: > Editor > Completion and Hints: "Delay for hints" (middle slider).

---
For all else, if there isn't already a request, you can add a feature request. (on the bug tracker)

Personally, I agree, I don't see much use for a hint if the mouse button is down (either while selecting, or while drag/dropping text)

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: Disable tooltip text under mouse while selecting text?
« Reply #2 on: June 30, 2023, 07:27:53 pm »
May be there is a workaround.
Not sure, if this works for you, because it is very old code for me.
In one case I lifted up the hint window for some pixel by this

Code: Pascal  [Select][+][-]
  1. // verschiebt das Ausgabefenster vom Mauscursor weg
  2. procedure TFrame1.Hint_bacoHintLocation(ATool: TDataPointHintTool;
  3.   AHintSize: TSize; var APoint: TPoint);
  4. begin
  5.    APoint.Y := APoint.Y - AHintSize.CY;
  6. end;

Not sure, which events your item supports.
What you see above is a part / method of the TAChart component.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9844
  • Debugger - SynEdit - and more
    • wiki
Re: Disable tooltip text under mouse while selecting text?
« Reply #3 on: June 30, 2023, 07:43:46 pm »
I might be missing something, but I don't see the point of moving the hint somewhere else? It still be the hint poping up.

Btw, in my testing (on Win), the hint does pop up, but as soon as I continue moving the mouse the hint closes and I continue selecting.

In any case, from memory, in  ide/sourceeditor.pp should be a hint timer. Which IIRC is used to open the hint. That would have to somehow check, if the mouse button is down....

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: Disable tooltip text under mouse while selecting text?
« Reply #4 on: June 30, 2023, 07:55:44 pm »
In some cases the hint gave me too many troubles.
Then I switched the hint off and wrote the text to an panel or similar, which has more options.
In one case I used a Richmemo which serves me fine. Just a few lines and does nothing but showing mouse hover over text.

SuperSathanas

  • Newbie
  • Posts: 2
Re: Disable tooltip text under mouse while selecting text?
« Reply #5 on: June 30, 2023, 10:26:58 pm »
I've already adjusted the delay for hints, and it works fine, I suppose, save for all the times now that I want the hint and I start thinking "all these half second delays sure are adding up." It's something I can live with, but also something that just rubs me wrong right now, probably because I've been working on some X11 windowing and input handling.

I see now that this has been mentioned in the bug tracker about 4 months ago.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9844
  • Debugger - SynEdit - and more
    • wiki
Re: Disable tooltip text under mouse while selecting text?
« Reply #6 on: June 30, 2023, 11:34:39 pm »
Below patch (for main or 3.0) will suppress that hint. At least on Windows / not tested on others.

It's not a final solution. The test via capture is just a workaround, and needs to be improved.


Code: Diff  [Select][+][-]
  1. diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp
  2. index 7430d24da0..58d122a62c 100644
  3. --- a/ide/sourceeditor.pp
  4. +++ b/ide/sourceeditor.pp
  5. @@ -9476,10 +9476,18 @@ procedure TSourceNotebook.EndAutoFocusLock;
  6.  
  7.  procedure TSourceNotebook.EditorMouseMove(Sender: TObject; Shift: TShiftstate;
  8.    X, Y: Integer);
  9. +var
  10. +  SrcEdit: TSourceEditor;
  11.  begin
  12.    Manager.FHints.HideAutoHintAfterMouseMoved;
  13. -  if Visible then
  14. -    Manager.FHints.UpdateHintTimer;
  15. +  if Visible then begin
  16. +    SrcEdit:=GetActiveSE;
  17. +    if SrcEdit.EditorComponent.Handle = Mouse.Capture
  18. +    then
  19. +      Manager.FHints.HideAutoHint
  20. +    else
  21. +      Manager.FHints.UpdateHintTimer;
  22. +  end
  23.  end;
  24.  
  25.  procedure TSourceNotebook.EditorMouseWheel(Sender: TObject; Shift: TShiftState;
  26.  

 

TinyPortal © 2005-2018