找回密码
 加入
搜索
查看: 1611|回复: 3

_GUICtrlComboBox_GetEditText 为什么不起作用?

[复制链接]
发表于 2009-9-17 10:24:22 | 显示全部楼层 |阅读模式
本帖最后由 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 混淆

评分

参与人数 1金钱 +2 收起 理由
yokoliu + 2 O(∩_∩)O谢谢

查看全部评分

 楼主| 发表于 2009-9-17 13:50:19 | 显示全部楼层
GUICtrlComboBox 和 GUICtrlComboBoxEx 混淆
顽固不化 发表于 2009-9-17 12:12

#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
老大这样也不行啊
 楼主| 发表于 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谢谢顽固不化
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-15 17:29 , Processed in 0.073618 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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