Sign in to follow this  
Followers 0

First time creating a GUI having interaction issues?

4 posts in this topic

Posted

So I have a script that works and want to create a GUI to interface with some of the values that can change. I've looked a lots of autoit GUI code trying to figure out why I can't interact with any part of the form. The radio selection doesn't work nor the updown or the simple button. Am I missing some include or setting values?

Thanks,

Kyle

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>

AutoItSetOption("SendKeyDelay", 30)
AutoItSetOption("MouseCoordMode", 0)

Global $games = 5
Global $game = 1

$bgImgFile = "bg.jpg"
$iconFile = "icon.ico"

Global $lx = 0
Global $ly = 0
Global $rx = 0
Global $ry = 0
Global $cx = 0
Global $cy = 0

$form = GUICreate("Title", 640, 480, 0, 0)
GUICtrlSetDefBkColor(0xC0DCC0)
GUICtrlCreatePic($bgImgFile, 0, 0, 640, 480)
GUISetIcon($iconFile, 0)

GuiCtrlCreateGroup("Game Res", 640-100-10, 10, 100, 100)
$radio1440 = GuiCtrlCreateRadio("1440x900", 640-100, 30, 66, 16)
GuiCtrlSetState(-1, $GUI_CHECKED)
$radio1920 = GuiCtrlCreateRadio("1920x1080", 640-100, 50, 72, 16)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

GuiCtrlCreateLabel("Number of games to play", 640-240, 10, 120, 16)
$gameNumSelect = GuiCtrlCreateInput("1", 640-200, 30, 40, 20)
$numGameSelector = GuiCtrlCreateUpDown($gameNumSelect)

$progressBar = GUICtrlCreateProgress(145, 450, 350, 16)
GUICtrlSetColor(-1, 0xC0DCC0)
GUICtrlSetBkColor(-1, 0x000000)
GuiCtrlSetData($progressBar, 50)

$button1 = GUICtrlCreateButton("Start", 640-220, 60, 75, 16)

GuiSetState()
bottom($form)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $button1
If $radio1920 Then
$lx = 630
$ly = 460
$rx = 980
$ry = 460
$cx = 960
$cy = 720
ElseIf $radio1440 Then
$lx = 470
$ly = 390
$rx = 700
$ry = 390
$cx = 720
$cy = 560
EndIf
$games = $numGameSelector
; Working script goes here
EndSwitch

WEnd

Func bottom($form)
    $size = WinGetClientSize($form)
    Local $y = @DesktopHeight - ($size[1]+55)
    Local $x = (@DesktopWidth / 2) - ($size[0] / 2)
    Return WinMove($form, "", $x, $y)
EndFunc

Share this post


Link to post
Share on other sites



Posted

You must disable the picture control or you will just be clicking on it.

GUICtrlCreatePic($bgImgFile, 0, 0, 640, 480)
GuiCtrlSetState(-1,$GUI_DISABLE)

The helpfile does tell you this if you look at the page for GUICtrlCreatePic() ;)

Also, I don't know where you got GUIConstants.au3 from as it hasn't been used anywhere for years, but it should be changed to GUIConstantsEx.au3. Even says so in the file.

Share this post


Link to post
Share on other sites

Posted

Thanks for the reply, I guess I was thinking the picture wasn't a control but just displays. That fixed the issue. I did have GUIConstantsEx.au3 but read someplace that GUIConstantsEx.au3 merged to GUIConstants.au3

Thanks,

LF4

Share this post


Link to post
Share on other sites

Posted

I did have GUIConstantsEx.au3 but read someplace that GUIConstantsEx.au3 merged to GUIConstants.au3

Other way around actually, GUIConstants.au3 is just there for backwards compatibility, and there's only one functional line in it.

#include-once

; #INDEX# =======================================================================================================================
; Title .........: GUIConstants
; AutoIt Version : 3.2
; Language ......: English
; Description ...: This file is deprecated.  GUIConstantsEx.au3 should be used.
; Author(s) .....: Valik
; Dll ...........:
; ===============================================================================================================================

#include "GUIConstantsEx.au3"

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