[已解决]ListView只顯示想要顯示的項目
本帖最后由 ipmitool 于 2016-10-7 13:51 编辑大大好, 可以設計 check box 然後帶出 listview 裡的 test item, 然後有勾選起來的再顯示出來嗎?
比如說勾選 AAA, 然後 listview 就顯示有 AAA 的項目
#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
Local $path, $aFileList, $aNewList
$path = @ScriptDir
$aFileList = _FileListToArray($path, "*.txt")
Local $iI, $iTimer, $idListview
GUICreate("Test Management v1.0", 800, 300)
$idListview = GUICtrlCreateListView("", 15, 15, 550, 268)
GUISetState(@SW_SHOW)
$Button1 = GuiCtrlCreateButton("-----", 600, 246, 90, 30)
_GUICtrlListView_AddColumn($idListview, "Tester", 100)
_GUICtrlListView_AddColumn($idListview, "Test Item", 100)
_GUICtrlListView_AddColumn($idListview, "BMC IP", 100)
_GUICtrlListView_AddColumn($idListview, "Count", 60)
_GUICtrlListView_AddColumn($idListview, "Last Record Time", 150)
_GUICtrlListView_SetItemCount($idListview, 5000)
If IsArray($aFileList) Then
ReDim $aNewList ;;;
For $i = 0 To UBound($aFileList) - 1 Step 1
$aNewList[$i] = $aFileList[$i]
$aNewList[$i] = FileReadLine($aFileList[$i],1)
$aNewList[$i] = FileReadLine($aFileList[$i],2)
$aNewList[$i] = FileReadLine($aFileList[$i],3)
$aNewList[$i] = FileReadLine($aFileList[$i],4)
Next
; Local $aItems
;For $iI = 0 To UBound($aItems) - 1
; $aItems[$iI] = "Item " & $iI
;Next
;$iTimer = TimerInit()
_GUICtrlListView_AddArray($idListview, $aNewList)
;$idListview=_ArrayDisplay($aNewList, "Test Management v1.0", Default, 32 + 64, Default, "Tester|Test Item|BMC|Count|Last Record Time|...|...|...|...", Default, 0xDDFFDD)
while 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
; Case $Checkupdate1
; Case $Checkupdate2
; Case $Checkupdate3
; Case $Radio1
; Case $Radio2
; Case $Radio3
EndSwitch
WEnd
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndIf
回复 1# ipmitool
可以可以做到你應該是 要做類似ERP 吧
我建議你 看懂下面的文章就可以做到了
http://www.autoitx.com/thread-50083-1-2.html 回复 2# kk_lee69
挖哩...看不明白...下載裡面的範例程式也看不明白在做什麼事情... 回复 3# ipmitool
你想要的功能很難簡單達到.....由 你要的方式 更加困難
簡單點的做法是 在 LISTVIEW 上 按滑鼠右鍵然選擇篩選
然後在 開窗 輸入資料後 篩選
這樣會比你原本的想法簡單多 回复 3# ipmitool
學習 得一步一步
先搞董 LISTVIEW 的 單擊雙擊左點擊右點擊 事件後
你想做的事情 才有可能 回复 1# ipmitool
用查询方法,读取idListview显示到idListview1就可实现
#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
Local $path, $aFileList, $aNewList
$path = @ScriptDir
$aFileList = _FileListToArray($path, "*.txt")
Local $iI, $iTimer, $idListview
GUICreate("Test Management v1.0", 800, 300)
$idListview = GUICtrlCreateListView("", 15, 15, 550, 268)
$idComboBox = GUICtrlCreateCombo("", 600, 246, 90, 30)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($idListview, "Tester", 100)
_GUICtrlListView_AddColumn($idListview, "Test Item", 100)
_GUICtrlListView_AddColumn($idListview, "BMC IP", 100)
_GUICtrlListView_AddColumn($idListview, "Count", 60)
_GUICtrlListView_AddColumn($idListview, "Last Record Time", 150)
If IsArray($aFileList) Then
ReDim $aNewList
Local $sComboTxt = "所有"
For $i = 1 To UBound($aFileList) - 1 Step 1
$aNewList[$i-1] = $aFileList[$i]
$aNewList[$i-1] = FileReadLine($aFileList[$i], 1)
$aNewList[$i-1] = FileReadLine($aFileList[$i], 2)
$aNewList[$i-1] = FileReadLine($aFileList[$i], 3)
$aNewList[$i-1] = FileReadLine($aFileList[$i], 4)
If Not StringInStr($sComboTxt, $aNewList[$i-1]) Then $sComboTxt &= "|" & $aNewList[$i-1]
Next
GUICtrlSetData($idComboBox, $sComboTxt, "所有")
_GUICtrlListView_AddArray($idListview, $aNewList)
EndIf
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $idComboBox
$sComboRead = GUICtrlRead($idComboBox)
If $sComboRead == "所有" Then
_GUICtrlListView_DeleteAllItems($idListview)
_GUICtrlListView_AddArray($idListview, $aNewList)
Else
_GUICtrlListView_DeleteAllItems($idListview)
For $i = 0 To UBound($aNewList) - 1
If $aNewList[$i] == $sComboRead Then
GUICtrlCreateListViewItem($aNewList[$i] & "|" & $aNewList[$i] & "|" & $aNewList[$i] & "|" & $aNewList[$i] & "|" & $aNewList[$i], $idListview)
EndIf
Next
EndIf
EndSwitch
WEnd
好酷喔, 謝謝妳喔~
页:
[1]