Sign in to follow this  
Followers 0
JDT

Button selection is whack

4 posts in this topic

Bare with me for I am new to this and learning as I go. I am writing a script that implements a GUI. The problem is when you try to click on a button or checkbox point blank or just a little off, it will not select it. You kind of have to click around the corners of the button to get it to select. I am not sure if it has to do with my entire window including the buttons or each one as an individual.

Here is the GUI code:

$hGUI = GUICreate($GUITitle, 250, 150)
GUISetState()
$label = GUICtrlCreateLabel($instruct, 25, 20, 200, 100)
$onCampButton = GUICtrlCreateButton("On Campus", 20, 100, 100, 30)
$offCampButton = GUICtrlCreateButton("Off Campus", 130,100,100, 30)
$radioGoTo1 = GUICtrlCreateCheckbox("Go to homework directory.", 20, 60,200, 20)

Share this post


Link to post
Share on other sites



That is always a sighn of GUICtrl positioning. Also don't use GUISetState() until after the controls are created. This script uses your control positioning. Run it and you will see what the problem is.

$hGUI = GUICreate("", 250, 150)

$label = GUICtrlCreateLabel("Test Label", 25, 20, 200, 100)
GUICtrlSetBkColor(-1, 0xff0000)
$onCampButton = GUICtrlCreateButton("On Campus", 20, 100, 100, 30)
GUICtrlSetBkColor(-1, 0xff00ff)
$offCampButton = GUICtrlCreateButton("Off Campus", 130,100,100, 30)
GUICtrlSetBkColor(-1, 0x00FF00)
$radioGoTo1 = GUICtrlCreateCheckbox("Go to homework directory.", 20, 60,200, 20)
GUICtrlSetBkColor(-1, 0x0000FF)
GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
WEnd

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Ok, thanks I appreciate it. I will most certainly use that test method in the future.

Share this post


Link to post
Share on other sites

Ok, thanks I appreciate it. I will most certainly use that test method in the future.

NP

That's the best way to check control positioning.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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  
Followers 0