Sign in to follow this  
Followers 0
blizzedout

Refresh part of a GUI?

9 posts in this topic

Anyway to refresh part of the GUI in a function?

Share this post


Link to post
Share on other sites



what part

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
GUICreate("Set Pixels", 317, 461, 192, 125)

Read("CannotFindServer")
GUICtrlCreateGroup("Cannot Find Server", 0, 0, 313, 49)
GUICtrlCreateLabel("Color:", 40, 22, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 19, 65, 19)
GUICtrlCreateLabel("X:", 144, 22, 14, 17)
GUICtrlCreateInput("" & $X, 160, 19, 33, 19)
GUICtrlCreateLabel("Y:", 200, 22, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 19, 33, 19)
$Set_CannotFindServer = GUICtrlCreateButton("Set", 256, 19, 33, 19, 0)
GUICtrlSetOnEvent($Set_CannotFindServer, "Set_CannotFindServer")
GUICtrlCreateGraphic(10, 19, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("ReLogin")
GUICtrlCreateGroup("Re-Login", 0, 50, 313, 49)
GUICtrlCreateLabel("Color:", 40, 72, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 69, 65, 19)
GUICtrlCreateLabel("X:", 144, 72, 14, 17)
GUICtrlCreateInput("" & $X, 160, 69, 33, 19)
GUICtrlCreateLabel("Y:", 200, 72, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 69, 33, 19)
$Set_ReLogin = GUICtrlCreateButton("Set", 256, 69, 33, 19, 0)
GUICtrlSetOnEvent($Set_ReLogin, "Set_ReLogin")
GUICtrlCreateGraphic(10, 69, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("SendMessageBox")
GUICtrlCreateGroup("Send Message Box", 0, 100, 313, 49)
GUICtrlCreateLabel("Color:", 40, 122, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 119, 65, 19)
GUICtrlCreateLabel("X:", 144, 122, 14, 17)
GUICtrlCreateInput("" & $X, 160, 119, 33, 19)
GUICtrlCreateLabel("Y:", 200, 122, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 119, 33, 19)
$Set_SendMessageBox = GUICtrlCreateButton("Set", 256, 119, 33, 19, 0)
GUICtrlSetOnEvent($Set_SendMessageBox, "Set_SendMessageBox")
GUICtrlCreateGraphic(10, 119, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("NoPhoto")
GUICtrlCreateGroup("No Photo", 0, 150, 313, 49)
GUICtrlCreateLabel("Color:", 40, 172, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 169, 65, 19)
GUICtrlCreateLabel("X:", 144, 172, 14, 17)
GUICtrlCreateInput("" & $X, 160, 169, 33, 19)
GUICtrlCreateLabel("Y:", 200, 172, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 169, 33, 19)
$Set_NoPhoto = GUICtrlCreateButton("Set", 256, 169, 33, 19, 0)
GUICtrlSetOnEvent($Set_NoPhoto, "Set_NoPhoto")
GUICtrlCreateGraphic(10, 169, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("MustBeHerFriend")
GUICtrlCreateGroup("Must Be Her Friend", 0, 200, 313, 49)
GUICtrlCreateLabel("Color:", 40, 222, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 219, 65, 19)
GUICtrlCreateLabel("X:", 144, 222, 14, 17)
GUICtrlCreateInput("" & $X, 160, 219, 33, 19)
GUICtrlCreateLabel("Y:", 200, 222, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 219, 33, 19)
$Set_MustBeHerFriend = GUICtrlCreateButton("Set", 256, 219, 33, 19, 0)
GUICtrlSetOnEvent($Set_MustBeHerFriend, "Set_MustBeHerFriend")
GUICtrlCreateGraphic(10, 219, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("UnexpectedErrorMSG")
GUICtrlCreateGroup("Unexpected Error MSG", 0, 250, 313, 49)
GUICtrlCreateLabel("Color:", 40, 272, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 269, 65, 19)
GUICtrlCreateLabel("X:", 144, 272, 14, 17)
GUICtrlCreateInput("" & $X, 160, 269, 33, 19)
GUICtrlCreateLabel("Y:", 200, 272, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 269, 33, 19)
$Set_UnexpectedErrorMSG = GUICtrlCreateButton("Set", 256, 269, 33, 19, 0)
GUICtrlSetOnEvent($Set_UnexpectedErrorMSG, "Set_UnexpectedErrorMSG")
GUICtrlCreateGraphic(10, 269, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("PrivateMessageSent")
GUICtrlCreateGroup("Private Message Sent", 0, 300, 313, 49)
GUICtrlCreateLabel("Color:", 40, 322, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 319, 65, 19)
GUICtrlCreateLabel("X:", 144, 322, 14, 17)
GUICtrlCreateInput("" & $X, 160, 319, 33, 19)
GUICtrlCreateLabel("Y:", 200, 322, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 319, 33, 19)
$Set_PrivateMessageSent = GUICtrlCreateButton("Set", 256, 319, 33, 19, 0)
GUICtrlSetOnEvent($Set_PrivateMessageSent, "Set_PrivateMessageSent")
GUICtrlCreateGraphic(10, 319, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("MaxSent")
GUICtrlCreateGroup("Max Sent", 0, 350, 313, 49)
GUICtrlCreateLabel("Color:", 40, 372, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 369, 65, 19)
GUICtrlCreateLabel("X:", 144, 372, 14, 17)
GUICtrlCreateInput("" & $X, 160, 369, 33, 19)
GUICtrlCreateLabel("Y:", 200, 372, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 369, 33, 19)
$Set_MaxSent = GUICtrlCreateButton("Set", 256, 369, 33, 19, 0)
GUICtrlSetOnEvent($Set_MaxSent, "Set_MaxSent")
GUICtrlCreateGraphic(10, 369, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Read("ServerBusy")
GUICtrlCreateGroup("Server Busy", 0, 400, 313, 49)
GUICtrlCreateLabel("Color:", 40, 422, 31, 17)
GUICtrlCreateInput("" & $Color, 72, 419, 65, 19)
GUICtrlCreateLabel("X:", 144, 422, 14, 17)
GUICtrlCreateInput("" & $X, 160, 419, 33, 19)
GUICtrlCreateLabel("Y:", 200, 422, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 419, 33, 19)
$Set_ServerBusy = GUICtrlCreateButton("Set", 256, 419, 33, 19, 0)
GUICtrlSetOnEvent($Set_ServerBusy, "Set_ServerBusy")
GUICtrlCreateGraphic(10, 419, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
;;;;;;;
    EndSelect
WEnd

Func Set_CannotFindServer()
    Do
        If _IsPressed('31') Then
            GoWrite ("CannotFindServer")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_ReLogin()
    Do
        If _IsPressed('31') Then
            GoWrite ("ReLogin")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_SendMessageBox()
    Do
        If _IsPressed('31') Then
            GoWrite ("SendMessageBox")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_NoPhoto()
    Do
        If _IsPressed('31') Then
            GoWrite ("NoPhoto")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_MustBeHerFriend()
    Do
        If _IsPressed('31') Then
            GoWrite ("MustBeHerFriend")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_UnexpectedErrorMSG()
    Do
        If _IsPressed('31') Then
            GoWrite ("UnexpectedErrorMSG")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_PrivateMessageSent()
    Do
        If _IsPressed('31') Then
            GoWrite ("PrivateMessageSent")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Set_MaxSent()
    Do
        If _IsPressed('31') Then
            GoWrite ("MaxSent")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy


Func Set_ServerBusy()
    Do
        If _IsPressed('31') Then
            GoWrite ("ServerBusy")
            ToolTip("Set INI")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc;==>Set_ServerBusy

Func Read($IniRead)
    Global $X = IniRead("Cords.INI", "PixelSettings", $IniRead & "PosX", "NotFound")
    Global $Y = IniRead("Cords.INI", "PixelSettings", $IniRead & "PosY", "NotFound")
    Global $Color = IniRead("Cords.INI", "PixelSettings", $IniRead & "Color", "NotFound")
EndFunc;==>Read

Func GoWrite($IniInfo)
    $pos = MouseGetPos()
    $var = PixelGetColor($pos[0], $pos[1])
    IniWrite("Cords.INI", "PixelSettings", $IniInfo & "PosX", "" & $pos[0])
    IniWrite("Cords.INI", "PixelSettings", $IniInfo & "PosY", "" & $pos[1])
    IniWrite("Cords.INI", "PixelSettings", $IniInfo & "Color", $var)
EndFunc;==>GoWrite

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc;==>_IsPressed

Posted Image

This is my script, I want to refresh the GUI after each set function is ran.

Edited by blizzedout

Share this post


Link to post
Share on other sites

GUIs refresh themselves - you have to use GUICtrlSetData or GUICtrlSetGraphic to change things.

Share this post


Link to post
Share on other sites

visually you have a nice looking screen...

functionally its not setup to refresh--- read the ini again--- very easily

the read ini should ALL be done i one function so that that function can be called whenever you desire

so.. there are many approaches... build your gui first then call the ini read then set the data to the controls

that would be the best to refresh at a later time

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Are you just trying to update the color that is displayed when you change the color and click set? If so, just do this for example:

Read("ServerBusy")
GUICtrlCreateGroup("Server Busy", 0, 400, 313, 49)
GUICtrlCreateLabel("Color:", 40, 422, 31, 17)
$Color_ServerBusy = GUICtrlCreateInput("" & $Color, 72, 419, 65, 19)
GUICtrlCreateLabel("X:", 144, 422, 14, 17)
GUICtrlCreateInput("" & $X, 160, 419, 33, 19)
GUICtrlCreateLabel("Y:", 200, 422, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 419, 33, 19)
$Set_ServerBusy = GUICtrlCreateButton("Set", 256, 419, 33, 19, 0)
GUICtrlSetOnEvent($Set_ServerBusy, "Set_ServerBusy")
$Graphic_ServerBusy = GUICtrlCreateGraphic(10, 419, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Func Set_ServerBusy()
    Do
        If _IsPressed('31') Then
            GoWrite ("ServerBusy")
            ToolTip("Set INI")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
    GUICtrlSetBkColor($Graphic_ServerBusy, GUICtrlRead($Color_ServerBusy))
EndFunc;==>Set_ServerBusy

I haven't tested this, but I'm pretty sure it should work.


[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Share this post


Link to post
Share on other sites

Are you just trying to update the color that is displayed when you change the color and click set? If so, just do this for example:

Read("ServerBusy")
GUICtrlCreateGroup("Server Busy", 0, 400, 313, 49)
GUICtrlCreateLabel("Color:", 40, 422, 31, 17)
$Color_ServerBusy = GUICtrlCreateInput("" & $Color, 72, 419, 65, 19)
GUICtrlCreateLabel("X:", 144, 422, 14, 17)
GUICtrlCreateInput("" & $X, 160, 419, 33, 19)
GUICtrlCreateLabel("Y:", 200, 422, 14, 17)
GUICtrlCreateInput("" & $Y, 216, 419, 33, 19)
$Set_ServerBusy = GUICtrlCreateButton("Set", 256, 419, 33, 19, 0)
GUICtrlSetOnEvent($Set_ServerBusy, "Set_ServerBusy")
$Graphic_ServerBusy = GUICtrlCreateGraphic(10, 419, 25, 17)
GUICtrlSetBkColor(-1, $Color)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Func Set_ServerBusy()
    Do
        If _IsPressed('31') Then
            GoWrite ("ServerBusy")
            ToolTip("Set INI")
        EndIf
        Sleep(100)
    Until _IsPressed('32')
    GUICtrlSetBkColor($Graphic_ServerBusy, GUICtrlRead($Color_ServerBusy))
EndFunc;==>Set_ServerBusy

I haven't tested this, but I'm pretty sure it should work.

This is what i want :o Im gonn try it out.

Share this post


Link to post
Share on other sites

Func Set_ServerBusy()
    Do
        If _IsPressed('31') Then
            GoWrite ("ServerBusy")
            Read("ServerBusy")
            GUICtrlSetBkColor($Graphic_ServerBusy, $Color)
        EndIf
        Sleep(100)
    Until _IsPressed('32')
EndFunc  ;==>Set_ServerBusy

It wont refresh it tho, until i restart it.

Share this post


Link to post
Share on other sites

I might be able to better help you if I can understand your intentions first. Why do you want to have to hit the "1" key after you click the "Set" button in order for it to refresh?


[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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