“Graphical User Interface” vs “Window Controls”

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

“Graphical User Interface” vs “Window Controls”

24 May 2018, 03:28

As I was just writing How to choose a string from a DropDownList, I realized I'm confused by the help. Content in the left sidebar lists two chapters that both deal with controls: Window \ Controls and Graphical User Interfaces. The former contains e.g. the command Control, while the latter has GuiControl, which both seem to do the same. One difference between the two chapters is that Graphical User Interfaces has the description of GUI, which focusses on custom user interfaces. But that distinction is not made in the command help topics: GuiControl e.g. makes no reference to custom user interfaces, but instead refers, just like its counterpart, to Window Spy for determining ClassNN, which indicates that it, too, is intended for thirt-party controls.

Perusing the archive gives some hints, but nothing decisive:
On Getting rid of the jump when control moves up - sample code:
just me wrote:Don't mix Control... and GuiControl... commands for controls of your own GUI's if possible. [...] The coordinates used/retrieved by GuiControl... commands are always relative to the GUI's client area, whereas ControlGetPos retrieves coordinates relative to the window rectangle:
ControlGetPos wrote:These coordinates are relative to the target window's upper-left corner ...
On Send Complete then MsgBox:
divanebaba wrote:Most reliable commands to fill controls, like Edit, ComboBox and so on, are following commands:
GuiControl, ControlSetText, ControlSend and surely some more.
Check them out for superior speed and most reliability for transfering data even to non-AHK controls.
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: “Graphical User Interface” vs “Window Controls”

24 May 2018, 03:47

GuiControl... commands only work for controls belonging to the script's own windows (GUIs).
GuiControl wrote:ControlID:
If the target control has an associated variable, specify the variable's name as the ControlID (this method takes precedence over the ones described next). For this reason, it is usually best to assign a variable to any control that will later be accessed via GuiControl or GuiControlGet, even if that control is not an input-capable type (such as GroupBox or Text).

Otherwise, ...

[v1.1.04+]: ControlID can be the HWND of a control.

If the control is not on the default GUI, the name or HWND of the GUI must also be specified -- except on [v1.1.20+] when ControlID is a HWND, since each HWND is unique. See Remarks for details.
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: “Graphical User Interface” vs “Window Controls”

24 May 2018, 06:44

just me wrote:GuiControl... commands only work for controls belonging to the script's own windows (GUIs).
Thank you, that confirms my suspicion. The text you quote, however, does not say that explicitly. It seems to me it would improve the help if the "only" part were stated as clearly as you put it.

BTW, you add the explanatory parenthesis “the script's own windows (GUIs)”, which seems to imply that you consider "GUIs" a synonym for “the script's own windows”. That would be different from the common understanding, in which GUI simply stands for “graphical user interface”, which includes pretty much any modern program. If AHK uses the term “GUI” differently from common understanding, then all the more reason to spell that out explicitly in the help.

Conversely, the help should point out that for the script's own windows, where both sets of commands work, the “GUI” commands are more reliable, as divanebaba wrote.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: “Graphical User Interface” vs “Window Controls”

24 May 2018, 07:51

tsssss, i mean.... there are some pretty cryptic things in the docs, but claiming this as one of them is a bit far fetched imo, and dont take it as me being defensive about it, im just sayin

you have the first line reading Makes a variety of changes to a control in a GUI window.
if you scroll further down, youd see the arguments that Sub-command accepts, which are all related to AHK Guis
finally youd notice how GuiControl belongs to the Graphical User Interfaces tree and not Window as is the case with Control
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: “Graphical User Interface” vs “Window Controls”

25 May 2018, 03:46

swagfag wrote:tsssss, i mean.... there are some pretty cryptic things in the docs, but claiming this as one of them is a bit far fetched imo
The word "cryptic" is your choice of words.

What exactly do you mean by "tsssss"? Even with only 3 esses, this can mean anything from disapproval to contempt. Do you disapprove of my question, or even feel contempt? None of what you write gives a reason for doing so, let alone refutes any of my points.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: “Graphical User Interface” vs “Window Controls”

25 May 2018, 04:57

no, i was trying to present you with an outline as to how one might go about deciphering what the difference between Control, ... and GuiControl, ... was.
i didnt refute your points, because the way i see it, there arent any points to refute to begin with.
anyway, if you feel like the man page wasnt clear enough on what the distinction is, feel free to submit a pr clarifying it: https://github.com/Lexikos/AutoHotkey_L-Docs/pulls
StefOnSteroids
Posts: 77
Joined: 08 Aug 2015, 10:22

Re: “Graphical User Interface” vs “Window Controls”

25 May 2018, 07:19

Actually, I did suffer the same confusion as Micromegas. More than once. Until I finally hammered it into my head and wrote it down and re-grouped it into my own personal ahk-manual to make a clear-cut distinction between these 2 categories: one to control regular MS-Win-GUIs, the other to control self-created ahk-GUIs.

The biggest challenge imo, lies in detecting the subtleties of the wording in help manuals. It's easy to miss a beat or skip words that seem commonplace and generic, when in reality, they were used deliberately to form naming patterns or to convey a distinct context - that is lost on newbies like me. Meticulous reading and reading again won't help. A forum like this, however, is awesome.
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: “Graphical User Interface” vs “Window Controls”

25 May 2018, 10:21

Thanks to both of you! To StefOnSteroids for backing me up and to swagfag for providing the link. One more item on my to-do list!
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: “Graphical User Interface” vs “Window Controls”

16 Jun 2018, 02:38

On Send Complete then MsgBox:
divanebaba wrote:Most reliable commands to fill controls, like Edit, ComboBox and so on, are following commands:
GuiControl, ControlSetText, ControlSend and surely some more.
Check them out for superior speed and most reliability for transfering data even to non-AHK controls.
Inside the thread, my contribution above, has been picked I only say, that these commands are more reliable than simulated keystrokes, as the user has used in his code.

As it is still unknown for me, what the user is doing with his keystrokes, I can't say, which command is to prefer.

It is like just me has said,
just me wrote:GuiControl... commands only work for controls belonging to the script's own windows (GUIs).
For foreign Gui's I'm using commands, beginning with Control....

I know the huge IT-books of the 90's. They were sometimes not carryable .
Keeping AHK-help-file slim and preventing dissolutions has advantages and disadvantages.

But all in all, don't you even say, AHK-Help-File is the best, too?
Einfach nur ein toller Typ. :mrgreen:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Exies, JoeWinograd, mikeyww and 130 guests