找回密码
 加入
搜索
查看: 3362|回复: 2

[GUI管理] view 清除数据问题,望大神指教(已解决)

[复制链接]
发表于 2012-7-20 17:07:51 | 显示全部楼层 |阅读模式
本帖最后由 小凯 于 2012-7-23 10:42 编辑
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=d:\系统文件\桌面\autotem\邮箱\通讯簿sql.kxf
$Form1_1 = GUICreate("Form1", 788, 438, 194, 132, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP), BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
$ListView1 = GUICtrlCreateListView("公司名称|人数", 8, 8, 186, 422)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 120)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
$ListView1_0 = GUICtrlCreateListViewItem("西丽呼叫中心", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("", $ListView1)
$ListView2 = GUICtrlCreateListView("姓名|Email|隶属分公司", 208, 64, 562, 222)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 200)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 120)
$Button1 = GUICtrlCreateButton("清除", 688, 32, 75, 25)
$Input1 = GUICtrlCreateInput("Input1", 552, 32, 113, 21)
$Combo1 = GUICtrlCreateCombo("模糊查找", 552, 8, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Label1 = GUICtrlCreateLabel("查找模式", 498, 11, 52, 17)
$Label2 = GUICtrlCreateLabel("查找字符", 499, 34, 52, 17)
$Input2 = GUICtrlCreateInput("Input2", 247, 4, 185, 21)
$Label3 = GUICtrlCreateLabel("地址", 216, 8, 28, 17)
$Label4 = GUICtrlCreateLabel("帐号", 216, 37, 28, 17)
$Label5 = GUICtrlCreateLabel("密码", 310, 37, 28, 17)
$Input3 = GUICtrlCreateInput("Input3", 248, 32, 57, 21)
$Input4 = GUICtrlCreateInput("Input3", 341, 32, 89, 21)
$Button2 = GUICtrlCreateButton("连接", 436, 2, 43, 25)
$Button3 = GUICtrlCreateButton("断开", 437, 33, 43, 25)
$Button4 = GUICtrlCreateButton("Button4", 688, 2, 75, 25)
$Button5 = GUICtrlCreateButton("剪切板", 629, 5, 43, 25)
$ListView3 = GUICtrlCreateListView("事件|时间|行为", 208, 293, 562, 134)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 110)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 230)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

For $i = 0 To 20
;~         GUICtrlCreateListViewItem($i&"|"&$i&"|"&$i,$ListView3)
        _GUICtrlListView_InsertItem($ListView3,$i,0)
    _GUICtrlListView_AddSubItem($ListView3, 0,$i, 1)
    _GUICtrlListView_AddSubItem($ListView3, 0, $i, 2)
Next

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        _GUICtrlListView_DeleteAllItems($ListView3)
        EndSwitch
WEnd
For $i = 0 To 20
;~         GUICtrlCreateListViewItem($i&"|"&$i&"|"&$i,$ListView3)
        _GUICtrlListView_InsertItem($ListView3,$i,0)
    _GUICtrlListView_AddSubItem($ListView3, 0,$i, 1)
    _GUICtrlListView_AddSubItem($ListView3, 0, $i, 2)
Next
这里 如果是用GUICtrlCreateListViewItem($i&"|"&$i&"|"&$i,$ListView3) 增加数据的话!!是可以清除掉listview3的数据的!
但是如果用_GUICtrlListView_InsertItem的方法增加数据,_GUICtrlListView_DeleteAllItems却清除不掉...
_GUICtrlListView_InsertItem是插入数据到第一项,因为我想让最新的数据在顶层...

顺道问一下. 有没有类似于C#中if的不等于语法啊?  if $Input1.text != "123"    Input1不等于123. 因为有时候只想检测这个控件数据值不等于指定值就可以了,所以想问下有没有类似的..

请教各位大神了..
新手上路,努力学习中!!!!
发表于 2012-7-20 17:39:58 | 显示全部楼层
1.  
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView3))


2.
if $Input1.text <> "123"
 楼主| 发表于 2012-7-23 10:40:40 | 显示全部楼层
本帖最后由 小凯 于 2012-7-23 10:42 编辑

回复 2# 风行者
又学习到东西了..

Input1.text <> "123"  这个偶尔拿来做数字的条件限制,没想到里边去..
谢谢大神赐教!!! 双休出去活动了,没来论坛`怠慢了大神!见谅!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 22:26 , Processed in 0.103217 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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