Sign in to follow this  
Followers 0
Sunblood

Buttons not working on multiple GUIs

4 posts in this topic

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[1]
        Case $gui
            Switch $msg[0]
                Case $GUI_EVENT_CLOSE
                    SaveSettings()
                    Exit
                Case $GUI_EVENT_MINIMIZE
                    WinSetState("Watchdog", "", @SW_HIDE)
                Case $buttonCheckNow
                    StartCheck()
                Case $buttonAddRule
                    $a = GetSitelist()
                    $b = GUICtrlRead($dropdownSitelist)
                    For $i = 1 To $a[0]
                        If $a[$i] = $b Then
                            _GUICtrlComboBox_SetCurSel($dropdownSiteListAdd, $i - 1)
                        EndIf
                    Next
                    WinSetState("Add Rule", "", @SW_RESTORE)
                Case $buttonEditRule
                    $a = GetSitelist()
                    $b = GUICtrlRead($dropdownSitelist)
                    For $i = 1 To $a[0]
                        If $a[$i] = $b Then
                            _GUICtrlComboBox_SetCurSel($dropdownSiteListEdit, $i - 1)
                        EndIf
                    Next
                    $sel = _GUICtrlTreeView_GetText($treeviewRuleset, _GUICtrlTreeView_GetSelection($treeviewRuleset))
                    If IniRead($ini, $sel, "site", "ERROR") = "ERROR" Then
                        MsgBox(0, "Error", "Please select a top-layer item to edit.")
                    Else
                        GUICtrlSetData($inputCategoryEdit, IniRead($ini, $sel, "category", 0))
                        GUICtrlSetData($inputRuleNameEdit, $sel)
                        GUICtrlSetData($editIncludeEdit, StringReplace(IniRead($ini, $sel, "include", ""), "|", @CRLF))
                        GUICtrlSetData($editExcludeEdit, StringReplace(IniRead($ini, $sel, "exclude", ""), "|", @CRLF))
                    EndIf
                    WinSetState("Edit Rule", "", @SW_RESTORE)
            EndSwitch
        Case $guiAdd
            Switch $msg[0]
                Case $GUI_EVENT_CLOSE
                    WinSetState("Add Rule", "", @SW_HIDE)
                Case $buttonCancelAdd
                    WinSetState("Add Rule", "", @SW_HIDE)
            EndSwitch
        Case $guiEdit
            Switch $msg[0]
                Case $GUI_EVENT_CLOSE
                    WinSetState("Edit Rule", "", @SW_HIDE)
                Case $buttonCancelEdit
                    MsgBox(0, "", "")
                    WinSetState("Edit Rule", "", @SW_HIDE)
                Case $buttonSaveEdit
                    IniWrite($ini, $sel, "category", GUICtrlRead($inputCategoryEdit))
                    IniWrite($ini, $sel, "include", StringReplace(GUICtrlRead($editIncludeEdit), @CRLF, "|"))
                    IniWrite($ini, $sel, "exclude", StringReplace(GUICtrlRead($editExcludeEdit), @CRLF, "|"))
                    WinSetState("Edit Rule", "", @SW_HIDE)
            EndSwitch
    EndSwitch
......
...... rest of While loop and other code

I have three separate GUI windows in this script, but the buttons on two of them aren't working. I'm using GuiGetMsg(1) and arrays to properly assign different events to the right GUIs, but certain buttons still don't execute anything.

All the buttons on the top GUI ($gui) work just fine.

$GUI_EVENT_CLOSE works for all three GUIs.

$buttonSaveAdd, $buttonSaveEdit, $buttonCancelEdit, and $buttonCancelAdd don't do anything. I put a small MsgBox(0,"","") under $buttonCancelEdit just to see if the code was executing, and it isn't.

Can't figure this one out.


Share this post


Link to post
Share on other sites



Can you post the code which generates the GUI? or just everything, i'm not going to all of that to attempt to run it.


They call me MrRegExpMan

Share this post


Link to post
Share on other sites

I'll attach the script.

Put the following in torrents.ini

[SITE:AutoIt Example]
enabled =1

[Example entry]
site = Autoit Example
category=7
include=YES
exclude=NO
[Settings]
autocheck=1
timecheck=1
visibleIE=4

torrents.au3


Share this post


Link to post
Share on other sites

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