Jump to content

label/Input shake


Recommended Posts

Hello

Sorry, I write english very bad

I have this script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Fernando\Escritorio\MECA.kxf
$Form1 = GUICreate("MECA", 800, 300, 193, 115)

$Label1 = GUICtrlCreateLabel("", 10, 10, 780, 40)
GUICtrlSetFont(-1, 24, 800, 0, "Courier New")
GUICtrlSetBkColor(-1, 0xFFFFFF) 

$Input1 = GUICtrlCreateInput("", 10, 90, 780, 40, -1, 0)
GUICtrlSetLimit(-1, 40)
GUICtrlSetFont(-1, 24, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0x0000ff)
GUISetState(@SW_SHOW)

While 1
    if stringlen(GUICtrlread($Input1))>0 Then       
        GUICtrlSetData($Label1, "tremble ") 
    Else
        GUICtrlSetData($Label1, "shake like a leaf")
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg        
        Case $GUI_EVENT_CLOSE
            Exit    
    EndSwitch
WEnd

It´s every time checked the "While" and the label is shaking/tembling every time

This script is part of the other bigger. I want not to use "OnEvent Mode"

Exist any style of property what I can use?

I prefer not use a Sleep

While 1

Sleep(1000)

...

WEnd

Thanks for response

Link to comment
Share on other sites

Hello

Sorry, I write english very bad

I have this script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Fernando\Escritorio\MECA.kxf
$Form1 = GUICreate("MECA", 800, 300, 193, 115)

$Label1 = GUICtrlCreateLabel("", 10, 10, 780, 40)
GUICtrlSetFont(-1, 24, 800, 0, "Courier New")
GUICtrlSetBkColor(-1, 0xFFFFFF) 

$Input1 = GUICtrlCreateInput("", 10, 90, 780, 40, -1, 0)
GUICtrlSetLimit(-1, 40)
GUICtrlSetFont(-1, 24, 800, 0, "Courier New")
GUICtrlSetColor(-1, 0x0000ff)
GUISetState(@SW_SHOW)

While 1
    if stringlen(GUICtrlread($Input1))>0 Then       
        GUICtrlSetData($Label1, "tremble ") 
    Else
        GUICtrlSetData($Label1, "shake like a leaf")
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg        
        Case $GUI_EVENT_CLOSE
            Exit    
    EndSwitch
WEnd

It´s every time checked the "While" and the label is shaking/tembling every time

This script is part of the other bigger. I want not to use "OnEvent Mode"

Exist any style of property what I can use?

I prefer not use a Sleep

While 1

Sleep(1000)

...

WEnd

Thanks for response

Keep track of the old value and only set it when changed:
$sOldLabel = GUICtrlRead($Label1)

While 1
    if stringlen(GUICtrlread($Input1))>0 Then     
        $sNewLabel = "tremble" 
    Else
        $sNewLabel = "shake like a leaf"
    EndIf
    
    If $sNewLabel <> $sOldLabel Then 
        $sOldLabel = $sNewLabel
        GUICtrlSetData($Label1, $sNewLabel)
    EndIf
    
    $nMsg = GUIGetMsg()
    Switch $nMsg       
        Case $GUI_EVENT_CLOSE
            Exit   
    EndSwitch
WEnd

:D

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