johngbauer Posted September 11, 2007 Share Posted September 11, 2007 I am using the following code to try to get a vertical smoothed progress bar but it comes out segmented. I have tried several variaions with no luck CODE 9/11/07 ; johngbauer #include <GUIConstants.au3> dim $p01val,$sv GUICreate ("Options",400,400) $p01 = GUICtrlCreateProgress (10,10,200,200, BitOR ($PBS_SMOOTH, $PBS_VERTICAL)) $okbutton = GUICtrlCreateButton("OK",210,210,50) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE MsgBox(0,"Closing","Closing",1) exitloop Case $msg = $okbutton $p01val=$p01val+5 GUICtrlSetData($p01,$p01val) MsgBox(0,"OK",$p01val,2) EndSelect Wend Sleep(5000 Link to comment Share on other sites More sharing options...
Siao Posted September 11, 2007 Share Posted September 11, 2007 (edited) And you won't have any luck if you're running on WinXP with modern (default) themes. Smooth works only with Classic theme, as been noted many times in the past. That's just how Windows go, for whatever reason. If smooth look is important to you, you can try some custom made progress bars, there are quite a few of those in examples forum. Edited September 11, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
johngbauer Posted September 11, 2007 Author Share Posted September 11, 2007 Thank you fery much!! Idid several searches and didn't come across that. Just getting back to autoit after several months Again thanks. Link to comment Share on other sites More sharing options...
therks Posted September 12, 2007 Share Posted September 12, 2007 There was a method someone came up with that will let you force your application to run with the classic Windows look, can't remember who it was, or what it was called, but you could try looking around for it... My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Siao Posted September 12, 2007 Share Posted September 12, 2007 (edited) Wow, good call. There is a way to force theme (and not necessarily for whole window, for a single control too), it's SetWindowTheme. Works like this (based on GUICtrlCreateProgress example from helpfile): expandcollapse popup#include <GUIConstants.au3> GUICreate("My GUI Progressbar",220,100, 100,200) $progressbar1 = GUICtrlCreateProgress (10,10,200,20,$PBS_SMOOTH) $progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($progressbar2), "wstr", "", "wstr", "") $button = GUICtrlCreateButton ("Start",75,70,70,20) GUISetState () $wait = 20; wait 20ms for next progressstep $s = 0; progressbar-saveposition do $msg = GUIGetMsg() If $msg = $button Then GUICtrlSetData ($button,"Stop") For $i = $s To 100 $m = GUIGetMsg () If $m = -3 Then ExitLoop If $m = $button Then GUICtrlSetData ($button,"Next") $s = $i;save the current bar-position to $s ExitLoop Else $s=0 GUICtrlSetData ($progressbar1,$i) GUICtrlSetData ($progressbar2,(100 - $i)) Sleep($wait) EndIf Next if $i >100 then ; $s=0 GUICtrlSetData ($button,"Start") endif EndIf until $msg = $GUI_EVENT_CLOSE Edited September 12, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
martin Posted September 12, 2007 Share Posted September 12, 2007 Wow, good call. There is a way to force theme (and not necessarily for whole window, for a single control too), it's SetWindowTheme. Works like this (based on GUICtrlCreateProgress example from helpfile): expandcollapse popup#include <GUIConstants.au3> GUICreate("My GUI Progressbar",220,100, 100,200) $progressbar1 = GUICtrlCreateProgress (10,10,200,20,$PBS_SMOOTH) $progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($progressbar2), "wstr", "", "wstr", "") $button = GUICtrlCreateButton ("Start",75,70,70,20) GUISetState () $wait = 20; wait 20ms for next progressstep $s = 0; progressbar-saveposition do $msg = GUIGetMsg() If $msg = $button Then GUICtrlSetData ($button,"Stop") For $i = $s To 100 $m = GUIGetMsg () If $m = -3 Then ExitLoop If $m = $button Then GUICtrlSetData ($button,"Next") $s = $i;save the current bar-position to $s ExitLoop Else $s=0 GUICtrlSetData ($progressbar1,$i) GUICtrlSetData ($progressbar2,(100 - $i)) Sleep($wait) EndIf Next if $i >100 then ; $s=0 GUICtrlSetData ($button,"Start") endif EndIf until $msg = $GUI_EVENT_CLOSE Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Siao Posted September 13, 2007 Share Posted September 13, 2007 Eh? "be smart, drink your wine" Link to comment Share on other sites More sharing options...
martin Posted September 13, 2007 Share Posted September 13, 2007 Eh?Sorry if I confused you, I was just trying to say "That's good, I like that, thanks" without spending time writing. Didn't work did it. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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