kiffab Posted March 28, 2011 Share Posted March 28, 2011 Hi I would like to replace the standard buttons created in AutoIt with a custom image. I can save my images to whatever format is compatible with AutoIt. I've been able to place a picture on the GUI but when I do, the button isn't clickable. It's almost as if the image is on top of the button. I have tried GUICtrlCreatepic. Can someone point me in the right direction? My code is below: expandcollapse popup#include <GUIComboBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <StaticConstants.au3> Global $btn[5] GUI() Func GUI() Local $myGUI, $msg, $hostname, $database, $server, $username, $password, $fp1, $fp2, $fp3, $font, $sIni, $msgbox $myGUI = GUICreate("app", 500, 400) GUISetBkColor(0xe9CADC3) GUISetFont(8, 1, 3, "verdana") GUICtrlCreateLabel("Hostname", 60, 10, 60, 20) $hostname = GUICtrlCreateCombo("", 20, 30, 120, 20) ; GUICtrlSetData(-1, "Server1|Server2|Server3") ; GUICtrlCreateLabel("Username", 180, 10, 60, 20) $logon = GUICtrlCreateCombo("", 150, 30, 120, 20) ; GUICtrlSetData(-1, "user1|user2|user3") ; GUICtrlCreateLabel("Password", 310, 10, 60, 20) $password = GUICtrlCreateInput("", 280, 30, 120, 20) GUICtrlCreateLabel("Database", 60, 75, 120, 20) $database = GUICtrlCreateCombo("", 110, 70, 170, 20) ; GUICtrlSetData(-1, "db1|db2|db3") ; GUICtrlCreateLabel("FilePath1", 30, 225, 100, 20) $fp1 = GUICtrlCreateInput("", 110, 225, 230, 20) GUICtrlCreateLabel("FilePath2", 30, 245, 100, 20) $fp2 = GUICtrlCreateInput("", 110, 245, 230, 20) GUICtrlCreateLabel("FilePath3", 30, 265, 100, 20) ; $fp3 = GUICtrlCreateInput("", 110, 265, 230, 20) $btn[0] = GUICtrlCreateButton("read hostname", 370, 185, 80, 30) $btn[1] = GUICtrlCreateButton("button2", 370, 215, 80, 30) $btn[2] = GUICtrlCreateButton("button3", 370, 245, 80, 30) $btn[3] = GUICtrlCreateButton("button4", 370, 275, 80, 30) $btn[4] = GUICtrlCreateButton("Exit", 370, 305, 80, 30) GUISetState() Do $msg = GUIGetMsg() If $msg = $btn[0] Then msgBox(4160, "box",GUICtrlRead($hostname)) EndIf If $msg = $btn[4] Then Exit EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc Appreciate any help. Thanks. Link to comment Share on other sites More sharing options...
kiffab Posted March 28, 2011 Author Share Posted March 28, 2011 After a quick search, I've realised I can get this working using the Switch / case. Now to make it look "pressed"... Link to comment Share on other sites More sharing options...
Damein Posted March 28, 2011 Share Posted March 28, 2011 You can also try the GuiOnEventMode It's what I use when I want to use images as buttons Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now