Jump to content
Sign in to follow this  
ulti

Help on the GUI front :P

Recommended Posts

ulti

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

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

Share this post


Link to post
Share on other sites
ulti

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?

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

Share this post


Link to post
Share on other sites
searchresult

To get checkbox state use

GUICtrlGetState()

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  

×