[AHKv2] - Update the GUI Edit value with visible text Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

[AHKv2] - Update the GUI Edit value with visible text

17 Nov 2020, 12:09

Hello little friends ...

I have a problem to dynamically update the display of a text in a simple GUI.
I'm using this code that I adapted from Window Spy as a debug:

Code: Select all

DebugGui := Gui.New()
DebugGui.Add("Edit","w320 r3 ReadOnly vDebugView")
DebugGui.Show("NoActivate")

DetectHiddenText 0				;
ovVisText := WinGetText()			; put in the loop of my code
UpdateText("DebugView", ovVisText)  ;

UpdateText(vCtl, NewText) {
	static OldText := {}
	ctl := DebugGui[vCtl], hCtl := Integer(ctl.hwnd)
    ;msgbox hCtl
	
	if (!oldText.HasProp(hCtl) Or OldText.%hCtl% != NewText) {
		ctl.Value := NewText
		OldText.%hCtl% := NewText
	}
}
It is working well, without problems, but I wanted to learn how to pass the value directly to Gui Edit, without checking the old text with the new one and without this function.
It would look something like this:

Code: Select all

DebugGui := Gui.New()
DebugGui.Add("Edit","w320 r3 ReadOnly vDebugView")
DebugGui.Show("NoActivate")

DetectHiddenText 0
DebugGui.DebugView.Value := WinGetText()
Already tried:

Code: Select all

DebugGui.vDebugView.Value := WinGetText()
vDebugView.Value := WinGetText()
DebugGui.DebugView.Value := WinGetText()
DebugView.Value := WinGetText()
DebugGui.Value := WinGetText()
But there is always an error, whether the variable has no value or does not exist or is not an object.
How would be the simplest way to pass the value taken by WinGetText (), directly to Gui Edit?

Thanks to All: D
Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Re: [AHKv2] - Update the GUI Edit value with visible text

17 Nov 2020, 12:14

Sorry, I only saw the AHK2 help topic after clicking.
Could a moderator please move there.
Thanks again.
Last edited by gregster on 17 Nov 2020, 12:57, edited 1 time in total.
Reason: Done!
Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Re: [AHKv2] - Update the GUI Edit value with visible text

17 Nov 2020, 13:02

swagfag wrote:
17 Nov 2020, 12:38

Code: Select all

DebugGui['DebugView'].Value := WinGetText()
Thanks, it worked.

I tried it with square brackets before, but I hadn't used the quotes.

Thanks again.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Quixilvr, V4Friend and 42 guests