IniRead, IniWrite, IniDelete
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.