johnmcloud Posted February 3, 2013 Share Posted February 3, 2013 (edited) Hi guys, I'm using the _ProgressMarquee by guinness. Work fine, but i have a little problem. If i remove the style to the GUICtrlCreateProgress, the size of the red element is too little ( i don't know how to call it ) And also i have lost the smooth to the red element. Anyway, how to make it bigger? expandcollapse popup#include <WinAPI.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> $Form1 = GUICreate("TestProgress", 370, 101, 192, 124) $Button1 = GUICtrlCreateButton("Start", 8, 8, 65, 33) $Button2 = GUICtrlCreateButton("Stop", 80, 8, 57, 33) $Progress = GUICtrlCreateProgress(8, 48, 353, 33) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Progress), "wstr", 0, "wstr", 0) GUICtrlSetColor(-1, 0xFF0000) GUISetBkColor(0x000000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ProgressMarquee_Start($Progress) Case $Button2 _ProgressMarquee_Stop($Progress, 1) EndSwitch WEnd Func _ProgressMarquee_Start($iControlID = -1) Local $aArray = GUICtrlGetStyle($iControlID) If Not BitAND($PBS_MARQUEE, $aArray[0]) Then GUICtrlSetStyle($iControlID, $PBS_MARQUEE) EndIf Return GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 1, 50) EndFunc ;==>_ProgressMarquee_Start Func _ProgressMarquee_Stop($iControlID = -1, $iReset = 0) If $iReset Then Return GUICtrlSetStyle($iControlID, 0) EndIf Return GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 0, 50) EndFunc ;==>_ProgressMarquee_Stop Func GUICtrlGetStyle($iControlID) Local $aArray[2] = [-1, -1], $hControl = GUICtrlGetHandle($iControlID) $aArray[0] = _WinAPI_GetWindowLong($hControl, $GWL_STYLE) $aArray[1] = _WinAPI_GetWindowLong($hControl, $GWL_EXSTYLE) Return $aArray EndFunc ;==>GUICtrlGetStyle Edited February 4, 2013 by johnmcloud Link to comment Share on other sites More sharing options...
BrewManNH Posted February 3, 2013 Share Posted February 3, 2013 (edited) If you remove what style from the GUICtrlCreateProgress?A would have been helpful too because without it, everyone has to do a search for it, and you used the wrong name so that made searching harder. Edited February 3, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
johnmcloud Posted February 3, 2013 Author Share Posted February 3, 2013 (edited) Ops, you have right, i have forgot the linkAnyway, this is before remove the Style to classic theme with:DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Progress), "wstr", 0, "wstr", 0)After:I'd like to make that red element more bigger, and maybe smooth if possible Edited February 3, 2013 by johnmcloud Link to comment Share on other sites More sharing options...
BrewManNH Posted February 3, 2013 Share Posted February 3, 2013 I don't think it's possible, the progress bar style is created by Windows, you're just removing the theme from the control, not a style. Removing the theme is the only way to recolor the bar to make it red. You'd have to do a search for using GDI+ to create the progress bar, there are examples of it on the forum, or one of the other methods of creating your own progress bar. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
johnmcloud Posted February 3, 2013 Author Share Posted February 3, 2013 Oh, it's not possible? Bad news Link to comment Share on other sites More sharing options...
guinness Posted February 3, 2013 Share Posted February 3, 2013 I've seen something by Yashied which might interest you. The colours which could be chosen were, red, green, blue and yellow. UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
johnmcloud Posted February 3, 2013 Author Share Posted February 3, 2013 I have saw it, but work only for 7/Vista, not for Xp Link to comment Share on other sites More sharing options...
guinness Posted February 3, 2013 Share Posted February 3, 2013 Ah, true. I just remember it from look back 2yrs ago (I think.) UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 I have make something really simple: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 392, 122, 195, 137) $Button1 = GUICtrlCreateButton("Start", 16, 88, 65, 25) $Button2 = GUICtrlCreateButton("Stop", 90, 88, 65, 25) $Label_White = GUICtrlCreateLabel("", 16, 32, 364, 36) GUICtrlSetBkColor(-1, 0xFFFFFF) $Label_Red = GUICtrlCreateLabel("", 16, 32, 132, 36) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Start() EndSwitch WEnd Func _Start() GUICtrlSetState($Label_Red, $GUI_SHOW) While 1 For $x = 1 To 232 GUICtrlSetPos($Label_Red, 16 + $x, 32, 132) Sleep(10) Next WEnd EndFunc ;==>_Start The problems are: 1) I don't know how to stop it, and not also. I'd like something like: Start_Bar() continues with my script, do whatever loop, func, etc. Stop_Bar() 2) I don't know how to make the red bar continue without exiting from the white label, like a real marquee ( now it stop before exiting ) Thanks Link to comment Share on other sites More sharing options...
guinness Posted February 4, 2013 Share Posted February 4, 2013 Not perfect but gives you the idea. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGUI = GUICreate('', 392, 122, 195, 137) Local Const $iStart = GUICtrlCreateButton('Start', 16, 88, 65, 25) Local Const $iStop = GUICtrlCreateButton('Stop', 90, 88, 65, 25) Local Const $iLabel_White = GUICtrlCreateLabel('', 16, 32, 364, 36) GUICtrlSetBkColor($iLabel_White, 0xFFFFFF) Local Const $iLabel_Red = GUICtrlCreateLabel('', 16, 32, 132, 36) GUICtrlSetBkColor($iLabel_Red, 0xFF0000) GUICtrlSetState($iLabel_Red, $GUI_HIDE) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iStart _Start($iLabel_Red, $iStop) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _Start($iLabel, $iStop) GUICtrlSetState($iLabel, $GUI_SHOW) Local $iInc = 1 While Sleep(10) * (Not (GUIGetMsg() = $iStop)) GUICtrlSetPos($iLabel, 16 + $iInc, 32, 132) $iInc += 1 If $iInc = 232 Then $iInc = 1 WEnd GUICtrlSetState($iLabel, $GUI_HIDE) EndFunc ;==>_Start UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 johnmcloud, Does this help? expandcollapse popup#include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 400, 130) $Button1 = GUICtrlCreateButton("Start", 10, 90, 80, 30) $Button2 = GUICtrlCreateButton("Stop", 100, 90, 80, 30) $sLabel = GUICtrlCreateLabel("", 10, 10, 1, 30) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Start() EndSwitch WEnd Func _Start() GUICtrlSetState($sLabel, $GUI_SHOW) While 1 For $i = 1 to 480 Switch $i Case 1 To 99 GUICtrlSetPos($sLabel, 10, 10, $i, 30) Case 380 To 480 GUICtrlSetPos($sLabel, $i - 90, 10, 480 - $i, 30) Case Else GUICtrlSetPos($sLabel, $i - 90, 10, 100, 30) EndSwitch $iBegin = TimerInit() Do If GUIGetMsg() = $Button2 Then GUICtrlSetState($sLabel, $GUI_HIDE) GUICtrlSetPos($sLabel, 10, 10, 1, 30) Return EndIf Until TimerDiff($iBegin) > 20 Next WEnd EndFunc ;==>_Start M23  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...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 I have check it out both example, but i have a little problem: expandcollapse popup#include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 400, 130) $Button1 = GUICtrlCreateButton("Start", 10, 90, 80, 30) $Marquee = _MarqueeBar_Create(10, 25, 350, 35, 0xFFFFFF, 0xFF0000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Test() EndSwitch WEnd Func _MarqueeBar_Create($x, $y, $width, $height, $bkcolor, $progresscolor) $Background = GUICtrlCreateLabel("", $x, $y, $width, $height) GUICtrlSetBkColor(-1, $bkcolor) $Progress = GUICtrlCreateLabel("", $x, $y + 2, 1, $height - 5) GUICtrlSetBkColor(-1, $progresscolor) GUICtrlSetState(-1, $GUI_HIDE) Return $Progress EndFunc ;==>_MarqueeBar_Create Func _MarqueeBar_Start($x, $y, $width, $height) GUICtrlSetState($Marquee, $GUI_SHOW) While 1 For $i = 1 To $width + 100 Switch $i Case 1 To 99 GUICtrlSetPos($Marquee, $x, $y + 2, $i, $height - 5) Case $width To $width + 100 GUICtrlSetPos($Marquee, $i - 90, $y + 2, $width + 100 - $i, $height - 5) Case Else GUICtrlSetPos($Marquee, $i - 90, $y + 2, 100, $height - 5) EndSwitch Sleep(20) Next WEnd EndFunc ;==>_MarqueeBar_Start Func Test() ;~ _MarqueeBar_Start(10, 25, 350, 35) For $i = 1 To 250 ConsoleWrite("Running" & @CRLF) Sleep(200) Next ;~ _MarqueeBar_Stop() EndFunc ;==>Test Func _MarqueeBar_Stop() ;~ Test EndFunc I need to use a marquee bar for a function i don't know how many times work. So i need something like: _MarqueeBar_Start() My func MarquueBar_Stop() With the version of guinness work this way, but the "new" not, maybe for the loop. How to do that? Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 (edited) johnmcloud, Some people are never satisfied! expandcollapse popup#include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 400, 130) $Button1 = GUICtrlCreateButton("Start", 10, 90, 80, 30) $Button2 = GUICtrlCreateButton("Stop", 100, 90, 80, 30) $sLabel = GUICtrlCreateLabel("", 10, 10, 1, 30) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _Start() Case $Button2 _Stop() EndSwitch WEnd Func _Start() AdlibRegister("_Marquee", 20) GUICtrlSetState($sLabel, $GUI_SHOW) EndFunc Func _Stop() AdlibUnRegister("_Marquee") GUICtrlSetState($sLabel, $GUI_HIDE) GUICtrlSetPos($sLabel, 10, 10, 1, 30) EndFunc Func _Marquee() Static $iLoop = 0 $iLoop = Mod($iLoop + 1, 481) + 1 Switch $iLoop Case 1 To 99 GUICtrlSetPos($sLabel, 10, 10, $iLoop, 30) Case 380 To 480 GUICtrlSetPos($sLabel, $iLoop - 90, 10, 480 - $iLoop, 30) Case Else GUICtrlSetPos($sLabel, $iLoop - 90, 10, 100, 30) EndSwitch EndFunc ;==>_Start M23 Edited February 4, 2013 by Melba23 Removed some debugging code  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...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 (edited) Some people are never satisfied! Some people...just say my name and you're not wrong, i like to improve my knowledge I have a last problem, this is real my last Using AdlibRegister i can't pass paramenter to the Func ( example like the handle ), but i have more than one GUI and more then one ProgressBar, some idea for avoid to copy many times the same Func? Edited February 4, 2013 by johnmcloud Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 johnmcloud, Perhaps this might give you an idea of how you might use multiple marquees? Here there are only 2 but you can scale it up for as many as you like (well, quite a few anyway) and still use the same functions. expandcollapse popup#include <GUIConstantsEx.au3> Global $aMarquee_CID[3] ; This holds the CIDs of the marquees Global $aMarquee_Y[3] = [0, 10, 50] ; This holds the Y coordinates - you might need a 2D array to hold both X & Y Global $iMarquee = 0 ; This is a flag to show which marquees are active $Form1 = GUICreate("Form1", 400, 130) $cStart_1 = GUICtrlCreateButton("Start 1", 10, 90, 80, 30) $cStop_1 = GUICtrlCreateButton("Stop 1", 100, 90, 80, 30) $cStart_2 = GUICtrlCreateButton("Start 2", 220, 90, 80, 30) $cStop_2 = GUICtrlCreateButton("Stop 2", 310, 90, 80, 30) $aMarquee_CID[1] = GUICtrlCreateLabel("", 10, 10, 1, 30) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) $aMarquee_CID[2] = GUICtrlCreateLabel("", 10, 50, 1, 30) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cStart_1 _Start(1) Case $cStop_1 _Stop(1) Case $cStart_2 _Start(2) Case $cStop_2 _Stop(2) EndSwitch WEnd Func _Start($iIndex) $iMarquee = BitOr($iMarquee, 2 ^ $iIndex) ; Set the flag to show that this marquee is active AdlibRegister("_Marquee", 20) ; At least one must be active GUICtrlSetState($aMarquee_CID[$iIndex], $GUI_SHOW) ; And show the one that is now active EndFunc ;==>_Start Func _Stop($iIndex) $iMarquee = BitXOR($iMarquee, 2 ^ $iIndex) ; Remove this marquee from the flag If $iMarquee = 0 Then AdlibUnRegister("_Marquee") ; If no marquees are active no point in running the function EndIf GUICtrlSetState($aMarquee_CID[$iIndex], $GUI_HIDE) ; Hide this marquee GUICtrlSetPos($aMarquee_CID[$iIndex], 10, $aMarquee_Y[$iIndex], 1, 30) ; And reposition it EndFunc ;==>_Stop Func _Marquee() Static $iLoop = 0 $iLoop = Mod($iLoop + 1, 481) + 1 ; Move the marquee Switch $iLoop Case 1 To 99 For $iIndex = 1 To UBound($aMarquee_CID) - 1 ; Look for each possible marquee in the flag If BitAnd($iMarquee, 2 ^ $iIndex) Then GUICtrlSetPos($aMarquee_CID[$iIndex], 10, $aMarquee_Y[$iIndex], $iLoop, 30) ; And move it if it was present EndIf Next Case 380 To 480 For $iIndex = 1 To UBound($aMarquee_CID) - 1 If BitAnd($iMarquee, 2 ^ $iIndex) Then GUICtrlSetPos($aMarquee_CID[$iIndex], $iLoop - 90, $aMarquee_Y[$iIndex], 480 - $iLoop, 30) EndIf Next Case Else For $iIndex = 1 To UBound($aMarquee_CID) - 1 If BitAnd($iMarquee, 2 ^ $iIndex) Then GUICtrlSetPos($aMarquee_CID[$iIndex], $iLoop - 90, $aMarquee_Y[$iIndex], 100, 30) EndIf Next EndSwitch EndFunc ;==>_Marquee The trick is using a single flag to show which marquess are active by using the powers of 2 as steps to increase its value - Windows does the same thing with styles. Any complaints this time? And please ask if you do not understand anything in the script. M23  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...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 It's everything clear, better to put this solved or i'll make 1000 question Thanks Melba and guinnes for your times Link to comment Share on other sites More sharing options...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 (edited) Melba, i have found a bug The "stop" doesn't reset the position of the label, or better it reset but when you click on "start" it starts from the same position you have stopped it, try it yourself, you have create a "pause" button Thanks Edited February 4, 2013 by johnmcloud Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 johnmcloud,That is not a "bug", it is a "feature". But here is a version where the marquee always starts from the left: expandcollapse popup#include <GUIConstantsEx.au3> Global $aMarquee_CID[3] ; This holds the CIDs of the marquees Global $aMarquee_Y[3] = [0, 10, 50] ; This holds the Y coordinates - you might need a 2D array to hold both X & Y Global $aMarquee_Pos[3] = [0, 0, 0] ; This holds the position of each marquee in its track Global $iMarquee = 0 ; This is a flag to show which marquees are active $Form1 = GUICreate("Form1", 400, 130) $cStart_1 = GUICtrlCreateButton("Start 1", 10, 90, 80, 30) $cStop_1 = GUICtrlCreateButton("Stop 1", 100, 90, 80, 30) $cStart_2 = GUICtrlCreateButton("Start 2", 220, 90, 80, 30) $cStop_2 = GUICtrlCreateButton("Stop 2", 310, 90, 80, 30) $aMarquee_CID[1] = GUICtrlCreateLabel("", 10, 10, 1, 30) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_HIDE) $aMarquee_CID[2] = GUICtrlCreateLabel("", 10, 50, 1, 30) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cStart_1 _Start(1) Case $cStop_1 _Stop(1) Case $cStart_2 _Start(2) Case $cStop_2 _Stop(2) EndSwitch WEnd Func _Start($iIndex) $iMarquee = BitOr($iMarquee, 2 ^ $iIndex) ; Set the flag to show that this marquee is active AdlibRegister("_Marquee", 20) ; At least one must be active GUICtrlSetState($aMarquee_CID[$iIndex], $GUI_SHOW) ; And show the one that is now active $aMarquee_Pos[$iIndex] = 0 ; Reset the position to the left EndFunc ;==>_Start Func _Stop($iIndex) $iMarquee = BitXOR($iMarquee, 2 ^ $iIndex) ; Remove this marquee from the flag If $iMarquee = 0 Then AdlibUnRegister("_Marquee") ; If no marquees are active no point in running the function EndIf GUICtrlSetState($aMarquee_CID[$iIndex], $GUI_HIDE) ; Hide this marquee GUICtrlSetPos($aMarquee_CID[$iIndex], 10, $aMarquee_Y[$iIndex], 1, 30) ; And reposition it EndFunc ;==>_Stop Func _Marquee() For $iIndex = 1 To UBound($aMarquee_CID) - 1 ; Look for each possible marquee in the flag If BitAnd($iMarquee, 2 ^ $iIndex) Then $aMarquee_Pos[$iIndex] = Mod($aMarquee_Pos[$iIndex] + 1, 481) + 1 ; Change the position of this marquee Switch $aMarquee_Pos[$iIndex] ; And move it Case 1 To 99 GUICtrlSetPos($aMarquee_CID[$iIndex], 10, $aMarquee_Y[$iIndex], $aMarquee_Pos[$iIndex], 30) Case 380 To 480 GUICtrlSetPos($aMarquee_CID[$iIndex], $aMarquee_Pos[$iIndex] - 90, $aMarquee_Y[$iIndex], 480 - $aMarquee_Pos[$iIndex], 30) Case Else GUICtrlSetPos($aMarquee_CID[$iIndex], $aMarquee_Pos[$iIndex] - 90, $aMarquee_Y[$iIndex], 100, 30) EndSwitch EndIf Next EndFunc ;==>_MarqueeAnd that is it - you are on your own from now on. M23  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...
johnmcloud Posted February 4, 2013 Author Share Posted February 4, 2013 (edited) Yeah, a feature It' better to update also the script with one marquee bar at post #13, maybe can be useful for other Edited February 4, 2013 by johnmcloud Link to comment Share on other sites More sharing options...
OliverA Posted February 4, 2013 Share Posted February 4, 2013 Agree, if possible please update the post with 1 progressbar, i don't understand nothing about all that array lol I'm getting started I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone 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