Jump to content

updating the lable


d0n
 Share

Recommended Posts

what i want to do is when i click a date it will post the date in a string under it, but with this code i think it gets spammed and starts to flicker :D

What should i do to make it only update after i click the date on the calendar ?

#include <GuiConstants.au3>

$Guisizex = 400
$Guisizey = 400

; GUI
GuiCreate("Sample GUI", $Guisizex, $Guisizey)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; MENU 
$file1 = GuiCtrlCreateMenu("File")
$file1item = GUICtrlCreateMenuItem("Exit", $file1)

; Date
$date = GuiCtrlCreateDate("", 5, 5, 200, 20)
$date = GUICtrlRead($date)

; PROGRESS
GuiCtrlCreateProgress(60, 355, ($Guisizex-70), 20, $PBS_SMOOTH)
GuiCtrlSetData(-1, 50)
GuiCtrlCreateLabel("Progress:", 5, 357)

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If $msg = $date Then
        GUICtrlCreateLabel($date, 5, 30)
    EndIf
WEnd
GUIDelete()
Exit
Link to comment
Share on other sites

Hi,

#include <GuiConstants.au3>

$Guisizex = 400
$Guisizey = 400

; GUI
GuiCreate("Sample GUI", $Guisizex, $Guisizey)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; MENU
$file1 = GuiCtrlCreateMenu("File")
$file1item = GUICtrlCreateMenuItem("Exit", $file1)

; Date
$date = GuiCtrlCreateDate("", 5, 5, 200, 20)
$DateLabel = GUICtrlCreateLabel(GUICtrlRead($date), 5, 30, 180)


; PROGRESS
GuiCtrlCreateProgress(60, 355, ($Guisizex-70), 20, $PBS_SMOOTH)
GuiCtrlSetData(-1, 50)
GuiCtrlCreateLabel("Progress:", 5, 357)

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If GUICtrlRead($date) <> GUICtrlRead($DateLabel) Then GUICtrlSetData($DateLabel, GUICtrlRead($date))
        

WEnd
GUIDelete()
Exit

Cheers

Link to comment
Share on other sites

what i want to do is when i click a date it will post the date in a string under it, but with this code i think it gets spammed and starts to flicker :D

What should i do to make it only update after i click the date on the calendar ?

#include <GuiConstants.au3>

$Guisizex = 400
$Guisizey = 400

; GUI
GuiCreate("Sample GUI", $Guisizex, $Guisizey)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; MENU 
$file1 = GuiCtrlCreateMenu("File")
$file1item = GUICtrlCreateMenuItem("Exit", $file1)

; Date
$date = GuiCtrlCreateDate("", 5, 5, 200, 20)
$date = GUICtrlRead($date)

; PROGRESS
GuiCtrlCreateProgress(60, 355, ($Guisizex-70), 20, $PBS_SMOOTH)
GuiCtrlSetData(-1, 50)
GuiCtrlCreateLabel("Progress:", 5, 357)

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If $msg = $date Then
        GUICtrlCreateLabel($date, 5, 30)
    EndIf
WEnd
GUIDelete()
Exit
It is all wrong

#include <GuiConstants.au3>

$Guisizex = 400
$Guisizey = 400

; GUI
GuiCreate("Sample GUI", $Guisizex, $Guisizey)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; MENU 
$file1 = GuiCtrlCreateMenu("File")
$file1item = GUICtrlCreateMenuItem("Exit", $file1)

; Date
$date = GuiCtrlCreateDate("", 5, 5, 200, 20)
$cDate = GUICtrlRead($date)
$dLabel = GUICtrlCreateLabel($cDate, 5, 30)

; PROGRESS
GuiCtrlCreateProgress(60, 355, ($Guisizex-70), 20, $PBS_SMOOTH)
GuiCtrlSetData(-1, 50)
GuiCtrlCreateLabel("Progress:", 5, 357)

; GUI MESSAGE LOOP
GuiSetState()
While 1
    $msg = GUIGetMsg()
    $cDate = GUICtrlRead($date)
    If $msg = $GUI_EVENT_CLOSE Or $msg = $file1item Then ExitLoop
    If $msg = $date Then
       ;GUICtrlCreateLabel($date, 5, 30)
        If GUICtrlRead($dLabel) <> $cDate Then GUICtrlSetData($dLabel, $cDate)
    EndIf
WEnd
GUIDelete()
Exit

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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