Jump to content

Case element of array


Recommended Posts

Hello Im using Metro UDF and there is a code when menu panel is shown by clicking on menu button.

 

And what I want I want make instead  Case $GUI_MENU_BUTTON, this $MenuSelect[1].. Case

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs!
            Exit
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE, $Form1)
        Case $GUI_MENU_BUTTON
            ;Create an Array containing menu button names
            Local $MenuButtonsArray[5] = ["Themes Demo", "Settings", "About", "Contact", "Exit"]

            ; Open the metro Menu. See decleration of $MenuButtonsArray above.
            Local $MenuSelect = _Metro_MenuStart($Form1, 150, $MenuButtonsArray)
            Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array.
                Case "0"
                    ConsoleWrite("Returned 0 = Starting themes demo. Please note that the window border colors are not updated during this demo." & @CRLF)
                    ;_ThemesDemo()
                Case "1"
                    ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF)
                Case "2"
                    ConsoleWrite("Returned 2 = About button clicked." & @CRLF)
                Case "3"
                    ConsoleWrite("Returned 3 = Contact button clicked." & @CRLF)
                Case "4"
                    ConsoleWrite("Returned 4 = Exit button clicked." & @CRLF)
                    _Metro_GUIDelete($Form1)
                    Exit
            EndSwitch
WEnd

I tried something like this what I found on forum but not work

;~      Case Else
;~          For $i = 0 To $MenuSelect
;~              ;MsgBox("","",$liczba)
;~              ;MsgBox("","",$MenuSelect)
;~              If $MenuSelect == "1" Then
;~                  ;If $MenuSelect[$i] = "0" Then
;~                      ConsoleWrite("Returned 1 = Settings button clicked." & @CRLF)
;~                  ;EndIf
;~              Elseif $MenuSelect == "2" Then
;~                      ConsoleWrite("Returned 2" & @CRLF)
;~                      ExitLoop
;~              EndIf

;~          Next

 

Link to comment
Share on other sites

Switch your case statements to integers, and see if that does it...otherwise, you need to provide a script that we can use to reproduce.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

×
×
  • Create New...