Jump to content

Recommended Posts

Posted

Well, I've tried to troubleshoot this myself. Browsed the forums here for answers. I did get the buttons to show up with the background on.

What I am trying to do is have a picture as a background (which has my design on it) and be able to click a button on the gui which calls a function.

Func MainMenu()
#include <GUIConstants.au3>

$Main = GUICreate("Automation Program", 709, 409, -1, -1)
$Background=GUICtrlCreatePic("C:\Documents and Settings\Administrator\Desktop\Program\Background.jpg",0,0, 709,409)
GuiCtrlSetState(-1,$GUI_DISABLE)
$btnStart1 = GUICtrlCreateButton("Start", 208, 40, 81, 25, 0)
$btnStart2 = GUICtrlCreateButton("Start", 208, 120, 81, 25, 0)
GUICtrlSetOnEvent($btnStart2,"StepOne")
$btnStart3 = GUICtrlCreateButton("Start", 208, 192, 81, 25, 0)
$btnStart4 = GUICtrlCreateButton("Start", 208, 272, 81, 25, 0)
$btnStart5 = GUICtrlCreateButton("Start", 208, 344, 81, 25, 0)

GUISetState(@SW_SHOW)

While 1
     $msg = GUIGetMsg()
   Select
        Case $msg = $GUI_EVENT_CLOSE
        GUIDelete()
         Exit
         
     EndSelect
     WEnd
 EndFunc

Also while I am posting. How do I add an invisible box that if clicked on will exit the program? What type of function do you use to create this type of box?

Posted

Maybe...

;Func MainMenu(); not requred
    #include <GUIConstants.au3>

    $Main = GUICreate("Automation Program", 709, 409, -1, -1)
    $Background = GUICtrlCreatePic("C:\Documents and Settings\Administrator\Desktop\Program\Background.jpg", 0, 0, 709, 409)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $btnStart1 = GUICtrlCreateButton("Start", 208, 40, 81, 25, 0)
    $btnStart2 = GUICtrlCreateButton("Start", 208, 120, 81, 25, 0)
    ;GUICtrlSetOnEvent($btnStart2, "StepOne"); you are not using "on event Mode", you are using GUIGetMsg()
    $btnStart3 = GUICtrlCreateButton("Start", 208, 192, 81, 25, 0)
    $btnStart4 = GUICtrlCreateButton("Start", 208, 272, 81, 25, 0)
    $btnStart5 = GUICtrlCreateButton("Exit", 208, 344, 81, 25, 0)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                GUIDelete()
                Exit
            Case $msg = $btnStart1
                MsgBox(0x0, "Click", "you clicked Start    ", 3)
            Case $msg = $btnStart5
                MsgBox(0x0, "Click", "you clicked Exit    ", 3)
                Exit
        EndSelect
    WEnd
;EndFunc   ;==>MainMenu

8)

NEWHeader1.png

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
×
×
  • Create New...