Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

Discuss the future of the AutoHotkey language
User avatar
Flipeador
Posts: 959
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

15 Jul 2018, 13:17

Gui.FocusedCtrl: Currently retrieves the GuiControl object of the GUI's focused control. But in a ComboBoxEx control the control that takes the focus is the Edit control. I propose to add FocusedCtrlHwnd or that FocusedCtrl return HWND if the control that has the focus was not created by the Add method of the GUI object.

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Gui := GuiCreate()
Gui.AddCustom("ClassComboBoxEx32 +0x40 +0x2")
Gui.AddComboBox()
Gui.Show()
Gui.OnEvent("Close", "ExitApp")
Return

F1::
ToolTip Type(Gui.FocusedCtrl)
Return



ControlGetFocus: I propose that this function returns the control's identifier instead of the ClassNN. Because the identifier is more useful. Or we can add ControlGetFocusHwnd.


Gui Controls: I would like to know if you intend to improve the methods of the Gui Controls. Currently the methods are of "general scope", very poor. Because of this I have to use a class wrapper. Yes, I know, I can make my own functions, but I would be losing the "comfort" of using the Gui Control Object. As an example, see my class Tab, there is an important method to calculate the display area to know where to put controls, as well as the possibility of adding icons. I know that if you omit the X and Y coordinates, the control automatically adjusts, but, what if we want a different margin? What about the height and width?. This I can apply to almost all controls, its implementation is very poor.
I would also like to remove the ComboBox control and replace it with ComboBoxEx. Also see my class, I think it is the most appropriate behavior (see the Focused property).
I also want to ask about behavior that I do not understand in my class. If you change the Text parameter to ByRef in the FindString method, then when you use it with #Warn it gives you a warning, I do not know why.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User avatar
jeeswg
Posts: 4791
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

18 Jul 2018, 20:18

- I like the ControlGetFocusHwnd idea. It's mentioned on my Wish List 2.0.

Code: [Select all] [Download] GeSHi © Codebox Plus

vCtlClassNN := ControlGetFocus("A")
hCtl := ControlGetHwnd(vCtlClassNN, "A")

hCtl := ControlGetFocusHwnd("A")

- Assuming that no built-in support was added for further controls, is there any general functionality you would like to see added to facilitate supporting custom controls?
Last edited by jeeswg on 18 Jul 2018, 22:07, edited 1 time in total.
User avatar
Flipeador
Posts: 959
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

18 Jul 2018, 20:46

I like the ControlGetFocusHwnd idea

It seems to be the best option.
Edit* I did not read your comment well, I thought it referred to Gui.FocusedCtrlHwnd. The truth is I am against ClassNN... I prefer that the ControlGetFocus function returns an identifier. For the reason I mentioned above. It is more useful.

Assuming that no built-in support was added for further controls, is there any general functionality you would like to see added to facilitate supporting custom controls?

I'm not sure what you mean. I'm not interested in custom controls.
I am proposing to dedicate a separate section for each control, where their own methods are described. As an example, it has the ListView control. Of course, this only makes sense if, as I propose, more methods are added. When you are going to make a minimally decent user interface, the current implementation is not good. You have to resort to functions, and you lose the comfort of using the built-in class object.
Regarding the ComboBox control, I propose to replace it with ComboBoxEx.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User avatar
jeeswg
Posts: 4791
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

18 Jul 2018, 21:17

- There's a distinction:
- (1) Built-in support for control type X because it's convenient.
- (2) Built-in support for control type X because key functionality is currently impossible with the generic custom control support.
- Although I would welcome built-in support simply for convenience, improving the support for custom controls in general, would be my priority. And I would be interested in any suggestions you might have, since presumably you've experienced problems using ComboBoxEx controls alongside the built-in GUI functionality.
User avatar
Flipeador
Posts: 959
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

18 Jul 2018, 21:54

presumably you've experienced problems using ComboBoxEx controls alongside the built-in GUI functionality

The only problem I'm having is in Gui.FocusedCtrl. It's useless with ComboBoxEx controls. I still do not understand what you mean :lol:.

There's a distinction [...]

I am proposing to add more methods to the controls in general, and modify the current behavior in some others. :!: :?:


Note: I edited my comment above, I misunderstood you.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
User avatar
jeeswg
Posts: 4791
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

18 Jul 2018, 22:13

- Here is the documentation for custom controls:
GUI Control Types
https://lexikos.github.io/v2/docs/commands/GuiControls.htm#Custom
- Are there more things that need considering in your view?
- Presumably you would prefer ComboBoxEx to be built-in, but let's say it wasn't. What generic functionality, applicable to all built-in/custom control types might be useful to facilitate using ComboBoxEx (or another control type) as a custom control.
- Also, are there any other custom control types that you use regularly?
User avatar
Flipeador
Posts: 959
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Gui Controls | Gui.FocusedCtrl | ControlGetFocus | ComboBoxEx

19 Jul 2018, 08:43

What generic functionality, applicable to all built-in/custom control types might be useful to facilitate using ComboBoxEx (or another control type) as a custom control

I do not know, this is not what is being discussed here. I'm not interested in any generic behavior for all Custom controls. Here we are discussing the current behavior of the built-in functionality. I'm not interested in adding the ComboBoxEx control (as a new one). If the ComboBox control is replaced by ComboBoxEx, Gui.FocusedCtrlHwnd would not make sense, since we can adapt Gui.FocusedCtrl for a special handling with ComboBoxEx controls. ComboBoxEx_Gui_CtrlObj.Focused would return 1 if the edit control has the focus, 2 if the ComboBox has it (the drop-down list is shown) and 0 if it does not have the focus (as it is in my class).

Also, are there any other custom control types that you use regularly?

I do not know what this has to do with this topic, but not at the moment. I proposed to add the Toolbar control in another topic. :?
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 3 guests