Jump to content

Recommended Posts

Posted

Hi,

I had a label showing a timer, after I cut and paste it in a group, it got defected, and showing like the image below. What's the reason for that?

time.JPG

Posted (edited)

This is the code, click on start and see what will happen. Actually, it happened when I cut and paste the group into the tab.

#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1_1 = GUICreate("Form1", 437, 302, 239, 147)
Global $Button1 = GUICtrlCreateButton("Start", 176, 256, 75, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
Global $Tab1 = GUICtrlCreateTab(8, 16, 409, 225)
Global $TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
Global $Group1 = GUICtrlCreateGroup("Group1", 20, 110, 225, 121, -1, $WS_EX_TRANSPARENT)
Global $Label2 = GUICtrlCreateLabel("00:00:00", 70, 137, 74, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
Global $Label1 = GUICtrlCreateLabel("Timer", 22, 137, 48, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
Global $test2 = GUICtrlCreateLabel("Test2", 26, 183, 68, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0080)
Global $test3 = GUICtrlCreateLabel("", 82, 183, 156, 28)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            AdlibRegister("TimerAdLib",1000)

    EndSwitch
WEnd

Func TimerAdLib()
    Local Static $iCount = 0
    $iCount += 1
    $sec2time_hour = Int($iCount / 3600)
    $sec2time_min = Int(($iCount - $sec2time_hour * 3600) / 60)
    $sec2time_sec = $iCount - $sec2time_hour * 3600 - $sec2time_min * 60
    $mtime = StringFormat('%02d:%02d:%02d', $sec2time_hour, $sec2time_min, $sec2time_sec)
    _GUICtrlEdit_SetText($Label2, $mtime)
EndFunc

 

Edited by SaeidN

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
×
×
  • Create New...