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

GUICtrlCreateList问题,双击后怎样让双击的内容至GUICtrlCreateInput

[复制链接]
发表于 2009-4-6 11:16:40 | 显示全部楼层 |阅读模式
GUICtrlCreateList问题,双击后怎样让双击的内容至GUICtrlCreateInput

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 362, 269, 262, 158)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 137, 21)
$List1 = GUICtrlCreateList("", 160, 0, 193, 253)
GUICtrlSetData($List1, "12erwer2342312312")
GUICtrlSetData($List1, "12erwer23423123sadfsaewe12")
GUICtrlSetData($List1, "12erwer23423112312312312")
GUISetState(@SW_SHOW)

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

        EndSwitch
WEnd



双击GUICtrlCreateList列表中的“12erwer2342312312”然后GUICtrlCreateInput中就会出现“GUICtrlCreateInput”
会有朋友帮帮忙好吗?在这里谢谢了。

[ 本帖最后由 ddx13 于 2009-4-7 08:25 编辑 ]
发表于 2009-4-6 13:32:08 | 显示全部楼层
http://www.autoitx.com/forum.php?mod=viewthread&tid=6100

把第41行的Msgbox改成GUICtrlSetData用来更改Input中的数据即可.
 楼主| 发表于 2009-4-6 14:25:12 | 显示全部楼层
用GUICtrlCreateListView一切都正常,但是改为GUICtrlCreateList后就没有反映了。

[ 本帖最后由 ddx13 于 2009-4-6 15:57 编辑 ]
 楼主| 发表于 2009-4-7 08:25:05 | 显示全部楼层
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

Global Const $STN_DBLCLK = 2

$Form1 = GUICreate("Form1", 362, 269, 262, 158)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 137, 21)
$List1 = GUICtrlCreateList("", 160, 0, 193, 253)
GUICtrlSetData($List1, "12erwer2342312312")
GUICtrlSetData($List1, "12erwer23423123sadfsaewe12")
GUICtrlSetData($List1, "12erwer23423112312312312")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW)

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

        EndSwitch
WEnd

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam,16)
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $hCtrl = $lParam

    Switch $nID
        Case $List1
            Switch $nNotifyCode
                Case $STN_DBLCLK
                   MsgBox(16,"警告","你丫的,还真的双击啊")
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc
发表于 2009-4-7 13:29:07 | 显示全部楼层
楼主试试看这个@_@
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

Global Const $STN_DBLCLK = 2

$Form1 = GUICreate("Form1", 362, 269, 262, 158)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 137, 21)
$List1 = GUICtrlCreateList("", 160, 0, 193, 253)
GUICtrlSetData($List1, "a")
GUICtrlSetData($List1, "b")
GUICtrlSetData($List1, "12erwer23423112312312312")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW)

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

        EndSwitch
WEnd

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam,16)
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $hCtrl = $lParam

    Switch $nID
        Case $List1
            Switch $nNotifyCode
                Case $STN_DBLCLK
                   MsgBox(16,"警告","你丫的,还真的双击啊")
                                   GUICtrlSetData($Input1,_GUICtrlListBox_GetText($List1,_GUICtrlListBox_GetCurSel($List1)),"")
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc
 楼主| 发表于 2009-4-7 19:34:10 | 显示全部楼层
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>

Global Const $STN_DBLCLK = 2

$Form1 = GUICreate("Form1", 362, 269, 262, 158)
$Input1 = GUICtrlCreateInput("Input1", 8, 8, 137, 21)
$List1 = GUICtrlCreateList("", 160, 0, 193, 253)
GUICtrlSetData($List1, "12erwer2342312312")
GUICtrlSetData($List1, "12erwer23423123sadfsaewe12")
GUICtrlSetData($List1, "12erwer23423112312312312")
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState(@SW_SHOW)

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

        EndSwitch
WEnd

Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam,16)
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $hCtrl = $lParam

    Switch $nID
        Case $List1
            Switch $nNotifyCode
                Case $STN_DBLCLK
                   GUICtrlSetData ( $Input1 , GUICtrlRead($List1))
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc


没有你那么麻烦,我已经解决了,不过还是要谢谢你。
发表于 2010-12-22 09:35:33 | 显示全部楼层
学习了 迟了一年
发表于 2014-8-24 19:41:44 | 显示全部楼层
就在找这个,谢啦!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-23 08:15 , Processed in 0.074780 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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