Scrolling Progressbar
Scrolling Progressbar
Can we have a progressbar that just scrolls (indicating it's busy), I'm sure you've seen this, a few blocks that flow across the bar, values make no difference.
Any ideas?
Any ideas?
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
I can have the progress changing but that fills the progressbar, that isn't the effect I am looking for, what I'd like is to have maybe 2 or 3 bars scroll from left to right continuously.
I think the style is called marquee, or something like that.
I think the style is called marquee, or something like that.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Code by Sparkie :
Alter the value 100 to alter the animation speed etc.
Code: Select all
; --> *** Requires WinXP with XP skins enabled ***
#PBS_MARQUEE = 8
#PBM_SETMARQUEE = #WM_USER + 10
If OpenWindow(0, 0, 0, 320, 160, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ProgressBarGadget(0, 10, 30, 300, 20, 0, 100, #PBS_MARQUEE)
ButtonGadget(1, 110, 70, 75, 20, "On")
HideGadget(0, 1)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
If GetGadgetText(1) = "On"
SetGadgetText(1, "Off")
HideGadget(0, 0)
SendMessage_(GadgetID(0), #PBM_SETMARQUEE, 1, 100) ; on
Else
SetGadgetText(1, "On")
SendMessage_(GadgetID(0), #PBM_SETMARQUEE, 0, 0) ; off
HideGadget(0, 1)
EndIf
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.
Another approach would be to display the progress bar as an animated GIF image. In the German forum in a similar thread (http://www.purebasic.fr/german/viewtopic.php?t=19786) the following links were posted which allow you to interactively design your own customized download indicator in different graphical shapes and colors. If you are satisfied with your result you are allowed to download the animation as a GIF file:
http://www.ajaxload.info
http://preloaders.net
To display the animated GIF image you can utilize the web gadget as PB already demonstrated in a rather old posting (which has to be adapted to PB 4):
http://www.purebasic.fr/english/viewtopic.php?t=3817
http://www.ajaxload.info
http://preloaders.net
To display the animated GIF image you can utilize the web gadget as PB already demonstrated in a rather old posting (which has to be adapted to PB 4):
http://www.purebasic.fr/english/viewtopic.php?t=3817
Thanks again, I think the send message approach does exactly what I need, it's a windows only app anyway. I think it looks a little nicer than simply displaying a wait message.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
A small thing, when you stop it, that's all it does, stop... It doesnt go back to it's original behaviour.
Any way to get it to report progress again?
Any way to get it to report progress again?
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Not sure what you are after but
will remove the marquee style and you can then use SetGadgetState() etc. to set the progress position.
Code: Select all
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) & ~#PBS_MARQUEE)
I may look like a mule, but I'm not a complete ass.
I was actually just reading about that on MSDN.
We are very fortunate to have a community of people that know this stuff, would of taken me ages to figure out what to put in there.
Thanks srod.
We are very fortunate to have a community of people that know this stuff, would of taken me ages to figure out what to put in there.
Thanks srod.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
I modified the code example to take the style off, and that works like a charm, should removing the tilde (~) not set it back on again?
Code: Select all
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) & #PBS_MARQUEE)
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------
If you want to toggle the style then use Xor :
Code: Select all
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) ! #PBS_MARQUEE)
I may look like a mule, but I'm not a complete ass.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: Scrolling Progressbar
I don't get it... Why does the code from Sparkie posted srod not work here? Nothing moves.
Also this SetWindowLongPtr_() thing doesn't work here.
P.S.
Skin support is activated. Using XP SP3.
Also this SetWindowLongPtr_() thing doesn't work here.
P.S.
Skin support is activated. Using XP SP3.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!