Jump to content
Sign in to follow this  
FrostedBullets

[New User] Need help with GUI

Recommended Posts

FrostedBullets

Ok so i recently have been playing around in autoit. made a simple layout with the correct window size and button layout. My question is how will i code it so each button has its own image and the main window has stretched background?

GUICreate("background",300,200,-1,-1,); will create a dialog box that when displayed is centered

Local $starbutton, $infobutton, $configbutton, $msg



$Button_1=GUICtrlCreateButton ("Start", 0, -1, 100, 100)
$Button_2=GUICtrlCreateButton ("Info", 100, -1, 100, 100)
$Button_3=GUICtrlCreateButton ("Config", 200, -1, 100, 100)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
                Case $msg = $Button_1
                MsgBox(0, 'Error', 'This Function is not done yet!') ; Will Run the script from config
            Case $msg = $Button_2
                MsgBox(0, 'Error', 'This Function is not done yet!')  ; Will Bring up the info window
            Case $msg = $Button_3
                MsgBox(0, 'Error', 'This Function is not done yet!')  ; Will bring up a config window
            
            EndSelect
            WEnd
GUIDelete()

Exit
Edited by FrostedBullets

Share this post


Link to post
Share on other sites
FrostedBullets

#572734

Please use the search next time.

I got images to show over my buttons but when you mouse over they disappear any ideas?

$ichant= GUICreate("iChant",300,200,-1,-1); creates main window
GUICtrlCreatePic(@ScriptDir & "\Data\GUI\background.bmp", 0, 0, 300, 200)
GuiCTRlSetState(-1, $GUI_DISABLE)




$Button_1=GUICtrlCreateButton ("Start", 0, -1, 101, 81)
GUICtrlCreatePic(@ScriptDir & "\Data\GUI\play.bmp", 0, -1, 101, 81)
$Button_2=GUICtrlCreateButton ("Info", 100, -1, 100, 81)
GUICtrlCreatePic(@ScriptDir & "\Data\GUI\help.bmp", 100, -1, 100, 81)
$Button_3=GUICtrlCreateButton ("Config", 200, -1,99, 81)
GUICtrlCreatePic(@ScriptDir & "\Data\GUI\config.bmp", 200, -1, 99, 81)

GuiSetState()
 
While 1
    $msg = GUIGetMsg()
    Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
                Case $msg = $Button_1
                MsgBox(0, 'Error', 'This Function is not done yet!')  ; Will Run the script from config
            Case $msg = $Button_2
                MsgBox(0, 'iChant Help', 'Welcome to iChant. The semi-automatic enchanting leveler.')   ; Will Bring up the info window
            Case $msg = $Button_3
            MsgBox(0, 'iChant Help', 'Welcome to iChant. The semi-automatic enchanting leveler.')   ; Will Bring up the info window
            
    


 EndSelect
WEnd

Share this post


Link to post
Share on other sites
Authenticity

You need to specify BS_BITMAP like:

$Button_1=GUICtrlCreateButton ("Start", 0, 50, 101, 81, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Data\GUI\play.bmp)

Edit: Don't forget to include "ButtonConstants.au3".

Edited by Authenticity

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.