Shaded Buttons
v. 1.15 (1998)



CONTENTS

  1. Disclaimer
  2. What it is
  3. How to use it
    1. Button Styles
    2. Window Messages
    3. Presentation Parameters
  4. Known bugs/limitations
  5. Coming soon
  6. History
  7. Author
  8. Cost
  9. Where to get it
  10. Acknowledgements

1. DISCLAIMER

If you screw up your computer, it's your problem.

2. WHAT IT IS

It is a new window class that creates buttons with a rounded look by using a gradient pattern, so that the top of the button is lighter and the bottom is darker. Buttons can also have rounded sides, they can have icons, and they can be vertical (so that the gradient pattern goes from left to right instead of top to bottom). IMHO, it looks a lot nicer than normal push buttons. As well, radio buttons and check boxes are supported in the same way that they are in the normal button class.

Included are three sample programs. The first one has three sets of four buttons on the left, with up arrow, double-up arrows, double-down arrows, and down arrows. Each one changes the colour of the rectangle on the right. The buttons are coloured corresponding to the component of the colour that they change (eg. the red buttons will change the red component). The double-up and double-down buttons change the colour by 10, and the up/down arrows change the colour by one. At the bottom, there is a status bar that shows the current colour of the rectangle. Near the bottom-right, there is a button that pops up a dialog to change the outline of the rectangle. At the top, there is an About button, which displays the version of the Shaded Buttons DLL that is being used. (Make sure it's at least v. 1.06). (screen shot - 141k)

The second one is modified from Petzold's "OS/2 Presentation Manager Programming". It's a simple window with ten buttons: two in the middle with arrows pointing in or out, six coloured buttons on top of those buttons, with either a '<' or '>', one labelled "About", and one at the bottom which acts as a status bar. The buttons in the middle, when pushed, either shrink or enlarge the window. The coloured buttons change the colour of the "About" button. The status bar reports the RGB values for the "About" button. The "About" button does what you think it does. (screen shot - 18k)

The third one is just a simple window with a single button in it. The icon in the button is a rotating cube. When you press the button, an About box pops up. This was to show how Shaded Buttons reacts to WinSetWindowText. (sorry, no screen shot yet.)

I have included the source file. Feel free to modify it as you please for your own programs. If you can fix any bugs, or if you change/add anything that you think may be helpful, send it to me, and I may include it in future versions. In the sample directory, there's a sample.zip that contains the source for the sample programs. (note: the makefiles use tcsh as the shell, so you might have to modify it if you want to compile on your system.)

3. HOW TO USE IT

4. KNOWN BUGS/LIMITATIONS

  • Accelerators don't work yet.
  • URE insists on setting the PP_USER presentation parameter in dialog boxes, which is annoying since Shaded Buttons uses the PP_USER presentation parameter to control the background colour. If you don't have any rounded edges on your buttons, you won't notice, but if you do, the background will be white. As far as I can tell, you can just remove the part where PP_USER is set (from the .rc file).
  • Sometimes there is a noticeable flicker when you click on a button. Especially with very large buttons. I don't think there's much I can do about it, without potentially using a huge amount of memory.

5. COMING SOON (?)

Things I will probably add or change (in no particular order):
  • support the normal button's control data
  • make the BS_AUTORADIOBUTTON style work
  • make it behave more like normal buttons
  • make a better example program (ie. that shows off more features)
  • allow bitmaps to be displayed (instead of icons). Right now, it's not one of my priorities, but if anyone absolutely needs it, I can add it.
  • clean up the code!!! (It's horribly messy.)

6. HISTORY

7. THE AUTHOR

You can e-mail me at hubert@cs.ualberta.ca, or snail mail me at

    Hubert Chan
    3 Falstaff Ave.
    St. Albert, AB
    Canada, T8N 1V3
Send me comments, criticism, or $$$ ;-)

I have a home page set up at http://www.ualberta.ca/~hyc/Programming/. The newest version of Shaded Buttons will always be there. (Actually, the absolutely newest version will always be on my computer, but good luck trying to get it from there.)

8. COST

Free. If you really do want to send me something, though, I'm not going to complain.

Of course, I would very much appreciate if you acknowledged your use of Shaded Buttons. :-)

9. WHERE TO GET IT

From my home page: http://www.ualberta.ca/~hyc/Programming/

From Hobbes: web or ftp

These are the only places that I will put the files in. Feel free to upload it to other sites.

3. ACKNOWLEDGEMENTS




Last updated March 21, 1998. <><
Created by Hubert Chan.
Optimized for Netscape 2.02 for OS/2.