CodeGuru
Earthweb Search
Forums Wireless Jars Gamelan Developer.com
CodeGuru Navigation
Member Sign In
User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

Become a Marketplace Partner

jobs.internet.com

internet.commerce
Partners & Affiliates
















RSS Feeds

RSSAll

RSSVC++/C++

RSS.NET/C#

RSSVB

See more EarthWeb Network feeds

Home >> Visual C++ / C++ >> Controls >> Button Control


Hover buttons
Rating: none

Will Mainwaring (view profile)
March 28, 1999


(continued)



, and is a varation on Guy Gascoigne's CTrackLookButton class.

This CHoverButton class is best used in a bank of radio buttons, and behaves like scripted mouse sensitive "pop-up" buttons on web pages.

This article describes how to use this class as a bank of 4 radio buttons.

  1. Add 4 owner drawn buttons to a dialog, labelling each with text labels (if required).
  2. Use classwizard to add CButton member variables.
  3. In your dialog's header file, change the class type from CButton to CHoverButton.
  4. Add the HoverButton.cpp and HoverButton.h source files to your project.
  5. #include "HoverButton.h" in the dialog's header file.
  6. Design: up, down, focussed and disabled bitmaps for each button, or one set for all buttons (see my example).
  7. Use class wizard to add OnInitDialog() to your dialog's source file.
  8. In OnInitDialog(), for each button, call LoadBitmaps() passing the bitmap ID's required for each button.
  9. Add handler functions for BN_CLICKED for each button and add your processing in these functions.
  10. Add a function to your dialog class to reset all button highlighting to OFF, then set the button which has just been pressed to ON.
  11. Call this function after LoadBitmaps(), in your OnInitDialog() function.
  12. Call this function in each of the BN_CLICKED button handler functions.

Downloads

hover_button_src.zip

Source for updated Hoverbutton with bug fixes

  1. Greyed bitmap displayed properly
  2. Accelerator key added to project for fast exit

hover_button_exe.zip

Compiled release of hover button project

hover_group_src.zip(thanks to Jack van Dijk)

Source if project to demonstrate CObjectArray with Hoverbuttons

hover_group_exe.zip

Compiled executable of hover group project

Posted 7 November 1998.
Last Updated 27 March, 1999

Tools:
Add www.codeguru.com to your favorites
Add www.codeguru.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed







RATE THIS ARTICLE:   Excellent  Very Good  Average  Below Average  Poor  

(You must be signed in to rank an article. Not a member? Click here to register)

Latest Comments:
I repaired Hamid Yaseen's point - Legacy CodeGuru (05/07/2003)
Background image drawing over buttons - Legacy CodeGuru (04/10/2003)
Hover tooltips in an ActiveX Control - Legacy CodeGuru (06/17/2002)
Another way (probably good VB and C++) - Legacy CodeGuru (10/09/2001)
how in VB? - Legacy CodeGuru (09/09/2001)

View All Comments
Add a Comment:
Title:
Comment:
Pre-Formatted: Check this if you want the text to display with the formatting as typed (good for source code)



(You must be signed in to comment on an article. Not a member? Click here to register)


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers