Jump to content
Sign in to follow this  

Update Label live with Input text?

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:


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

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?


Share this post

Link to post
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))


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

Share this post

Link to post
Share on other sites

Thanks a lot! I'm new to programming at all that's why I stuck at 'easy parts' pretty often, your solution is just perfect!


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...