Sign in to follow this  
Followers 0
Xiengsaephan

Adding to combobox

2 posts in this topic

#1 ·  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

 

Share this post


Link to post
Share on other sites



#2 ·  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

1 person likes this

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
Sign in to follow this  
Followers 0