Sign in to follow this  
Followers 0

I'm just not getting this

4 posts in this topic

Posted

This is hurting my head. I've spent lots of time reading the helpfile, and looking at examples...All I'm looking to do is have a list that I can add or take away from, and save that list in a ini.

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo, $Btn_Delete, $Btn_Exit, $msg, $Btn_Add, $gg

GuiCreate("ComboBox String", 392, 204)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 110,$CBS_SIMPLE)
$Btn_Delete = GuiCtrlCreateButton("Delete String", 35, 120, 90, 30)
$Btn_Add = GuiCtrlCreateButton("Add String", 145, 120, 90, 30)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 255, 120, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Delete
            If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
                _GUICtrlComboDeleteString($Combo,_GUICtrlComboGetCurSel($Combo))
            EndIf
        Case $msg = $Btn_Add
            If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
                _GUICtrlComboAddString($Combo,$gg = _GUICtrlComboGetCurSel($Combo))
                GUICtrlSetData($Combo,$gg)
            endif
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



Posted

#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo, $Btn_Delete, $Btn_Exit, $msg, $Btn_Add, $gg

GuiCreate("ComboBox String", 392, 204)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 110,$CBS_SIMPLE)
$Btn_Delete = GuiCtrlCreateButton("Delete String", 35, 120, 90, 30)
$Btn_Add = GuiCtrlCreateButton("Add String", 145, 120, 90, 30)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 255, 120, 90, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Delete
            If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
                _GUICtrlComboDeleteString($Combo,_GUICtrlComboGetCurSel($Combo))
            EndIf
            Case $msg = $Btn_Add
                If GUICtrlRead($Combo) <> "" Then ConsoleWrite(_GUICtrlComboAddString($Combo,GUICtrlRead($Combo)) & @LF)
;~             If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
;~                 _GUICtrlComboAddString($Combo,$gg = _GUICtrlComboGetCurSel($Combo))
;~                 GUICtrlSetData($Combo,$gg)
;~             endif
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

Posted

Thanks Gary!

Share this post


Link to post
Share on other sites

Posted

I tested it, and It works great. I noticed it will duplicate entries, so I need to fix that. I tried to do a GUiCtrlRead so I can get a string, but it is only getting the data in the entry field. How do I get the list string?

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