G-Label for edit field not triggered Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
highend
Posts: 47
Joined: 24 Nov 2014, 16:57

G-Label for edit field not triggered

Post by highend » 11 Sep 2016, 15:05

Hi,

don't know if this is a bug or if I'm just missing anything...

The following code creates a new gui and displays an edit field and a listview, populated with two rows
When you double click on one of the rows, it's text is inserted into the edit field.

The problem:
The G-Label for the edit field isn't triggered when you use the option "r2" (or higher) or a high "h<value>" so that
more than one line is displayed (with an additional scroll bar). If you use "r1" or a low number for h<value>,
or leave out r<value> or h<value> completely, the G-Label is triggered...

Code: Select all

#NoEnv
#SingleInstance Force
#Persistent

Gui, New
Gui, Add, Edit, w200 r2 vEW_Execute gEW_Execute
Gui, Add, ListView, w200 gMyListView, Name
LV_Add("", "me")
LV_Add("", "you")
Gui, Show
return

EW_Execute:
	MsgBox, Edit G-Label triggered
return

MyListView:
	if (A_GuiEvent = "DoubleClick") {
		row := A_EventInfo
		LV_GetText(rowText, row)

		ControlSetText, % EW_Execute, % rowText
	}
return
Last edited by highend on 12 Sep 2016, 02:36, edited 1 time in total.

punchin
Posts: 439
Joined: 17 Jan 2014, 17:54

Re: G-Label for edit field not triggered

Post by punchin » 11 Sep 2016, 17:08

I'm not having any issues with your code. The message box pops up no matter how many rows I put in or how high I make it. Is there more to your code that's left out of the example?

highend
Posts: 47
Joined: 24 Nov 2014, 16:57

Re: G-Label for edit field not triggered

Post by highend » 11 Sep 2016, 17:52

Is there more to your code that's left out of the example?
Nope, I've written it only to demonstrate the issue. I noticed the problem in one of my major projects (multiple thousand lines) and wanted to make sure the error is not elsewhere

I'm using AHK v1.1.24.01 x86 Unicode to run this script and regardless if I run it compiled or non-compiled, the problem persists. Additionally ran it under Windows 7 x64 SP1 de-DE (I'm using Server 2012 R2 U1 x64 de-DE on my development machine) and it's not working as it should on either of them

garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: G-Label for edit field not triggered

Post by garry » 12 Sep 2016, 01:57

if I had more rows ( as r1 ) send %rowtext%{enter}

Code: Select all

#SingleInstance, Force
#NoEnv
SendMode Input
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1

Gui, New
Gui, Add, Edit, w200 r4 vEW_Execute gEW_Execute1
Gui, Add, ListView, w200 gMyListView vLV1 +altsubmit, Name
LV_Add("", "me")
LV_Add("", "you")
Gui, Show,,TEST
return

EW_Execute1:
Gui,submit,nohide
msgbox, 262208, ,Edit G-Label triggered,1
return

MyListView:
Gui,submit,nohide
Gui,ListView, LV1
	if (A_GuiEvent = "Normal") {
		row := A_EventInfo
		LV_GetText(rowText, row)
                ControlSend, Edit1,%rowtext%{enter}
	}
return

just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: G-Label for edit field not triggered

Post by just me » 12 Sep 2016, 02:08

highend wrote:The problem:
The G-Label for the edit field isn't triggered when you use the option "r2" (or higher) or a high "h<value>" so that more than one line is displayed ...
You should specify r2 in your example, so others will notice the problem immediately.
EN_CHANGE wrote:The EN_CHANGE notification code is not sent when the ES_MULTILINE style is used and the text is sent through WM_SETTEXT.

EN_CHANGE notification code
Because you know that the edit has been changed, you can simply Gosub. You have to consider that A_GuiControl isn't the edit in this case.

@garry: ControlSend won't replace the content of the edit.

just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: G-Label for edit field not triggered  Topic is solved

Post by just me » 12 Sep 2016, 04:02

Or ...

Code: Select all

MyListView:
   if (A_GuiEvent = "DoubleClick") {
      row := A_EventInfo
      LV_GetText(rowText, row)
      GuiControl, , EW_Execute                           ; empty the edit
      Control, EditPaste, %rowText%, , ahk_id %HEWEX%    ; 'append' the new text
      ; ControlSetText, % EW_Execute, % rowText          ; % EW_Execute ?????
   }
return

highend
Posts: 47
Joined: 24 Nov 2014, 16:57

Re: G-Label for edit field not triggered

Post by highend » 12 Sep 2016, 07:39

Thanks a bunch!

Control, EditPaste works fine and triggers the G-Label as expected. I'll go that route :)
% EW_Execute ?????
Sorry, that was just a type in there

Post Reply

Return to “Ask for Help (v1)”