Jump to content

Update Label live with Input text?


gobsor
 Share

Recommended Posts

Hey its me again!

Got another problem, I'm pretty sure that's been asked before, but I couldn't find any example on how to do that, even though it got to be really easy!

I want a simple GUI with an Input and a Label on it, not a problem so far. But now I want the Label to read the text that is entered in the Input. So,

how do I update the Label with the Input's text? Gotta be some kind of while, I tried it like the following:

GUI/LABEL/INPUT CODE GOES HERE
[...]

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    GUICtrlSetData($streetlabel, GUICtrlRead($streetdate))
    GUICtrlSetData($riplabel, GUICtrlRead($ripdate))
    Sleep(200)
WEnd

This kinda works but is very, very unsexy. The Label field is fluttering and one definetly feels the 200ms delay sometimes when typing. Is there any better solution?

Regards

Link to comment
Share on other sites

You are constantly updating the label, even when it already contains the right data. Change your loop to check it first and only update if required.

If GuiCtrlRead($streetlabel) <> GuiCtrlRead($streetdate) Then GUICtrlSetData($streetlabel, GUICtrlRead($streetdate))

:blink:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...