找回密码
 加入
搜索
查看: 1813|回复: 7

高手帮帮忙,多选出问题,怎样才能实现多选???

[复制链接]
发表于 2009-9-16 20:42:17 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$List1 = GUICtrlCreateList("", 104, 40, 97, 214,BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetData(-1, "001|002|003|004|005|006|007|008|009|010")
$List2 = GUICtrlCreateList("", 272, 40, 81, 214)
$Button1 = GUICtrlCreateButton("添加>>", 216, 80, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $yyy= _GUICtrlListBox_GetSelCount($List1)
                                if $yyy>0 Then
                                                        For $i=1 to $yyy
                                                           If GUICtrlRead($List1) <> '' Then
                                GUICtrlSetData($List2, GUICtrlRead($List1))
                                                             _GUICtrlListBox_DeleteString($List1, _GUICtrlListBox_GetCurSel($List1))
                                                               
                                                        EndIf
                                                        $yyy= _GUICtrlListBox_GetSelCount($List1)
                                                        Next
                        EndIf

        EndSwitch
WEnd



每次选按住CTRL选取第一行,和第五行添加至右边时都会出错~~~弄了大半天,都弄不好,高手帮帮忙,怎样才能实现多选~~
发表于 2009-9-16 20:45:00 | 显示全部楼层
移动一个之后,位置发生了改变~
发表于 2009-9-16 20:57:09 | 显示全部楼层
先移动第5行不就好了吗,从后向前移。
 楼主| 发表于 2009-9-16 21:35:26 | 显示全部楼层
本帖最后由 273952582 于 2009-9-16 21:37 编辑

2# afan


那应该怎么才能做实现,这项功能呢??难不成AU3,无法做到???
发表于 2009-9-16 21:39:13 | 显示全部楼层
循环里用GUICtrlRead($List1)不合适,第一次它会从焦点开始读,而不会从0基序数开始读选中项
可以用 _GUICtrlListBox_GetText 试试~
另外 _GUICtrlListBox_GetSel 也是很有用的,不要放过~
 楼主| 发表于 2009-9-16 23:10:51 | 显示全部楼层
唉!!!写不出来,,谁能帮我研究研究
发表于 2009-9-16 23:20:13 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$List1 = GUICtrlCreateList("", 104, 40, 97, 214, BitOR($LBS_SORT, $LBS_STANDARD, $LBS_EXTENDEDSEL, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetData(-1, "001|002|003|004|005|006|007|008|009|010")
$List2 = GUICtrlCreateList("", 272, 40, 81, 214)
$Button1 = GUICtrlCreateButton("添加>>", 216, 80, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        For $i = _GUICtrlListBox_GetCount($List1) - 1 To 0 Step -1
                                If _GUICtrlListBox_GetSel($List1, $i) Then
                                        GUICtrlSetData($List2, _GUICtrlListBox_GetText($List1, $i))
                                        _GUICtrlListBox_DeleteString($List1, $i)
                                EndIf
                        Next
        EndSwitch
WEnd
 楼主| 发表于 2009-9-16 23:23:43 | 显示全部楼层
7# afan


非常感谢~~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 20:16 , Processed in 0.079919 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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