找回密码
 加入
搜索
查看: 3070|回复: 10

[GUI管理] 关于多个tab控件内,某个tab自动刷新右边listview里面数据问题

  [复制链接]
发表于 2017-1-9 22:56:00 | 显示全部楼层 |阅读模式
关于多个tab控件内,某个tab控件内,通过左边的设置的按钮点击自动刷新右边listview里面数据问题:例如下面的,每点击一次设计软件,前面的cad都要增加一遍,怎样让他不增加,让他按照通过读取ini文件的数组出现对应的数据。[img][/img]
 楼主| 发表于 2017-1-10 10:06:38 | 显示全部楼层
[img][/img]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2017-1-10 16:14:14 | 显示全部楼层
回复 2# jcaixuexi
上代码,把要解决的问题说清楚。
你这样不是需要帮助,是在出题目

评分

参与人数 1金钱 +10 收起 理由
afan + 10

查看全部评分

发表于 2017-1-10 19:27:16 | 显示全部楼层
每点一次,清除listview数据后,然后再重新获取
 楼主| 发表于 2017-1-10 19:45:01 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinAPISys.au3>
#include <GuiEdit.au3>
#include <array.au3>




#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(8, 8, 593, 417)
$TabSheet1 = GUICtrlCreateTabItem("基础功能")
$TabSheet2 = GUICtrlCreateTabItem("软件安装")
GUICtrlSetState(-1,$GUI_SHOW)
$Group1 = GUICtrlCreateGroup("", 24, 56, 75, 337)
$Button1 = GUICtrlCreateButton("设计软件", 24, 56, 75, 25)
$Button3 = GUICtrlCreateButton("办公软件", 24, 80, 75, 25)
$Button4 = GUICtrlCreateButton("浏览器设置", 24, 104, 75, 25)
$Button5 = GUICtrlCreateButton("文印打印机", 24, 128, 75, 25)
$Button6 = GUICtrlCreateButton("邮箱配置", 24, 152, 75, 25)
$Button7 = GUICtrlCreateButton("系统优化", 24, 176, 75, 25)
$Button8 = GUICtrlCreateButton("其他", 24, 200, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 112, 56, 441, 337)
$ListView1=GUICtrlCreateListView("", 112, 56, 441, 337)
_GUICtrlListView_AddColumn($ListView1, "软件名",100)
_GUICtrlListView_AddColumn($ListView1, "软件架构",60)
_GUICtrlListView_AddColumn($ListView1, "备注",200)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("软件卸载")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


Func _Read()

        Local $IniFile = "D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
        Local $aIni = IniReadSectionNames($IniFile)
        If @error Then Exit MsgBox(4096, "", "错误, 读取INI文件失败.")
        Local $ii, $jj, $var
        For $jj = 1 To $aIni[0]
                $var = IniReadSection($IniFile, $aIni[$jj])
                GUICtrlCreateListViewItem($jj&"|"&$var[1][1]&"|"&$var[2][1],$ListView1)
        Next
EndFunc


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        case  $Button1
             _Read()

        EndSwitch[/code]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2017-1-10 20:13:51 | 显示全部楼层
回复 5# jcaixuexi
Func _Read()
        GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0);清空列表
        Local $IniFile = "D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
        Local $aIni = IniReadSectionNames($IniFile)
        If @error Then Exit MsgBox(4096, "", "错误, 读取INI文件失败.")
        Local $ii, $jj, $var
        For $jj = 1 To $aIni[0]
                $var = IniReadSection($IniFile, $aIni[$jj])
                GUICtrlCreateListViewItem($jj&"|"&$var[1][1]&"|"&$var[2][1],$ListView1)
        Next
EndFunc
 楼主| 发表于 2017-1-10 21:39:18 | 显示全部楼层
回复 6# chzj589




  如果最开始的时候切换到软件安装,鼠标点击软件安装,之后默认就点到设计软件,这个应该怎样设计的[img][/img]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2017-1-10 22:16:43 | 显示全部楼层
