Jump to content

Recommended Posts

Posted

Create Gui and Call new gui in menu file..

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $filemenu, $fileitem, $recentfilesmenu, $separator1
    Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton
    Local $msg, $file
    #forceref $separator1

    GUICreate("GUI menu", 300, 200)

    $filemenu = GUICtrlCreateMenu("File")
    $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $helpmenu = GUICtrlCreateMenu("?")
    $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)

    $okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20)

    $cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20)

    GUISetState()

    While 1
        $msg = GUIGetMsg()


        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
                ExitLoop

            Case $msg = $fileitem
                $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
                If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

            Case $msg = $exititem
                ExitLoop

            Case $msg = $okbutton
                MsgBox(0, "Click", "You clicked OK!")

            Case $msg = $aboutitem
                NewGuiss ()
        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Func NewGuiss ()
    Local $gui, $font, $msg
    $gui = GUICreate("Test", 300, 400)
    GUISetBkColor(0xE0FFFF)
    $font = "Comic Sans MS"
    GUICtrlCreateLabel("...oo00OO Just Learn AutoIt Script OO00oo...", 10, 10, 339, 20)
    GUICtrlSetFont(-1, 9, 339, 4, $font)
    GUICtrlSetColor(-1, 0xff0000)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then GUIDelete()
    WEnd
EndFunc

Click (?) menu than About, will call new gui..

After close NewGuiss, than call again no response, What wrong..??? And after call Newguiss,

Cancel menu in main menu not function..

Posted

change your while-loop in the newguiss() to this:

While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then
            GUIDelete()
            exitloop
        endif
    WEnd
Posted

change your while-loop in the newguiss() to this:

While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then
            GUIDelete()
            exitloop
        endif
    WEnd

Thank`s.... :)

  • 8 months later...

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...