Jump to content

Recommended Posts

Posted

I have a combobox that reads to an .ini files that loads 3 values to the GUI, you can edit these values and save them.  I want to add a button to the interface that users can then click on to add a new item to that combobox directly from the GUI which would add a new section in the .ini file as well. What command would work best for this?

My .ini would look like this

[ComboList Item 1]
val1 = 1111
val2 = 2222
val3 = 3333

[ComboList Item 2]
val1 = 4444
val2 = 5555
val3 = 6666

 

Posted

@Xiengsaephan,

FileWriteLine() and FileWrite() can be used for this.^_^

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 24, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Combo1, "Item 1|Item 2")
$Button1 = GUICtrlCreateButton("Button1", 32, 56, 57, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
       Local $file = FileOpen(@ScriptDir & "\Your.ini", 1)
         FileWriteLine($file, GUICtrlRead($Combo1))
       FileClose($file)
   Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

KS15

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

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
  • Recently Browsing   0 members

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