yokoliu 发表于 2009-9-17 10:24:22

_GUICtrlComboBox_GetEditText 为什么不起作用?

本帖最后由 yokoliu 于 2009-9-17 13:56 编辑

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>



$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work


Local $hGUI, $hImage, $input, $hCombo,$sText

; Create GUI
$hGUI = GUICreate("ComboBoxEx Add Dir", 400, 300, -1, -1, -1)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$binput = GUICtrlCreateButton("Input control", 2, 30, 120)
GUISetState()


_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @ScriptDir & "\*.mdb")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case   $binput
;MsgBox(0,0,_GUICtrlComboBoxEx_GetCurSel($hCombo))
;_GUICtrlComboBoxEx_GetItemText($hCombo,_GUICtrlComboBoxEx_GetCurSel($hCombo),$sText)
_GUICtrlComboBox_GetEditText($hCombo)
MsgBox(4160, "Information", "Edit Text: " & $sText)
_GUICtrlComboBox_SetEditText($hCombo, "aaa.mdb")
EndSwitch
WEnd

上面代码_GUICtrlComboBox_GetEditText 为什么不起作用?
_GUICtrlComboBox_SetEditText($hCombo, "aaa.mdb")也不起作用

顽固不化 发表于 2009-9-17 12:12:08

GUICtrlComboBox 和 GUICtrlComboBoxEx 混淆

yokoliu 发表于 2009-9-17 13:50:19

GUICtrlComboBox 和 GUICtrlComboBoxEx 混淆
顽固不化 发表于 2009-9-17 12:12 http://www.autoitx.com/images/common/back.gif
#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>



$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work


Local $hGUI, $hImage, $input, $hCombo,$sText

; Create GUI
$hGUI = GUICreate("ComboBoxEx Add Dir", 400, 300, -1, -1, -1)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$binput = GUICtrlCreateButton("Input control", 2, 30, 120)
GUISetState()


_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @ScriptDir & "\*.mdb")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case   $binput
;MsgBox(0,0,_GUICtrlComboBoxEx_GetCurSel($hCombo))
;_GUICtrlComboBoxEx_GetItemText($hCombo,_GUICtrlComboBoxEx_GetCurSel($hCombo),$sText)
$sText = _GUICtrlComboBoxEx_GetEditText ($hCombo)
MsgBox(4160, "Information", "Edit Text: " & $sText)
_GUICtrlComboBoxEx_SetEditText($hCombo, "aaa.mdb")
EndSwitch
WEnd
老大这样也不行啊

yokoliu 发表于 2009-9-17 13:55:47

改成这样可以了
#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>



$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work


Local $hGUI, $hImage, $input, $hCombo,$sText

; Create GUI
$hGUI = GUICreate("ComboBoxEx Add Dir", 400, 300, -1, -1, -1)
$hCombo = _GUICtrlComboBox_Create ($hGUI, "", 2, 2, 394, 100)
$binput = GUICtrlCreateButton("Input control", 2, 30, 120)
GUISetState()


; _GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBox_AddDir ($hCombo, @ScriptDir & "\*.mdb")
;_GUICtrlComboBoxEx_EndUpdate ($hCombo)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case   $binput
;MsgBox(0,0,_GUICtrlComboBoxEx_GetCurSel($hCombo))
;_GUICtrlComboBoxEx_GetItemText($hCombo,_GUICtrlComboBoxEx_GetCurSel($hCombo),$sText)
$sText = _GUICtrlComboBox_GetEditText ($hCombo)
MsgBox(4160, "Information", "Edit Text: " & $sText)
_GUICtrlComboBox_SetEditText($hCombo, "aaa.mdb")
EndSwitch
WEnd

O(∩_∩)O谢谢顽固不化
页: [1]
查看完整版本: _GUICtrlComboBox_GetEditText 为什么不起作用?