Jump to content
aa2zz6

How could I store item numbers inside a text doc. and display them in a GUI?

Recommended Posts

aa2zz6

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.

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
                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 by aa2zz6

Share this post


Link to post
Share on other sites
aa2zz6

Thanks for the ideas Danp2. I will try these tomorrow.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×