找回密码
 加入
搜索
楼主: 邪恶海盗

[AU3基础] 如何设置ListView指定列数据输出到Combox供选择??

 火.. [复制链接]
 楼主| 发表于 2012-10-6 17:45:07 | 显示全部楼层
回复 15# netegg


    必需拆,不然数据多了不好处理啊,例如:

11-22
11-23
11-25
11-29
11-222
11-333
11-223
....
CC-55
CC-77
CC-24
CC-39
....

必需用两个来加起来识别...
发表于 2012-10-6 17:58:39 | 显示全部楼层
本帖最后由 netegg 于 2012-10-6 18:01 编辑

回复 16# 邪恶海盗

看错了,不用那个了,$str = stringsplit(_GUICtrlListView_GetItemTextstring(), '-|', 0)拆的时候,两个分隔符都有效,就直接拆开了

不对了,你再说下,最后的combo里到底是些什么数据
 楼主| 发表于 2012-10-6 18:39:05 | 显示全部楼层
回复 17# netegg


    -之后的啊,比如上面的,要求拆开,将11,CC写到第一个框里去,
当选择11的时候,前一个框内显示22,23,25,29,222,333,223,
当选择CC的时候,后一个框里显示55,77,24,39供选择
发表于 2012-10-6 18:50:57 | 显示全部楼层
回复 18# 邪恶海盗

stringsplit(_GUICtrlListView_GetItemTextstring(), '-|', 0)你用这个拆出数据来看看,得到的数组是什么
 楼主| 发表于 2012-10-6 18:57:04 | 显示全部楼层
本帖最后由 邪恶海盗 于 2012-10-6 18:59 编辑

回复 19# netegg


   
For $six =0 To _GUICtrlListView_GetItemCount($List3)-1;获取有数据的行数
        $cci=StringSplit(_GUICtrlListView_GetItemText($list3, $six),"-");提取每行首列数据并分拆字符
                GUICtrlSetData($combo23,$cci[1]);将获取到的数据写入combo24
Next
Case $combo23

        $iI = _GUICtrlListView_FindInText($list3, GUICtrlRead($combo23));搜索combo23所在行
        $mpbz=StringSplit (_GUICtrlListView_GetItemText($list3,$iI),"-");提取指定行首列数据并分拆字符
GUICtrlSetData($combo24,$mpbz[2]);输出获取到的数据到combo24


我是这样写的,问题是框2里面只显示一个,而且框1再选取之后,框2的内容只是增加,原来的不删除
发表于 2012-10-6 19:08:23 | 显示全部楼层
本帖最后由 netegg 于 2012-10-6 19:10 编辑

不对,说乱了,逻辑好像有点问题
 楼主| 发表于 2012-10-6 19:10:37 | 显示全部楼层
本帖最后由 邪恶海盗 于 2012-10-6 19:12 编辑

回复 21# netegg


   解释一下...

我认为这里$iI如果返回的是多个数据地话Combo2就基本正常了,现在的问题是当Combo1选定某个数据的时候,$iI得到的只是一个数值,所以导致Combo2也只有一个数值
发表于 2012-10-6 19:13:04 | 显示全部楼层
本帖最后由 netegg 于 2012-10-6 19:14 编辑

回复 22# 邪恶海盗
你找找listview和treeview联动的例子,论坛里有
 楼主| 发表于 2012-10-6 19:26:01 | 显示全部楼层
回复 23# netegg


    蛋哥直接给出来吧,搜索treeview太多了,都看不懂...
发表于 2012-10-6 19:29:40 | 显示全部楼层
回复 24# 邪恶海盗
水木写过,源码区里,生病了,有点不舒服
 楼主| 发表于 2012-10-6 19:57:04 | 显示全部楼层
回复 25# netegg


    我是说帖子链接啊...


找个MM安慰下???
发表于 2012-10-6 20:03:20 | 显示全部楼层
 楼主| 发表于 2012-10-6 21:10:45 | 显示全部楼层
回复 27# netegg


    好吧,明天有空来研究看看...
发表于 2012-10-7 14:43:53 | 显示全部楼层
这个确实不难吧,多看一下帮助哈
 楼主| 发表于 2012-10-7 15:59:26 | 显示全部楼层
回复 27# netegg


   
#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3>
#Include <GuiImageList.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <GuiButton.au3>
#include <GuiComboBox.au3>
$softname="XXX"
$WinMain = GUICreate($softname, 800, 582) ;创建主窗口
$List3 = GUICtrlCreateListView("xxx|aaa|ccc",30,20,400,200)
GUICtrlCreateListViewItem("11-33|fd|sd",$list3)
GUICtrlCreateListViewItem("11-13|fd|sd",$list3)
GUICtrlCreateListViewItem("11-23|fd|sd",$list3)
GUICtrlCreateListViewItem("11-32|fd|sd",$list3)
GUICtrlCreateListViewItem("12-33|fd|sd",$list3)
GUICtrlCreateListViewItem("12-55|fd|sd",$list3)
GUICtrlCreateListViewItem("12-43|fd|sd",$list3)
GUICtrlCreateListViewItem("12-38|fd|sd",$list3)
GUICtrlCreateListViewItem("12-25|fd|sd",$list3)
GUICtrlCreateListViewItem("13-76|fd|sd",$list3)
GUICtrlCreateListViewItem("12-65|fd|sd",$list3)
GUICtrlCreateListViewItem("12-11|fd|sd",$list3)
GUICtrlCreateListViewItem("12-62|fd|sd",$list3)
GUICtrlCreateListViewItem("12-75|fd|sd",$list3)
;以上数据为读取数据库所得
$btn24=GUICtrlCreateButton('读取数据',245,335,80,21)

$combo23=GUICtrlCreateCombo("前缀",131,335,50,14)
$combo24=GUICtrlCreateCombo("后缀",181,335,50,14)

GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        _SQLite_Shutdown ( )
                        ;DirRemove($Temp, 1)
                        Exit
                        Case $btn24
For $six =0 To _GUICtrlListView_GetItemCount($List3)-1;获取有数据的行数
        $cci=StringSplit(_GUICtrlListView_GetItemText($list3, $six),"-");提取每行首列数据并分拆字符
                GUICtrlSetData($combo23,$cci[1],"前缀");将获取到的数据写入combo23
Next
Case $combo23
                $iI = _GUICtrlListView_FindinText($list3, GUICtrlRead($combo23));搜索combo23所在行
        $mpbz=StringSplit (_GUICtrlListView_GetItemText($list3,$iI),"-");提取指定行首列数据并分拆字符

ControlCommand ($softname,"",$combo24,"DelString",0)
GUICtrlSetData($combo24,$mpbz[2],"后缀");输出获取到的数据到combo24
EndSwitch
WEnd

蛋哥帮忙斧正一下吧,那个实在看不懂...
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-20 07:41 , Processed in 0.078299 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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