zxcvbnm Posted January 12, 2011 Share Posted January 12, 2011 expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=timer.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> ; == GUI generated with Koda == $Form1 = GUICreate("Count Down", 250, 70, 125, 125, BitOR($WS_DLGFRAME, $WS_POPUP),$WS_EX_TOPMOST) $Label = GUICtrlCreateLabel("", 24,02,200,70,-1,$GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 40, 800, 0, "verdana") GUISetState(@SW_SHOW) GUISetBkColor(0x66FF00) AutoItSetOption ( "TrayIconHide" ,1 ) Do $e = 4 While $e >= 0 $i = 59 While $i > 0 $i -=1 If $e == 2 and $i = 30 Then GUISetBkColor(0xFFFF00) EndIf If $e == 0 and $i = 30 Then GUISetBkColor(0xFF0000) EndIf GUICtrlSetData($Label, StringFormat("%02d:%02d", $e, $i)) Sleep(50) WEnd $e -=1 WEnd For $e = -1 to -59 step -1 For $i = 0 to 59 step 1 GUICtrlSetData($Label, StringFormat("%03d:%02d", $e, $i)) GuiCtrlSetColor($Label, 0xFF0000) Sleep(25) GuiCtrlSetColor($Label, 0x000000) Sleep(25) Next Next while 1 GuiCtrlSetColor($Label, 0xFF0000) Sleep(25) GuiCtrlSetColor($Label, 0x000000) Sleep(25) WEnd Until GUIGetMsg() = $GUI_EVENT_CLOSE I'm using $GUI_WS_EX_PARENTDRAG to make pop up draggable, but pressing left button mouse on the pup up is stopping. Is there other way? Link to comment Share on other sites More sharing options...
Newb Posted January 12, 2011 Share Posted January 12, 2011 I just see a green then red countdown, and i can drag it.... I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2011 Moderators Share Posted January 12, 2011 (edited) zxcvbnm,Take a look at the Moving and Resizing PopUp GUIs tutorial in the Wiki. It shows another 3 ways to drag a pop-up GUI. But I am not sure if any of them will keep the timer going - most other things stop when you get into the complexities of Windows messaging. I seem to remember that you need to use a special timer - I will look around and see what I can find. M23Edit: I was right, you need to use Timers.au3 like this if you want the timer to continue to run: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Timers.au3> Global $iMin = 0, $iSec = 32, $iFlash = 0 $Form1 = GUICreate("Count Down", 250, 70, 125, 125, BitOR($WS_DLGFRAME, $WS_POPUP), $WS_EX_TOPMOST) GUISetBkColor(0x66FF00) $Label = GUICtrlCreateLabel(StringFormat("%02d:%02d", $iMin, $iSec), 24, 02, 200, 70, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 40, 800, 0, "verdana") GUISetState(@SW_SHOW) ;AutoItSetOption ( "TrayIconHide" ,1 ) ; Start a timer for the countdown _Timer_SetTimer($Form1, 1000, "_CountDown") ; Call once a sec Do Sleep(10) Until $iMin = -1 _Timer_KillAllTimers($Form1) Exit Func _CountDown($a, $b, $c, $d) ; You must have 4 parameters here, even though they do nothing! ; We call it once a sec, so just reduce by 1 sec each time $iSec -= 1 If $iSec < 0 Then $iSec = 59 $iMin -= 1 If $iMin = -1 Then Return ; We have reached zero EndIf If $iMin = 2 And $iSec = 30 Then GUISetBkColor(0xFFFF00) If $iMin = 0 And $iSec = 30 Then GUISetBkColor(0xFF0000) _Timer_SetTimer($Form1, 100, "_Flash") ; Start a second timer to flash EndIf GUICtrlSetData($Label, StringFormat("%02d:%02d", $iMin, $iSec)) EndFunc Func _Flash($a, $b, $c, $d) ; You must have 4 parameters here, even though they do nothing! $iFlash = Not $iFlash If $iFlash Then GUICtrlSetColor($Label, 0xFF0000) Return EndIf GUICtrlSetColor($Label, 0x000000) EndFunc Edited January 12, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
zxcvbnm Posted January 13, 2011 Author Share Posted January 13, 2011 Thanks a lot M23! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now