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

3 posts in this topic

#1 ·  Posted (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.

Global $sFunction = "; Function Name:    "


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)

    GUICtrlCreateLabel("Item_no:", 5, 40) ; next line and next cell
    $cCombo2 = GUICtrlCreateCombo("", 65, 42, 100, 296)
    GUICtrlSetData(-1, "55010|36018|24121")


    ; Loop until user exits

    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

Func _Edit_Changed($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
                $enter = GUICtrlRead($cCombo1)
                If StringCompare($enter, "TAP TEE") = 0 Then
                    GUICtrlSetData($cCombo2, "")
                    GUICtrlSetData($cCombo2, "55010|36018|24121|10010", "10010")
                If StringCompare($enter, "CAP") = 0 Then
                    GUICtrlSetData($cCombo2, "")
                    GUICtrlSetData($cCombo2, "55010|36018|24121|10010", "24121")

            Case $cCombo2
EndFunc   ;==>WM_COMMAND


Edited by aa2zz6

Share this post

Link to post
Share on other sites

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 code

2) Read the desired value(s) from an INI file

Share this post

Link to post
Share on other sites

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