Re: Activate sorting using GUICtrlRegisterListViewSort without mouse, a question
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Someone from AutoItScript forum wrote:
http://www.autoitscript.com/forum/index.php?showtopic=44320
"Primarily, I'm trying to figure out how to do the sort on
initialization of the GUI. I'm not asking for you to write the script
(because I don't want you to)."
It's a good idea to call UDF _GUICtrlListViewSort() before GUISetState
()
Example:
#include <GUIConstants.au3>
#include <GuiListview.au3>
$hGUI = GUICreate("Test", 300, 200)
$lv = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180)
$lvi2 = GUICtrlCreateListViewItem("DEF|444|11.05.2005", $lv)
GUICtrlSetImage(-1, "shell32.dll", 12)
$lvi3 = GUICtrlCreateListViewItem("CDE|666|12.05.2004", $lv)
GUICtrlSetImage(-1, "shell32.dll", 3)
$lvi1 = GUICtrlCreateListViewItem("ABC|555|10.05.2004", $lv)
GUICtrlSetImage(-1, "shell32.dll", 7)
$Sort = False
; 0 - first column; 1 - second column; ...
$nColumn = 1
_GUICtrlListViewSort($lv, $Sort, $nColumn)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Valery