Sign in to follow this  
Followers 0
golfinhu

GUI buttons and flashing label.

1 post in this topic

#1 ·  Posted (edited)

Hi, ppl.


I am developing a GUI with a fix sidebar, based on the style of windows 10 ... I have 3 problems at the moment.

1 - How do I put the close and minimize buttons on my window? (I want my window not to have the top bar). I tried to draw with gdi plus but I could not.

2 - My watch flashes when the time is updated. I tried to do with _GDIPlus_GraphicsDrawString but the strings get overlapped.

3 - I can not leave my transparent buttons to put them in the sidebar (as in this photo below)

UI.jpg

If anyone can help me I would appreciate it very much.

thanks a lot

 

GUI.au3

Edited by golfinhu

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  
Followers 0

  • Similar Content

    • Chimp
      By Chimp
      Just for fun
      Idea from here:
      http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art
      Edit:
      Also added an analogue experimental version in post #11
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End  
    • UEZ
      By UEZ
      Here my contribution to the clock fever - nothing special rather a fast hack:
      Download:  AutoIt Eye Clock v1.3.1 build 2015-06-28.7z
       
      Left eye = hour, right eye = minutes, pupil light = seconds

       
       
       
       
       


       
      You can rename the compiled script to *.scr to behave as an screensaver. Furthermore you can copy the *.scr to System32 (x86 system) or SysWOW64 (x64 system) and configure it as a screensaver incl. preview.
       
      Original clock: http://www.suck.uk.com/products/eyeclock/
       
      Have fun.
    • Melba23
      By Melba23
      The Fibonacci clock lets you know the time by changing colours and requiring you do some adding up.

      The Fibonacci sequence is the sequence beginning 1, 1 and where each number is the sum of the previous two. Its first five digits are: 1, 1, 2, 3, 5.  These numbers are all you need to express all the numbers from 1 to 12.
      1 = 1
      1+1 = 2
      ...
      1 + 1 + 2 + 3 + 5 = 12
      which means that it is possible to use them to describe the twelve positions on a clock, and therefore tell the time in 5 minute intervals.
      Philippe Chrétien of Montreal Canada made such a clock with squares of side length 1, 1, 2, 3, and 5 (the numbers in the Fibonacci sequence) arranged into a "golden rectangle".  The squares lit up in red tell you the hour, and in green give you the minutes (in multiples of five). A square lit up in blue meant it is to be added for both hour and minute. Transparent squares are ignored.

      The first example below decodes as follows:
      Hours, red 5, red 1 and blue 3 = 5 + 1 + 3 = 9 hours
      Minutes: green 2 and blue 3 = 2 + 3 = 5.  5 x 5 = 25 minutes.
      So, the time is 9.25.

      And here is a little script to show how you can create a Fibonacci clock of your own - by default it shows the current time (which you can reset at any time using the "Reset" button) or you can test it by entering a time in the combos:
      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Date.au3> $iMargin_X = 10 $iMargin_Y = 10 $iMargin_Inter = 5 $iSize = 50 $iButton_Level = ($iSize * 5) + $iMargin_Inter + 20 $hGUI = GUICreate("Fibonacci Clock", ($iSize * 8) + ($iMargin_X * 2), $iButton_Level + 100) GUISetBkColor(0xC4C4C4) $cBack = GUICtrlCreateLabel("", $iMargin_X - $iMargin_Inter, $iMargin_Y - $iMargin_Inter, _ ($iSize * 8) + ($iMargin_Inter * 2), ($iSize * 5) + $iMargin_Inter) GUICtrlSetBkColor($cBack, 0x000000) $cLabel_1A = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_1B = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y + $iSize, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_2 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y, ($iSize * 2) - $iMargin_Inter, ($iSize * 2) - $iMargin_Inter) $cLabel_3 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y + ($iSize * 2), ($iSize * 3) - $iMargin_Inter, ($iSize * 3) - $iMargin_Inter) $cLabel_5 = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 3), $iMargin_Y, $iSize * 5, ($iSize * 5) - $iMargin_Inter) $cUserSet = GUICtrlCreateButton("Set User Time", $iMargin_X, $iButton_Level, 100, 30) $cUserHour = GUICtrlCreateCombo("", $iMargin_X + 120, $iButton_Level, 40, 20) GUICtrlSetData($cUserHour, "00|01|02|03|04|05|06|07|08|09|10|11|12") $cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20) GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55") $cReset = GUICtrlCreateButton("Reset Current Time", $iMargin_X, $iButton_Level + 50, 120, 30) GUICtrlCreateLabel("Hours:" & @CRLF & @CRLF & "Mins:" & @CRLF & @CRLF & "Both:", 250, $iButton_Level, 150, 80) GUICtrlCreateLabel("", 300, $iButton_Level, 50, 20) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlCreateLabel("", 300, $iButton_Level + 25, 50, 20) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 300, $iButton_Level + 50, 50, 20) GUICtrlSetBkColor(-1, 0x0000FF) GUISetState() _Reset() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cReset _Reset() Case $cUserSet $iHour = GUICtrlRead($cUserHour) $iMin = GUICtrlRead($cUserMin) / 5 _Set_Clock($iHour, $iMin) EndSwitch WEnd Func _Reset() $sDTG = _NowCalc() $iHour = StringRegExpReplace($sDTG, "^.*\s(\d\d):.*", "$1") $iHour = (($iHour > 12) ? ($iHour - 12) : ($iHour)) $iMin = Int(StringRegExpReplace($sDTG, "^.*:(\d\d):.*", "$1") / 5) _Set_Clock($iHour, $iMin) EndFunc ;==>_Reset Func _Set_Clock($iH, $iM) $iH = Number($iH) $iM = Number($iM) ;ConsoleWrite("Entry: " & $iH & " - " & $iM & @CRLF) GUICtrlSetBkColor($cLabel_1A, 0xC4C4C4) GUICtrlSetBkColor($cLabel_1B, 0xC4C4C4) GUICtrlSetBkColor($cLabel_2, 0xC4C4C4) GUICtrlSetBkColor($cLabel_3, 0xC4C4C4) GUICtrlSetBkColor($cLabel_5, 0xC4C4C4) $iState_1A = 0 $iState_1B = 0 $iState_2 = 0 $iState_3 = 0 $iState_5 = 0 While $iH ;ConsoleWrite($iH & @CRLF) Switch $iH Case 5 To 12 ;;ConsoleWrite("5-12" & @CRLF) If Not $iState_5 Then ;;ConsoleWrite("- 5" & @CRLF) $iH -= 5 GUICtrlSetBkColor($cLabel_5, 0XFF0000) $iState_5 = 1 Else ContinueCase EndIf Case 3 To 12 ;;ConsoleWrite("3-12" & @CRLF) If Not $iState_3 Then ;;ConsoleWrite("- 3" & @CRLF) $iH -= 3 GUICtrlSetBkColor($cLabel_3, 0XFF0000) $iState_3 = 1 Else ContinueCase EndIf Case 2 To 12 ;;ConsoleWrite("2-12" & @CRLF) If Not $iState_2 Then ;;ConsoleWrite("- 2" & @CRLF) $iH -= 2 GUICtrlSetBkColor($cLabel_2, 0XFF0000) $iState_2 = 1 Else ContinueCase EndIf Case Else ;;ConsoleWrite("Else" & @CRLF) If $iState_1A Then ;;ConsoleWrite("- 1B" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1B, 0XFF0000) $iState_1B = 1 Else ;;ConsoleWrite("- 1A" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1A, 0XFF0000) $iState_1A = 1 EndIf EndSwitch WEnd While $iM Switch $iM Case 5 To 12 $bContinueCase = False ;ConsoleWrite("5-12" & @CRLF) Switch $iState_5 Case 0 ;ConsoleWrite("-5:G" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X00FF00) $iState_5 = 2 Case 1 ;ConsoleWrite("-5:B" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X0000FF) $iState_5 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 3 To 12 ;ConsoleWrite("3-12" & @CRLF) $bContinueCase = False Switch $iState_3 Case 0 ;ConsoleWrite("-3:G" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X00FF00) $iState_3 = 2 Case 1 ;ConsoleWrite("-3:B" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X0000FF) $iState_3 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 2 To 12 ;ConsoleWrite("2-12" & @CRLF) $bContinueCase = False Switch $iState_2 Case 0 ;ConsoleWrite("-2:G" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X00FF00) $iState_2 = 2 Case 1 ;ConsoleWrite("-2:B" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X0000FF) $iState_2 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case Else Switch $iState_1A Case 2 $iM -= 1 If $iState_1B Then ;ConsoleWrite("-1B:B" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X0000FF) Else ;ConsoleWrite("-1B:G" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X00FF00) EndIf Case 1 ;ConsoleWrite("-1A:B" & @CRLF) $iM -= 1 If $iState_1B = 0 Then GUICtrlSetBkColor($cLabel_1B, 0x00FF00) $iState_1B = 1 Else GUICtrlSetBkColor($cLabel_1A, 0x0000FF) $iState_1A = 2 EndIf Case Else ;ConsoleWrite("-1A:G" & @CRLF) $iM -= 1 GUICtrlSetBkColor($cLabel_1A, 0x00FF00) $iState_1A = 1 EndSwitch EndSwitch WEnd EndFunc ;==>_Set_Clock If anyone can produce shorter internal code to colour the labels, please do post it - I found that quite a difficult problem to crack and I am certain I do not have an optimal solution.
      M23
      P.S. The original clock:
       
    • Chimp
      By Chimp
      ....from the  serie "strange clocks":
      see here for infos on how to read this clock
      ; Berlin-Uhr HotKeySet("{Esc}", "End") Global $aColors[3] = ["0x757575", "0xFFCC00", "0xFF0033"] ; [off][yellow][red] Local $iSec = 0, $iMin = 0 Global $hGui = GUICreate(' Berlin-Uhr', 275, 240) ; ($nrPerLine, $ctrlWidth, $ctrlHeight, $xPanelPos, $yPanelPos, $xSpace) Local $aGuiSecsX2 = _GuiPanel(01, 55, 35, 115, 010, 5) ; Seconds blink Local $aGuiHourX5 = _GuiPanel(04, 55, 35, 025, 055, 5) ; Hours * 5 Local $aGuiHourX1 = _GuiPanel(04, 55, 35, 025, 100, 5) ; Hours Local $aGuiMinsX5 = _GuiPanel(11, 16, 35, 025, 145, 6) ; Mins * 5 Local $aGuiMinsX1 = _GuiPanel(04, 55, 35, 025, 190, 5) ; Mins GUISetBkColor("0x9A9A9A", $hGui) GUISetState(@SW_SHOW) Do If @SEC <> $iSec Then ; when the second changes do what following $iSec = @SEC GUICtrlSetBkColor($aGuiSecsX2[1], $aColors[@SEC / 2 = Int(@SEC / 2)]) ; second blink If @MIN <> $iMin Then $iMin = @MIN For $i = 1 To 11 If $i < 5 Then GUICtrlSetBkColor($aGuiHourX5[$i], $aColors[2 * (Int(@HOUR / 5) >= $i)]) GUICtrlSetBkColor($aGuiHourX1[$i], $aColors[2 * (Mod(@HOUR, 5) >= $i)]) GUICtrlSetBkColor($aGuiMinsX1[$i], $aColors[Mod(@MIN, 5) >= $i]) EndIf GUICtrlSetBkColor($aGuiMinsX5[$i], $aColors[(Int(@MIN / 5) >= $i) * (1 + ($i = 3 Or $i = 6 Or $i = 9))]) Next EndIf EndIf Until GUIGetMsg() = -3 ; $GUI_EVENT_CLOSE End() Func _GuiPanel($nrPerLine, $ctrlWidth, $ctrlHeight, $xPanelPos, $yPanelPos, $xSpace = 1) ; create the controls Local $aGuiGridCtrls[$nrPerLine + 1] For $i = 1 To $nrPerLine $left = $xPanelPos + ((($ctrlWidth + $xSpace) * ($i - 1)) - $xSpace) $aGuiGridCtrls[$i] = GUICtrlCreateInput("", $left, $yPanelPos, $ctrlWidth, $ctrlHeight, 0x0800) ; 0x0800 = $ES_READONLY GUICtrlSetBkColor(-1, $aColors[0]) Next Return $aGuiGridCtrls EndFunc ;==>_GuiPanel Func End() If WinActive($hGui) Then GUIDelete($hGui) Exit EndIf EndFunc ;==>End  
    • BrewManNH
      By BrewManNH
      Following along with the odd clock theme that seems to be popular lately, I have come up with a BCD clock to add to the collection. It's a 24 hour clock, you can modify it to a 12 hour clock, but it's not as interesting that way.
      This clock can be changed to display milliseconds by changing one variable at the start of the Main function, there are comments describing that. In my opinion I wouldn't have it display the mseconds because they change too fast to keep track of, it looks terrible, and flickers BADLY.
      The way the clock is set up currently, it displays one icon for the light being "off" and another for it being "on". You can use whatever icons for these that you'd like instead of the ones in the zip file. Change the variables in the Global declaration at the start of the script to whatever you'd like. Another variation that you can use is to set the "off" icon to a blank file name and then it will only turn on the lights that are supposed to be on, and there will be empty spaces for the off icons.
      If nothing else, at least you'll learn binary and/or BCD numbers.
      Updated: Corrected the issue with the seconds for the number 7.
       
      BCD Clock.zip