aa2zz6 Posted December 12, 2015 Share Posted December 12, 2015 (edited) Firstly, I apologies for the extremely long title. I work as a GIS analysis for a company and a lot of the data I input into the mapping system is repetitive information. I actually wanted to see if it was possible to store all the data inside text document and reference those rather than having to use the GUICtrlSetData with a few hundred items spammed throughout the script.expandcollapse popupGlobal $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 If StringCompare($enter, "CAP") = 0 Then GUICtrlSetData($cCombo2, "") GUICtrlSetData($cCombo2, "55010|36018|24121|10010", "24121") EndIf Case $cCombo2 _Edit_Changed($cCombo2) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Edited December 12, 2015 by aa2zz6 Link to comment Share on other sites More sharing options...
Danp2 Posted December 12, 2015 Share Posted December 12, 2015 There are a couple of options that come to mind:1) Declare a constant containing the string value, and then reference this constant throughout the code2) Read the desired value(s) from an INI file Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 13, 2015 Author Share Posted December 13, 2015 Thanks for the ideas Danp2. I will try these tomorrow. Link to comment Share on other sites More sharing options...
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