找回密码
 加入
搜索
查看: 2291|回复: 3

GUICtrlCreateListView的列表刷新问题

[复制链接]
发表于 2008-5-23 06:25:20 | 显示全部楼层 |阅读模式
下在这个例中,我想点这样操作,点一下“读取列表”,将重新读入ini的 IniReadSectionNames内容,
可是点了一下后,倒是取出来了,但以前的还在,成了重复的了;再点一下,成三个重复的内容了,
能不能,点下后,清空,然后重新读取,请求帮助

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <Process.au3>
#include <GUIConstants.au3>
#include <guiconstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>



$Form1 = GUICreate("Form1", 604, 546, 508, 164)
$ListView1 = GUICtrlCreateListView(" 列表:", 12, 46, 557, 453, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES, $LVS_EX_TRACKSELECT, $LVS_EX_HEADERDRAGDROP, $WS_HSCROLL, $WS_VSCROLL))
$Button1 = GUICtrlCreateButton("读取列表", 160, 8, 265, 33, -1, $WS_EX_CLIENTEDGE)


GUISetState(@SW_SHOW)


Global $inipath = @ScriptDir & "\列表.ini"



While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        _Quit()
                Case $Button1
                        CheckIni()
        EndSwitch
WEnd


Func CheckIni()
        Local $ReadIni
        $ReadIni = IniReadSectionNames($inipath)
        If @error Then
                MsgBox(4096, "", "Error occurred, probably no INI file.")
        Else
                For $i = 1 To $ReadIni[0]
                        $item = GUICtrlCreateListViewItem($ReadIni[$i], $ListView1)
                        $item = GUICtrlSetData($ReadIni[$i], $ListView1)
                Next
        EndIf
        $num = String(GUICtrlRead(GUICtrlRead($ListView1)))
EndFunc   ;==>CheckIni


Func _Quit()
        Exit
EndFunc   ;==>_Quit


[ 本帖最后由 木纳 于 2008-5-23 11:18 编辑 ]
 楼主| 发表于 2008-5-23 11:18:33 | 显示全部楼层
谢谢,感谢二楼兄弟,,,
发表于 2009-8-29 14:27:45 | 显示全部楼层
留个记号 用的着了来查
发表于 2010-1-18 14:29:40 | 显示全部楼层
有个专门解决楼主问题的【传送门
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-29 07:49 , Processed in 0.068921 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表