Jump to content



Photo

Help on the GUI front :P


  • Please log in to reply
5 replies to this topic

#1 ulti

ulti

    Seeker

  • Active Members
  • 28 posts

Posted 17 May 2012 - 06:46 AM

Hai, im not that good with gui. but i was wondering if some one could lead me in the right direction

i made this silly script to try get my head around gui so here it is



Plain Text         
#include<misc.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 447, 197, 274, 144) $Button1 = GUICtrlCreateButton("1", 32, 48, 49, 33) $Button2 = GUICtrlCreateButton("2", 144, 48, 49, 33) $Button3 = GUICtrlCreateButton("3", 248, 48, 49, 33) $Button4 = GUICtrlCreateButton("4", 360, 48, 49, 33) $Slider1 = GUICtrlCreateSlider(0, 120, 105, 33) $Slider2 = GUICtrlCreateSlider(112, 120, 105, 33) $Slider3 = GUICtrlCreateSlider(216, 120, 105, 41) $Slider4 = GUICtrlCreateSlider(336, 120, 105, 49) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 88, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 232, 88, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 344, 88, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg   Case $GUI_EVENT_CLOSE    Exit EndSwitch     Sleep(10) While _IsPressed('20') MsgBox(4096, "press", "you are holding space, 10)         Sleep(2000)     WEnd      While _IsPressed('20') MsgBox(4096, "held", "you are holding space still, 10)         Sleep(4000) WEnd WEnd



ok so i know it will not work currently i just used koda to create a form.

What i would like. is to have the slider adjust the sleep between each msgbox, so if the slider is at the front it would be 1 seccond between mesages if space was held, and if the slider was at the end it would be 10 secconds between wach msgbox

And have it so if i click the button, it will check/unchek the check box, and then if check box is on start displaying the message box if the space is held

from there i think ill have a good understanding of it. ;) any help is apreciated.





#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 17 May 2012 - 07:39 AM

Use GUICtrlRead() to read slider values.

#3 ulti

ulti

    Seeker

  • Active Members
  • 28 posts

Posted 17 May 2012 - 10:32 AM

Thank you, it works for the slider value it seams. but i was trying to use the same thing to check if the check box is checked and it wouldnot work the same?


Plain Text         
#include<misc.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:UsersBeastDesktopForm1_1.kxf $Form1_1 = GUICreate("Form1", 448, 198, 257, 122) $Button1 = GUICtrlCreateButton("1", 32, 48, 49, 33) $Button2 = GUICtrlCreateButton("2", 144, 48, 49, 33) $Button3 = GUICtrlCreateButton("3", 248, 48, 49, 33) $Button4 = GUICtrlCreateButton("4", 360, 48, 49, 33) $Slider1 = GUICtrlCreateSlider(0, 120, 105, 33) GUICtrlSetLimit(-1, 10000, 50) GUICtrlSetData(-1, 50) $Slider2 = GUICtrlCreateSlider(112, 120, 105, 33) GUICtrlSetLimit(-1, 10000, 50) GUICtrlSetData(-1, 50) $Slider3 = GUICtrlCreateSlider(216, 120, 105, 41) GUICtrlSetLimit(-1, 10000, 50) GUICtrlSetData(-1, 50) $Slider4 = GUICtrlCreateSlider(336, 120, 105, 49) GUICtrlSetLimit(-1, 10000, 0) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 88, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 88, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 232, 88, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 344, 88, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg   Case $GUI_EVENT_CLOSE    Exit EndSwitch     Sleep(10) if (GUICtrlRead ( "$Checkbox1" )) = 1 then While _IsPressed('20') MsgBox(4096, "press", "you are holding space, 10)         Sleep(GUICtrlRead($Slider1))     WEnd endif if (GUICtrlRead ( "$Checkbox2" )) = 1 then      While _IsPressed('20') MsgBox(4096, "press", "you are holding space wait, 10)         Sleep(GUICtrlRead($Slider2)) WEnd endif if (GUICtrlRead ( "$Checkbox3" )) = 1 then       While _IsPressed('20') MsgBox(4096, "press", "you are holding space still, 10)         Sleep(GUICtrlRead($Slider3)) WEnd endif if (GUICtrlRead ( "$Checkbox4" )) = 1 then      While _IsPressed('20') MsgBox(4096, "press", "you are holding space again, 10)         Sleep(GUICtrlRead($Slider4)) WEnd endif WEnd



i only want to have

While _IsPressed('20') MsgBox(4096, "press", "you are holding space, 10)         Sleep(GUICtrlRead($Slider1))     WEnd

work while check box is ticked?

#4 searchresult

searchresult

    Adventurer

  • Active Members
  • PipPip
  • 116 posts

Posted 17 May 2012 - 12:07 PM

To get checkbox state use

GUICtrlGetState()

#5 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 17 May 2012 - 01:11 PM

Func IsChecked($control)     Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc


#6 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,315 posts

Posted 17 May 2012 - 01:13 PM

To get checkbox state use

GUICtrlGetState()


That's not true

GUICtrlGetState Remarks: As opposed to GUICtrlRead this function returns ONLY the state of a control enabled/disabled/hidden/show/dropaccepted






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users