I created the owner-drawn gradient button control and want to share its source code with other developers here.
Here you can download the source code and sample application for Windows Mobile 6 and Win32 platforms
ANN: wxGradientButton - Simple Owner-Drawn Gradient Button
-
- I live to help wx-kind
- Posts: 178
- Joined: Mon Jul 23, 2007 9:01 am
Tested on Ubuntu 8.04
Hi,
i've tested the gradient buttons on ubuntu. It works great
GCC-Version: g++-4.3.1
wxWidgets: wxGTK-2.8.8
Here a makefile, and the sample app.
Regards
Orbitcowboy
i've tested the gradient buttons on ubuntu. It works great
GCC-Version: g++-4.3.1
wxWidgets: wxGTK-2.8.8
Here a makefile, and the sample app.
Regards
Orbitcowboy
- Attachments
-
- screenshot on an Linux OS (Ubuntu 'Hardy')
- Bildschirmfoto-wxTestMainFrame.png (11.67 KiB) Viewed 3874 times
-
- wxGradientButton.tar.gz
- tarball of the sample source, including a linux makefile
- (96.29 KiB) Downloaded 221 times
- silver.moon
- Experienced Solver
- Posts: 67
- Joined: Fri Feb 20, 2015 6:13 am
Re: ANN: wxGradientButton - Simple Owner-Drawn Gradient Button
Hi
Thanks, its a great example to begin with making custom buttons.
However there is one small issue, that is if you click the button again and again rapidly, then some of the clicks are missed
This can be observed with the change of the visual appearance which does not happen that often as the number of clicks.
Is there a way to fix this and the make the button as responsive as a native control ?
Thanks, its a great example to begin with making custom buttons.
However there is one small issue, that is if you click the button again and again rapidly, then some of the clicks are missed
This can be observed with the change of the visual appearance which does not happen that often as the number of clicks.
Is there a way to fix this and the make the button as responsive as a native control ?
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Re: ANN: wxGradientButton - Simple Owner-Drawn Gradient Button
The control uses EVT_LEFT_UP for sending the command events. You can change this logic and send on mouse down if you want.
Also the control is derived from wxWindow because (as far as I remember) there is no way to sking the wxButton under wxGTK. If you are going to use this only under Windows and OS X, you ,probably, could subclass from wxButton and then there will be no need to send the command event manually I think.
Also the control is derived from wxWindow because (as far as I remember) there is no way to sking the wxButton under wxGTK. If you are going to use this only under Windows and OS X, you ,probably, could subclass from wxButton and then there will be no need to send the command event manually I think.
- silver.moon
- Experienced Solver
- Posts: 67
- Joined: Fri Feb 20, 2015 6:13 am
Re: ANN: wxGradientButton - Simple Owner-Drawn Gradient Button
Hi, thanks for the reply.T-Rex wrote:The control uses EVT_LEFT_UP for sending the command events. You can change this logic and send on mouse down if you want.
Also the control is derived from wxWindow because (as far as I remember) there is no way to sking the wxButton under wxGTK. If you are going to use this only under Windows and OS X, you ,probably, could subclass from wxButton and then there will be no need to send the command event manually I think.
Indeed deriving from wxButton gives a more native behavior and all clicks are detected no matter how fast they are done. And there is no need to generate click events like with wxWindow. I have checked only on Windows 7.
However, I seem to have found another trick to make it work with wxWindow. When deriving from wxWindow,
do not call ReleaseMouse in wxEVT_LEFT_UP (mouse up) event, instead call ReleaseMouse inside wxEVT_LEAVE_WINDOW (mouse out) event handler. Then also the "rapid click" problem is solved. Not sure if this is a good way to do it.