有关选择框(ComboBox)控件输入的问题????
我想限制选择框(ComboBox)控件输入字符数量,查了好写资料帮助信息都找不到怎么解决,希望各位大虾能给指条名路,不盛感激!!:face (30): :face (30): :face (30):[ 本帖最后由 gaofali258 于 2009-1-29 11:41 编辑 ] 输入框可以,InputBox
选择框就不知道了! 输入框我也知道可以啊`~!~可就这个弄的我是没办法`!~:face (13): :face (13): :face (13): #include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 449, 193, 125)
$Combo1 = GUICtrlCreateCombo("Combo1", 208, 80, 153, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
If stringLen(GUICtrlRead($Combo1)) > 3 Then
GUICtrlSetData($Combo1,StringLeft(GUICtrlRead($Combo1),3))
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
写了个简单的。。。。 老兄!你的这个办法我用过的,这个办法有弊端,就是一旦超过字符数就把里面的数据用后来的更新了,我的目的就是让他输入到一定字符就是不能输入只能改动~:face (30): :face (30): :face (30): :face (30): 汗 我想说的是.....谁用combo来输入...... combo用来被选择才是最好的用处吧
如果你要输入的话 换input不好么 #include <GuiComboBox.Au3>
$hGui = GuiCreate('combo', 300, 200)
$combo = GuiCtrlCreateCombo('a', 5, 5, 290, 100)
GuiCtrlSetData(-1, "b|c|d", "b")
$dmy = GuiCtrlCreateButton('', 50, 50, 70, 20)
GuiCtrlSetState(-1, 32)
GuiSetState()
GuiRegisterMsg(0x111, "_wmCommand")
Do
$msg = GuiGetMsg()
Until $msg = -3
Func _wmCommand($hWnd, $message, $wParam, $sParam)
Local $notifyCode = BitShift($wParam, 16)
Local $Id = BitAnd($wParam, 0xffff)
If $Id = $Combo And $notifyCode = $cbn_editChange then
$text = GuiCtrlRead($Id)
If stringLen($text) > 5 then
_GuiCtrlComboBox_SetEditText($combo, stringLeft($text, 5))
GuiCtrlSetState($dmy, 256)
EndIf
EndIf
EndFunc ;==>_wmCommand() 帮助里有例子
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
Opt('MustDeclareVars', 1)
$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
_Main()
Func _Main()
Local $hCombo
; Create GUI
GUICreate("ComboBox Limit Text", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()
; Limit text in edit box
_GUICtrlComboBox_LimitText($hCombo, 10)
; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main 因为用了 新版的 帮助.......udf是双语 目录 .......没看到有这udf
只想说那句
大意了 大意了:face (32): 感谢各位热心的朋友,问题解决了`!:face (29): :face (29): :face (29): :face (29): :face (29):
页:
[1]