Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

First time creating a GUI having interaction issues?


  • Please log in to reply
3 replies to this topic

#1 LifeForceIV

LifeForceIV

    Seeker

  • New Members
  • 4 posts

Posted 25 April 2012 - 06:14 AM

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

AutoIt         
#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  








#2 AdmiralClaws

AdmiralClaws

    Where is the fish?

  • Active Members
  • PipPipPipPipPipPip
  • 4,697 posts

Posted 25 April 2012 - 06:54 AM

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.

#3 LifeForceIV

LifeForceIV

    Seeker

  • New Members
  • 4 posts

Posted 25 April 2012 - 07:25 AM

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

#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,591 posts

Posted 25 April 2012 - 12:59 PM

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 an XP machine, 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 Gude

 

How to ask questions the smart way!

 

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users