aa2zz6 Posted September 3, 2015 Posted September 3, 2015 If the user types in "Tap Tee" the first combo box how would I make the second combo box automatically choose item number "10010"? expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $cCombo1, $cCombo2 Global $sFunction = "; Function Name: " _Main() Func _Main() ; Create GUI GUICreate("MapInfo Auto Complete", 190, 296) Local $iWidthCell = 70 GUICtrlCreateLabel("Component:", 5, 10, $iWidthCell) ; first cell 70 width $cCombo1 = GUICtrlCreateCombo("", 65, 10, 100, 296) GUICtrlSetData(-1, "TAP TEE|TEE|EFV|EF COLLAR|CURB VALVE|CAP|VALVE BOX") GUICtrlCreateLabel("Item_no:", 5, 40) ; next line and next cell $cCombo2 = GUICtrlCreateCombo("", 65, 42, 100, 296) GUICtrlSetData(-1, "55010|36018|24121") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Edit_Changed($cCombo) _GUICtrlComboBox_AutoComplete($cCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word If $iCode = $CBN_EDITCHANGE Then Switch $iIDFrom Case $cCombo1 _Edit_Changed($cCombo1) Case $cCombo2 _Edit_Changed($cCombo2) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
Surya Posted September 4, 2015 Posted September 4, 2015 (edited) Try this :expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $cCombo1, $cCombo2 Global $sFunction = "; Function Name: " _Main() Func _Main() ; Create GUI GUICreate("MapInfo Auto Complete", 190, 296) Local $iWidthCell = 70 GUICtrlCreateLabel("Component:", 5, 10, $iWidthCell) ; first cell 70 width $cCombo1 = GUICtrlCreateCombo("", 65, 10, 100, 296) GUICtrlSetData(-1, "TAP TEE|TEE|EFV|EF COLLAR|CURB VALVE|CAP|VALVE BOX") GUICtrlCreateLabel("Item_no:", 5, 40) ; next line and next cell $cCombo2 = GUICtrlCreateCombo("", 65, 42, 100, 296) GUICtrlSetData(-1, "55010|36018|24121") GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Edit_Changed($cCombo) _GUICtrlComboBox_AutoComplete($cCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word If $iCode = $CBN_EDITCHANGE Then Switch $iIDFrom Case $cCombo1 _Edit_Changed($cCombo1) $enter = GUICtrlRead($cCombo1) If StringCompare($enter, "TAP TEE") = 0 Then GUICtrlSetData($cCombo2, "") GUICtrlSetData($cCombo2, "55010|36018|24121|10010", "10010") EndIf Case $cCombo2 _Edit_Changed($cCombo2) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMANDIts your code i just changed a little bit Edited September 4, 2015 by Surya No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)
aa2zz6 Posted September 4, 2015 Author Posted September 4, 2015 Thanks Surya, the code change works perfectly!
Surya Posted September 4, 2015 Posted September 4, 2015 glad i could help No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now