Jump to content
Sign in to follow this  
arredemo

label/Input shake

Recommended Posts

arredemo

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
arredemo

Thanks

I read the post when you post it about two days

I don´t response because I was making the script

Well, I don´t finished it. The script is here:

MECA.rar

I go to terminate it :D

Thanks for your help

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  

×