Jump to content

IniReadSection with ComboBox Drop down integration


Recommended Posts

Trying to get this combo box drop down to read the data within my ini section names. Not able to return the key=value data when I hit the button on the gui. I can't seem to get the IniReadSection to recognize anything based off of my selection. What am I missing here?

 

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

#Region ### START Koda GUI section ### Form=
; original script borrowed from InunoTaishou and Subz
$Form1 = GUICreate("Sample", 413, 213, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Submit", 152, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

; Get the sections of the ini file
Global $iFile = @ScriptDir & "\test5.ini"
Global $aSections = IniReadSectionNames($iFile)
; If the IniReadSectionNames succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1]
If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1])


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $test = IniReadSection($iFile, $aSections)
            MsgBox($MB_SYSTEMMODAL, "", $test)
    EndSwitch
WEnd

I've attached my sample ini data too.

test5.ini

Link to comment
Share on other sites

  • 3 years later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...