Click here to Skip to main content
15,883,705 members
Articles / Desktop Programming / MFC
Article

CPushPinButton v1.13 - A Push Pin Implementation

Rate me:
Please Sign up or sign in to vote.
4.55/5 (7 votes)
3 Mar 2000 74.6K   1.2K   34   3
A Freeware MFC PushPin button class.
  • Download source files - 15 Kb
  • Introduction

    Welcome to CPushPinButton, A Freeware MFC PushPin button class.

    Its appearance is similar to the pin button as seen on the OpenLook window manager on X-Windows & property dialogs in MSDEV aka VC++ IDE. The class is derived from CButton and when used appears as follows:

    Sample Image


    Usage
    History
    Planned Enhancements
    Contacting the Author


    Usage

    • To use the class in your code simply include PushPin.cpp and PushPin.h in your project and #include "PushPin.h" in which ever of your modules needs to make calls to the class.
    • You should also ensure that the 4 bitmaps (namely IDB_PP_PINNED, IDB_PP_PINNEDEDGE, IDB_PP_UNPINNED and IDB_PP_UNPINNEDEDGE) are copied over into your rc file.
    • Create a dialog template with an owner-draw button positioned where you want the push pin button. The size of the button in the template does not matter.
    • Using Classwizard associate a CBitmap with the button you just created. Then modify the declaration of the variable to make it a CPushPinButton instead of CButton.
    • To ensure that the class operates correctly when a color scheme change occurs, You should call the ReloadBitmaps() method in response to WM_SETTINGCHANGE or WM_WININICHANGE messages.
    • Your code will need to include MFC either statically or dynamically.


    History

    V1.0 (7 December 1997)
    • Minor code changes to fix a small redraw bug.

    V1.01 (26 November 1997)

    • Minor code changes to facilitate new CPushPinFrame module.

    V1.1 (20 November 1997)

    • Supports non default color schemes.
    • Supports dynamic changes to color schemes.
    • Complete restructuring of code.
    • Can now use an edged bitmap if you want to.
    • Dropped support for Win16.
    • Redid the example program.
    • Simplified external usage of class.

    V1.11 (22 February 1999)

    • A number of small code updates.
    • Code now compiles cleanly at warning level 4.
    • Code is now UNICODE enabled and build configurations are provided.

    V1.12 (2 June 1999)

    • Added a number of comments to improve code readability.
    • Changed the resource id of the button bitmaps to more meaningful values.
    • Class no longer uses message reflection to catch changes in the clicked state. This means that parent classes can now catch the clicked notification.
    • Code now uses mouse capturing which means that the button appears pressed if you click and hold the left mouse button over the push pin. This gives the pushpin class this standard button behavior.

    V1.13 (12 January 2000)

    • Fixed minor typo on the resource dialog.


    Planned Enhancements

    • If you have any other suggested improvements, please let me know so that I can incorporate them into the next release.


    Contacting the Author

    PJ Naughter
    Email: pjn@indigo.ie
    Web: http://www.naughter.com
    12 January 2000


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralThemes Pin
    Devil for ever17-Jun-06 10:28
    Devil for ever17-Jun-06 10:28 
    QuestionTAB key press not supported for selection? Pin
    23-Apr-01 23:53
    suss23-Apr-01 23:53 
    GeneralSlight Difference To the VC++ IDE Pin
    Jeremy Davis6-Jun-00 4:14
    Jeremy Davis6-Jun-00 4:14 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.