Page 1 of 2

wxGauge - Marquee implementation

Posted: Thu Aug 18, 2005 1:39 pm
by lowjoel
Remember in XP you had that autoplay thingo that pops up when u insert removable media, and there was this blazing fast bar on it?

I've translated that to one that you all can use :)

For all of you normal developers, the patch is here, along with those for wxDev-C++ users, and if you have Borland Delphi, you can modify the wxDev-C++ source to allow you to use this style.

Code: Select all

Main wxWidgets Patch

Index: include/wx/msw/gauge95.h
RCS file: /pack/cvsroots/wxwindows/wxWindows/include/wx/msw/gauge95.h,v
retrieving revision 1.18
diff -u -r1.18 gauge95.h
--- include/wx/msw/gauge95.h	2005/01/21 18:11:12	1.18
+++ include/wx/msw/gauge95.h	2005/08/18 13:19:31
@@ -18,6 +18,8 @@
 #if wxUSE_GAUGE
+#define wxGA_MARQUEE 0x0030
 extern WXDLLEXPORT_DATA(const wxChar*) wxGaugeNameStr;
 // Group box
@@ -54,7 +56,11 @@
     // overriden base class virtuals
     virtual bool SetForegroundColour(const wxColour& col);
     virtual bool SetBackgroundColour(const wxColour& col);
+	// start or stop a marquee
+	virtual void StartMarquee(int interval);
+	virtual void StopMarquee();
     virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
     virtual wxSize DoGetBestSize() const;

Index: src/msw/gauge95.cpp
RCS file: /pack/cvsroots/wxwindows/wxWindows/src/msw/gauge95.cpp,v
retrieving revision 1.47
diff -u -r1.47 gauge95.cpp
--- src/msw/gauge95.cpp	2004/08/26 08:46:18	1.47
+++ src/msw/gauge95.cpp	2005/08/18 13:19:59
@@ -159,6 +159,9 @@
     if ( style & wxGA_SMOOTH )
         msStyle |= PBS_SMOOTH;
+    if ( style & wxGA_MARQUEE )
+    	msStyle |= PBS_MARQUEE;
     return msStyle;
@@ -218,6 +221,16 @@
     ::SendMessage(GetHwnd(), PBM_SETBKCOLOR, 0, (LPARAM)wxColourToRGB(col));
     return true;
+void wxGauge95::StartMarquee(int interval)
+	SendMessage((HWND)this->GetHWND(), PBM_SETMARQUEE, (WPARAM)true, (LPARAM)interval);
+void wxGauge95::StopMarquee()
+	SendMessage((HWND)this->GetHWND(), PBM_SETMARQUEE, (WPARAM)false, (LPARAM)0);
 #endif // wxUSE_GAUGE

wxDev-C++ Patch

Index: source/components/wxgauge.pas
RCS file: /cvsroot/wxdsgn/wxdevcpp/source/components/wxgauge.pas,v
retrieving revision 1.12
diff -u -r1.12 wxgauge.pas
--- source/components/wxgauge.pas	14 Aug 2005 16:25:09 -0000	1.12
+++ source/components/wxgauge.pas	18 Aug 2005 13:07:22 -0000
@@ -268,6 +268,7 @@
   FWx_PropertyList.add('Wx_GaugeStyle : Gauge Styles');
+  FWx_PropertyList.Add('wxGA_MARQUEE:wxGA_MARQUEE');
   FWx_PropertyList.add('Wx_GaugeOrientation : Orientation');

Index: source/components/wxUtils.pas
RCS file: /cvsroot/wxdsgn/wxdevcpp/source/components/wxUtils.pas,v
retrieving revision 1.19
diff -u -r1.19 wxUtils.pas
--- source/components/wxUtils.pas	14 Aug 2005 16:25:09 -0000	1.19
+++ source/components/wxUtils.pas	18 Aug 2005 13:14:12 -0000
@@ -228,7 +228,7 @@
   TWxGagOrientation = (wxGA_HORIZONTAL, wxGA_VERTICAL);
