Combobox Bug Topic is solved

Report problems with documented functionality
User avatar
jeeswg
Posts: 5428
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Combobox Bug

06 Apr 2018, 09:00

- Thanks for your input lexikos. Indeed it appears that GetDlgCtrlID was not necessary.
- This script is working for me on the Notepad (Windows 7) Save As dialog.

Code: Select all

;based on:
;GUI COMMANDS: COMPLETE RETHINK - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=5&t=25893&p=132424#p132424

;tested on Windows 7
q:: ;Notepad (Open/Save As dialog) - set ComboBox to UTF-8
Control, ChooseString, UTF-8, ComboBox3, A
ControlGet, hCtl, Hwnd,, ComboBox3, A
hWndParent := DllCall("user32\GetParent", Ptr,hCtl, Ptr)
;CBN_SELENDOK := 9
SendMessage, 0x111, % (9 << 16), % hCtl,, % "ahk_id " hWndParent ;WM_COMMAND := 0x111
return
- IIRC, it is only by using CBN_SELENDOK := 9 that I have been able to successfully use ComboBoxes on Open/Save As dialogs on Windows 7. The problem was very noticeable when I moved from Windows XP to Windows 7.
- The original script I based the code on used GetWindowLong with GWL_ID, not GetDlgCtrlID:
windows - How to simulate selection change in the "file type" ComboBox in GetSaveFileName dialog from a separate process? - Stack Overflow
http://stackoverflow.com/questions/2895 ... vefilename
lexikos
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Combobox Bug

06 Apr 2018, 17:21

jeeswg wrote:- Thanks for your input lexikos. Indeed it appears that GetDlgCtrlID was not necessary.
In this case. If a control has an ID, it is likely the application uses it to identify the control. If you don't specify the correct ID, it will not work with such applications. If you specify the wrong ID, it will not work and may have unwanted effects. However, Control ChooseString already sends WM_COMMAND if the ID is non-zero, and it will do so if the ID is zero in future.
lexikos
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Combobox Bug  Topic is solved

07 Apr 2018, 21:20

Both issues are fixed in v1.1.28.02.
User avatar
jeeswg
Posts: 5428
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Combobox Bug

19 Sep 2018, 18:51

- Thank you for the fixes.
- It occurred to me to test Control-Choose, this appears not to be working, although Control-ChooseString (which was fixed) is working.

Code: Select all

;e.g. Notepad (Windows 7): test save as UTF-8
;start a new file
;type a Unicode character into the window e.g. √ (square root)
;try to save the file (wait for the Save As dialog to appear)
;check that the encoding is ANSI
;use AHK to set the encoding to UTF-8, and try to save
;see if you get a warning about Unicode characters
;(this would imply that although the ComboBox selection may have changed,
;Notepad has not been informed of the change in selection)

q::
Control, Choose, 4, ComboBox3, A
;Control, ChooseString, UTF-8, ComboBox3, A

;ControlChoose(4, "ComboBox3", "A")
;ControlChooseString("UTF-8", "ComboBox3", "A")
return
malcev
Posts: 105
Joined: 12 Aug 2014, 12:37

Re: Combobox Bug

21 Sep 2018, 11:52

It is not a bug.
It depends on control.
For example this will work with notepad++:

Code: Select all

q::
Control, Choose, 4, ComboBox3, A
And this with notepad:

Code: Select all

q::
setcontroldelay -1
ControlClick, ComboBox3, A,,,, NA
Control, Choose, 4, ComboBox3, A
ControlClick, ComboBox3, A,,,, NA

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests