Re: Script idea for an expert: typing in list view
Posted: 19 Jul 2017, 09:20
I created a ListBox (Windows 7), and didn't have this problem:
On a single-select ListBox, LB_SETCURSEL worked.
On a single-select ListBox, LB_SETCURSEL worked.
Code: Select all
q::
vIndex := 3
ControlGet, hCtl, Hwnd,, ListBox1, A
;on single-select listbox:
;did nothing:
;PostMessage, 0x19E, % vIndex-1, 0,, % "ahk_id " hCtl ;LB_SETCARETINDEX := 0x19E
;set focus and selection (worked):
PostMessage, 0x186, % vIndex-1, 0,, % "ahk_id " hCtl ;LB_SETCURSEL := 0x186
;on multi-select listbox:
;set focus but not selection:
;PostMessage, 0x19E, % vIndex-1, 0,, % "ahk_id " hCtl ;LB_SETCARETINDEX := 0x19E
;did nothing:
;PostMessage, 0x186, % vIndex-1, 0,, % "ahk_id " hCtl ;LB_SETCURSEL := 0x186
return