-  TWxgagStyleItem = (wxGA_SMOOTH);
+  TWxgagStyleItem = (wxGA_SMOOTH, wxGA_MARQUEE);
   TWxgagStyleSet  = set of TWxgagStyleItem;
   TWxsbtnOrientation = (wxSP_HORIZONTAL, wxSP_VERTICAL);
@@ -1155,6 +1155,9 @@
   if wxGA_SMOOTH in stdStyle then
+  if wxGA_MARQUEE in stdStyle then
+    strLst.add('wxGA_MARQUEE');
   if strLst.Count = 0 then
     Result := ''
more or less there, just tweak it a tad over here and there and we should be fine.

Just a word of caution: my patch does *0* error checking meaning if you have called SetValue accidentally, prepare for a program crash...

I might have to find a way to fix that, though.

Posted: Thu Aug 18, 2005 2:21 pm
by Jorg
Is there a pic of what you mean?

And hmm it is a bad thing to do no error checking, it might make wxWidgets base unstable, and not many ppl would like to apply your patch that way ;-)

- Jorgen

Posted: Thu Aug 18, 2005 10:16 pm
by lowjoel
because the main wxGauge class does not allow for error checking, in short :P i will practically have to redo the class definition...

Posted: Fri Aug 19, 2005 2:01 am
by leio
I too would like to see a screenshot of this control :)

Posted: Fri Aug 19, 2005 7:25 am
by lowjoel
its useless since its a moving marquee... u interested in a WMV? i have WME9 to capture it...

yep ill get it done ASAP

Posted: Fri Aug 19, 2005 8:52 am
by lowjoel thats the link... including example usage

Posted: Fri Aug 19, 2005 9:04 am
by upCASE
Nice. Maybe contribute it to the "real" community (although it's only of use for Windows users, on other platforms it should have no meaning...).

BTW: Naomi is online :P

Posted: Fri Aug 19, 2005 9:53 am
by leio
I do not really understand what does it do, as it doesn't run to the end.
Is it something to denote progress when the percentage can't be tracked in any reasonable accuracy? (e.g, once it reaches the end is starts moving back, or something)

Posted: Fri Aug 19, 2005 10:19 am
by upCASE
It's a different kind of wxGauge display. Normally the gauge fills the bar based on the current step. Like


The marquee style doesn't fill it completely, but displays only the progress by moving part of the gauge. Like




Posted: Fri Aug 19, 2005 10:23 am
by Ryan Norton
SAWEEEET! Normally a lot of companies use those when they don't have a definite time - i.e. keeps on going from start to finish... its to mess with your mind!

Posted: Fri Aug 19, 2005 10:27 am
by upCASE
Yeah, just like a "bogus" process.. Something is happening, really, trust us, there still is something happing, we just don't know how much of the process is finished... Don't you move that mouse! I'm not dead yet, I'm actually busy. See the nice bar moving, see it?? No, no need to touch the mouse. :D

Posted: Fri Aug 19, 2005 12:46 pm
by lowjoel
one of those times when wxBusyCursor doesnt work.... lol
yes i know naomis on...

but i just LOVE the wxDev-C++ integration that i manage to dig thru.... Find and Replace is a very nice ally :P

@upCASE what community?

Posted: Fri Aug 19, 2005 4:51 pm
by leio
And if the process lasts longer than it takes the bar to go to the end, it start moving back, I guess. And recall something.
Well, that exists on at least gtk+ too, and a feature request on trackers accompanied with a patch for wxMSW part, or even a patch to the patch tracker would be nice.

Posted: Sun Aug 21, 2005 10:00 am
by lowjoel
oh yes it does go back to the beginning and starts all over again

Posted: Fri Oct 14, 2005 11:03 pm
by lowjoel
@leio I know this is old, but you have any idea what code is for gtk? I'm a win32 person... If i have no choice :P