treacheroust Posted October 13, 2009 Share Posted October 13, 2009 The code below is working, except most of the buttons don't work. I have two buttons "snap" and "calibrate". If I hover over the left side of the "snap" button the button highlights - but the right side it doesn't work. The "calibrate" button is worst. It never highlights, I can't click it! Any help would be appreciated. This is my first attempt at a GUI. Thanks! expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Local $gui_yInc = 25 Local $gui_width = 300 Opt("GUIOnEventMode", 1) Local $ctrl Local $yCur = 0 GUICreate("Draft Helper", $gui_width, 4*$gui_yInc, 1200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $ctrl = GUICtrlCreateLabel("Card", 0, $yCur, $gui_width/4, $gui_yInc) GUICtrlSetFont($ctrl, 8.5, 800) $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc $ctrl = GUICtrlCreateLabel("Rating", 0, $yCur, $gui_width/4, $gui_yInc) GUICtrlSetFont($ctrl, 8.5, 800) $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc $ctrl = GUICtrlCreateLabel("Notes", 0, $yCur, $gui_width/4, $gui_yInc) GUICtrlSetFont($ctrl, 8.5, 800) $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc $ctrl = GUICtrlCreateButton("Snap", 0, $yCur, $gui_width/2, $gui_yInc) GUICtrlSetOnEvent($ctrl, "SNAPButton") $ctrl = GUICtrlCreateButton("Calibrate", $gui_width/2, $yCur, $gui_width/2, $gui_yInc) GUICtrlSetOnEvent($ctrl, "CALIBRATEButton") $yCur += $gui_yInc GUISetState(@SW_SHOW) Func CLOSEClicked() Exit EndFunc Func SNAPButton() MsgBox(0, 'Testing', 'Snap') EndFunc Func CALIBRATEButton() MsgBox(0, 'Testing', 'Cal') EndFunc While (1) Sleep(100) WEnd Link to comment Share on other sites More sharing options...
Zedna Posted October 13, 2009 Share Posted October 13, 2009 (edited) Your labels probably overlap your buttons.Try to comment GUICtrlCreateLabel() commands and look if buttons will work.EDIT:This works fineexpandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Local $gui_yInc = 25 Local $gui_width = 300 Opt("GUIOnEventMode", 1) Local $ctrl Local $yCur = 0 GUICreate("Draft Helper", $gui_width, 4*$gui_yInc, 1200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;~ $ctrl = GUICtrlCreateLabel("Card", 0, $yCur, $gui_width/4, $gui_yInc) ;~ GUICtrlSetFont($ctrl, 8.5, 800) ;~ $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc ;~ $ctrl = GUICtrlCreateLabel("Rating", 0, $yCur, $gui_width/4, $gui_yInc) ;~ GUICtrlSetFont($ctrl, 8.5, 800) ;~ $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc ;~ $ctrl = GUICtrlCreateLabel("Notes", 0, $yCur, $gui_width/4, $gui_yInc) ;~ GUICtrlSetFont($ctrl, 8.5, 800) ;~ $ctrl = GUICtrlCreateLabel("", $gui_width/4, $yCur, $gui_width*3/4, $yCur) $yCur += $gui_yInc $ctrl1 = GUICtrlCreateButton("Snap", 0, $yCur, $gui_width/2, $gui_yInc) GUICtrlSetOnEvent($ctrl1, "SNAPButton") $ctrl2 = GUICtrlCreateButton("Calibrate", $gui_width/2, $yCur, $gui_width/2, $gui_yInc) GUICtrlSetOnEvent($ctrl2, "CALIBRATEButton") ;~ $yCur += $gui_yInc GUISetState(@SW_SHOW) Func CLOSEClicked() Exit EndFunc Func SNAPButton() MsgBox(0, 'Testing', 'Snap') EndFunc Func CALIBRATEButton() MsgBox(0, 'Testing', 'Cal') EndFunc While (1) Sleep(100) WEnd Edited October 13, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
treacheroust Posted October 13, 2009 Author Share Posted October 13, 2009 (edited) Thank you very much! You're right! I was setting the label height wrong, so they were too tall and overlapped the buttons. Edited October 13, 2009 by treacheroust 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