找回密码
 加入
搜索
查看: 1008|回复: 4

GuiCtrlCreateListView问题,如何让对话框停住不消失.

[复制链接]
发表于 2009-5-27 01:08:38 | 显示全部楼层 |阅读模式
本帖最后由 neity 于 2009-5-27 08:57 编辑

#include <GuiListView.au3>

Dim $data_array[4] = ["", "192.168.1.6 | HP-968B0D898 | Administrator|16:44:31|24/04/2009", _
                        "192.168.1.6 | HP-968B0D898 | Administrator|16:45:08|24/04/2009", _
                        "192.168.1.6 | HP-968B0D898 | Administrator|16:45:14|24/04/2009"]
Dim $data_count    = 3        
               
$GUI = GuiCreate("", 600, 300, 300, 300)
GUISetFont(9, 400, 0, "Lucida Console")
$hListView = GuiCtrlCreateListView("", 5, 5, 550, 200)
_GUICtrlListView_AddColumn($hListView, "IP ADDRESS", 120)
_GUICtrlListView_AddColumn($hListView, "COMPUTER TYPE", 120)
_GUICtrlListView_AddColumn($hListView, "USER", 124)
_GUICtrlListView_AddColumn($hListView, "DATE", 90)
_GUICtrlListView_AddColumn($hListView, "TIME", 90)
GUISetState(@SW_SHOW, $GUI)

For $x = 1 to $data_count
    $y = StringSplit($data_array[$x], "|")
    _GUICtrlListView_AddItem($hListView, $y[1])
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[2], 1)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[3], 2)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[5], 3)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[4], 4)
Next
sleep(5000)
如果不用sleep,怎么让对话框,一直停留,而不自动退出,除非按退出(X).
 楼主| 发表于 2009-5-27 01:09:54 | 显示全部楼层
难题呀,困扰我很久啦,先谢啦,请各位同仁帮个忙啦
发表于 2009-5-27 01:23:52 | 显示全部楼层
晕,这个问题真是....
#include <GuiListView.au3>
#include <GUIConstants.au3>

Dim $data_array[4] = ["", "192.168.1.6 | HP-968B0D898 | Administrator|16:44:31|24/04/2009", _
                        "192.168.1.6 | HP-968B0D898 | Administrator|16:45:08|24/04/2009", _
                        "192.168.1.6 | HP-968B0D898 | Administrator|16:45:14|24/04/2009"]
Dim $data_count    = 3        
                
$GUI = GuiCreate("", 600, 300, 300, 300)
GUISetFont(9, 400, 0, "Lucida Console")
$hListView = GuiCtrlCreateListView("", 5, 5, 550, 200)
_GUICtrlListView_AddColumn($hListView, "IP ADDRESS", 120)
_GUICtrlListView_AddColumn($hListView, "COMPUTER TYPE", 120)
_GUICtrlListView_AddColumn($hListView, "USER", 124)
_GUICtrlListView_AddColumn($hListView, "DATE", 90)
_GUICtrlListView_AddColumn($hListView, "TIME", 90)
GUISetState(@SW_SHOW, $GUI)

For $x = 1 to $data_count
    $y = StringSplit($data_array[$x], "|")
    _GUICtrlListView_AddItem($hListView, $y[1])
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[2], 1)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[3], 2)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[5], 3)
    _GUICtrlListView_AddSubItem($hListView, $x - 1, $y[4], 4)
Next

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
              Exit
EndSwitch
WEnd
代码前加一句:#include <GUIConstants.au3>
末尾加一段while循环来触发gui的事件:例如你想要‘不自动退出,除非按退出(X)’
发表于 2009-5-27 01:25:42 | 显示全部楼层
好好看看skyfree的教程,里面写得已经够浅显了
如果还看不懂就结合帮助文件的例子来学习
这样会避免很多的所谓‘难题呀,困扰我很久啦’的问题了
 楼主| 发表于 2009-5-27 08:56:58 | 显示全部楼层
谢谢!!!!!!!!!!!!!!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 14:25 , Processed in 0.074340 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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