728x90

SAVE: 
ControlGet, GetListBox_List, List,, Listbox1, A 

IniRead, QT, Set.ini, Common, QT, 0 

Loop, % QT 
  IniDelete, Set.ini, Common, %A_Index% 

Loop, Parse, GetListBox_List,`n 

  SetQT := A_Index 
  IniWrite, %A_LoopField%, Set.ini,Common, %A_Index% 

iniWrite, %SetQT%, Set.ini,Common, QT 
Return 

LOAD: 
GuiControl,,검색어리스트,| 
IniRead, QT, Set.ini, Common, QT, 0 

SetList := "" 
Loop, % QT 

  IniRead, GetList , Set.ini, Common, %A_Index% 
  SetList .= GetList "|" 

StringTrimRight, SetList, SetList , 1 
GuiControl,,검색어리스트,%SetList% 
Return 



리스트박스 안에서 개체를 선택하고, 삭제하고 등등의 역할을 할 수 있는데 위와 같은 방법으로 Listbox 를 다루다가는 굉장히 더러워지고 접근이 어려워지게 된다.


보다 좋은 방책은 ListView 를 사용하는 것인데, 이 안에서는 매우 다양한 함수를 이용하여 데이터를 가공하고 저장할 수 있게 해놨다.



Multi옵션으로 복수 선택가능으로 하고 있는 경우, 아래와 같이 해 모든 항목을 선택·선택 해제할 수 있다.

Gui +LastFound  ; Avoids the need to specify WinTitle below.
If(V)
    PostMessage, 0x185, 1, -1, ListBox1  ; Select all items. 0x185 is LB_SETSEL.
else
    PostMessage, 0x185, 0, -1, ListBox1  ; Deselect all items.




'AUTOHOTKEY' 카테고리의 다른 글

iPad 에서도 구동이 가능하다!  (0) 2019.02.22
ControlSend 와 Nox에 관한 고찰  (0) 2019.02.22
Line number in listbox  (0) 2019.02.20
ControlGet 에 관한 고찰  (0) 2019.02.20
GetText from ListBox  (0) 2019.02.20

+ Recent posts