Page 2 of 2

Re: Combobox Bug

Posted: 06 Apr 2018, 09:00
by jeeswg
- 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

Re: Combobox Bug

Posted: 06 Apr 2018, 17:21
by lexikos
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.

Re: Combobox Bug  Topic is solved

Posted: 07 Apr 2018, 21:20
by lexikos
Both issues are fixed in v1.1.28.02.

Re: Combobox Bug

Posted: 19 Sep 2018, 18:51
by jeeswg
- 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

Re: Combobox Bug

Posted: 21 Sep 2018, 11:52
by malcev
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