LifeForceIV Posted April 25, 2012 Share Posted April 25, 2012 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 expandcollapse popup#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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 25, 2012 Share Posted April 25, 2012 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
LifeForceIV Posted April 25, 2012 Author Share Posted April 25, 2012 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.au3Thanks,LF4 Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2012 Share Posted April 25, 2012 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" If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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