Jump to content

Only part of my buttons are clickable


 Share

Recommended Posts

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!

#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

Your labels probably overlap your buttons.

Try to comment GUICtrlCreateLabel() commands and look if buttons will work.

EDIT:

This works fine

#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 by Zedna
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...