回复 7# jcaixuexi

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinAPISys.au3>
#include <GuiEdit.au3>
#include <array.au3>




#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(8, 8, 593, 417)
$TabSheet1 = GUICtrlCreateTabItem("基础功能")
$TabSheet2 = GUICtrlCreateTabItem("软件安装")
GUICtrlSetState(-1,$GUI_SHOW)
$Group1 = GUICtrlCreateGroup("", 24, 56, 75, 337)
$Button1 = GUICtrlCreateButton("设计软件", 24, 56, 75, 25)
$Button3 = GUICtrlCreateButton("办公软件", 24, 80, 75, 25)
$Button4 = GUICtrlCreateButton("浏览器设置", 24, 104, 75, 25)
$Button5 = GUICtrlCreateButton("文印打印机", 24, 128, 75, 25)
$Button6 = GUICtrlCreateButton("邮箱配置", 24, 152, 75, 25)
$Button7 = GUICtrlCreateButton("系统优化", 24, 176, 75, 25)
$Button8 = GUICtrlCreateButton("其他", 24, 200, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 112, 56, 441, 337)
$ListView1=GUICtrlCreateListView("", 112, 56, 441, 337)
_GUICtrlListView_AddColumn($ListView1, "软件名",100)
_GUICtrlListView_AddColumn($ListView1, "软件架构",60)
_GUICtrlListView_AddColumn($ListView1, "备注",200)
_Read()
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("软件卸载")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
 楼主| 发表于 2017-1-11 13:59:41 | 显示全部楼层
回复 8# chzj589


    有没有listview调取ini文件的文档,指引的,或者说整个程序调取ini文件的指引,想学这一块。
 楼主| 发表于 2017-1-11 14:22:33 | 显示全部楼层
回复 8# chzj589
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinAPISys.au3>
#include <GuiEdit.au3>
#include <array.au3>
#include <WinAPIFiles.au3>




#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(8, 8, 593, 417)
$TabSheet1 = GUICtrlCreateTabItem("基础功能")
$TabSheet2 = GUICtrlCreateTabItem("软件安装")
GUICtrlSetState(-1,$GUI_SHOW)
$Group1 = GUICtrlCreateGroup("", 24, 56, 75, 337)
$Button1 = GUICtrlCreateButton("设计软件", 24, 56, 75, 25)
$Button3 = GUICtrlCreateButton("办公软件", 24, 80, 75, 25)
$Button4 = GUICtrlCreateButton("浏览器设置", 24, 104, 75, 25)
$Button5 = GUICtrlCreateButton("文印打印机", 24, 128, 75, 25)
$Button6 = GUICtrlCreateButton("邮箱配置", 24, 152, 75, 25)
$Button7 = GUICtrlCreateButton("系统优化", 24, 176, 75, 25)
$Button8 = GUICtrlCreateButton("其他", 24, 200, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 112, 56, 441, 337)
$ListView1=GUICtrlCreateListView("", 112, 56, 441, 337)
_GUICtrlListView_AddColumn($ListView1, "软件名",100)
_GUICtrlListView_AddColumn($ListView1, "软件架构",60)
_GUICtrlListView_AddColumn($ListView1, "备注",200)

GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("软件卸载")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $cczzgjpzwj="D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
;IniWrite($cczzgjpzwj,"设计软件","CAD2010","64bit")
;IniWrite($cczzgjpzwj,"设计软件","creo3.0","64bit")


Func sj()
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
$sjrj=IniReadSection($cczzgjpzwj,"设计软件")
$lisetviewitem1=GUICtrlCreateListViewItem($sjrj[1][0]&"|"&$sjrj[1][1],$listview1)
$lisetviewitem2=GUICtrlCreateListViewItem($sjrj[2][0]&"|"&$sjrj[2][1],$listview1)
EndFunc



While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                 Case $Button1
                        sj()
     EndSwitch
WEnd
发表于 2017-1-11 14:35:34 | 显示全部楼层
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-25 09:41 , Processed in 0.077909 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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