Sign in to follow this  
Followers 0
penggilas2

How to Create New Gui in about menu..??

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

But what do you do when Opt("GUIOnEventMode", 1)? You can't use GUIGetMsg and loopexit in that case.

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