Edit control to react on double click?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
braunbaer
Posts: 478
Joined: 22 Feb 2016, 10:49

Edit control to react on double click?

29 Jul 2021, 19:01

Is that possible? The documentation says, the g-label for the edit control is only executed when the content of the control is changed.

I woould like to call a function when a doubleclick into the edit control occurs, and in that function I need to know where the doubleclick was (ideally line number/ char in line, but character number in whole text would also be sufficient (the screen position is not enough, as the text may have been scrolled

I suppose I will need another control (instead of the standard edit control) if I want do highlight some parts of the text with another background color? What controls are currently available for such a purpose?
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Edit control to react on double click?

29 Jul 2021, 20:06

Code: Select all

t = 234567890`n
Gui, Font, s10
Gui, Add, Edit, w200 r20 vttext, 1%t%2%t%3%t%4%t%5%t%6%t%7%t%8%t%9%t%
Gui, Show,, Test
OnMessage(0x0203, "WM_LBUTTONDBLCLK")

WM_LBUTTONDBLCLK(wParam, lParam) {
 If (A_GuiControl != "ttext")
  Return
 ControlGet, lineNum, CurrentLine,, Edit1
 ControlGet, colNum , CurrentCol ,, Edit1
 ToolTip, Line = %lineNum%`nCol  = %colNum%
 SetTimer, Off, -2000
 Return
 Off:
 ToolTip
 Return
}
I'm not sure about background, but other forum posts might describe that. You might be able to use ActiveX with HTML.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, DiegoSouto, mikeyww, robnicholson, Rohwedder, Swiftly9767 and 364 guests