Sign in to follow this  
Followers 0
BALA

GUICtrlSetData help

4 posts in this topic

I have a label that will display the X and Y positions in a coordinate. The only problem is that the numbers appear below "X=" and "Y=" and I want them to appear to the right. (I.e. "X= 123" and "Y=43" ) Here's what I have so far:

#include <Misc.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("BA-TYPER", 300, 160)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState()

$position1 = GUICtrlCreateButton("Position", 70, 20, 120)
GUICtrlSetOnEvent($position1, "Position")
$label = GUICtrlCreateLabel ("x = " & @LF & "y = "& @LF,  200, 20) ; <-----------label here

$on = GUICtrlCreateRadio ("On", 40, 60, 40, 20)
$off = GUICtrlCreateRadio ("Off", 40, 80, 40, 20)
GUICtrlSetState ($off, $GUI_CHECKED)
$input = GUICtrlCreateInput("", 80, 70, 180, 20)

$checkbox = GUICtrlCreateCheckbox ("Input an 'Enter' after text", 41, 100, 140, 20)

$time = GUICtrlCreateInput("5", 210, 127, 40, 20)
GUICtrlCreateLabel ("Time between Posts (in seconds)", 40, 130)

Dim $Position, $i = 0, $Record[1][2]
Global $check = 0

Func CLOSEClicked()
  Exit
EndFunc

Func Position()
  While 1
        If _IsPressed("01") Then
            $Position = MouseGetPos()
            ReDim $Record[$i + 1][2]
            $Record[$i][0] = $Position[0]
            $Record[$i][1] = $position[1]
            GUICtrlSetData($label,"x = "& $Record[$i][0] & @LF & "y = "& $Record[$i][1]) ; <------SetData here
            $i += 1
            ExitLoop
        EndIf
        sleep(10)
    WEnd
EndFunc

While 1
    If GUICtrlRead($on) = $GUI_CHECKED Then
        $check = 1
    EndIf
    If GUICtrlRead($off) = $GUI_CHECKED Then
        $check = 0
    EndIf
    If $check = 1 Then
        MouseClick("left", $Position[0], $position[1], 1)
        Send (""&GuiCtrlRead($input))
        If GUICtrlRead($checkbox) = $GUI_CHECKED Then
            Send("{ENTER}")
        EndIf
        sleep(1000 * GuiCtrlRead($time))
    EndIf
    sleep(10)
WEnd

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites



$label = GUICtrlCreateLabel ("x = " & @LF & "y = "& @LF,  200, 20,80,25,$SS_RIGHT) ; <-----------label here

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

So I replace the label I already have with that one there? I don't have to change the GUICtrlSetData?

That works, but I want it to the left, do I just rewrite it to say Left?

EDIT: yep, that was it

Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

So I replace the label I already have with that one there? I don't have to change the GUICtrlSetData?

That works, but I want it to the left, do I just rewrite it to say Left?

EDIT: yep, that was it

left is the default so don't use any style when needed

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