Click here to Skip to main content
Licence 
First Posted 3 Mar 2000
Views 188,599
Bookmarked 70 times

CLedButton

By | 3 Mar 2000 | Article
A button that looks like a LED.

Sample Image - CLedButton.jpg

Introduction

class CLedButton : public CButton (version 1.0)

This is a class which displays a LED that has 2 states: ON or OFF. The LED can have some text on its right. The LED is read-only (on user side) and cannot have focus (you should disable "tab stop" in the resource). The disabled state is not implemented: it is exactly like the enable state.

How to use CLedButton:

  1. To your dialog, add either a button, a checkbox or a radio button.
  2. Bind it to a member variable (of type Control) using Class Wizard.
  3. Then change in the header file, the class type to CLedButton.
  4. In InitDialog(), bind your bitmap resource to the button:
    m_greenLed.SetImage( IDB_LEDBUTTON_GREEN, 15 );
    //15 is the width of one image in the bitmap
  5. You can set or retrieve the state of the LED (ON or OFF) using the following member:
    m_greenLed.Depress(TRUE);  //ON  (second image in bitmap)
    m_greenLed.Depress(FALSE); //OFF (first image in bitmap)

The bitmaps are given with the source code:

  • greenButton.bmp
  • redButton.bmp

Please visit: http://welcome.to/softbird for updates, other sources and more!

The sample project was compiled with Visual C++ 6 (MFC 4.2 ) and not tested with Unicode.

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

About the Author

Benjamin Mayrargue



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralKingPower PinmemberKingPeng1:57 25 Jun '06  
GeneralRe: KingPower Pinmemberzaodt8:29 8 May '07  
GeneralCorrected Class PinmemberDevil for ever9:36 18 May '06  
GeneralAnomally behavior with several controls PinsussAnonymous22:48 6 Mar '05  
GeneralProblem with CFormView PinmemberSeve Ho21:31 21 Jul '04  
QuestionHow to get Tab order and garyed status Pinmembertiousi6:45 18 Dec '03  
Generaldynamically creation of CLedButton Pinmembersilverspoon3:15 15 Jul '02  
GeneralLedButtons with Dialog BAr Pinmembermurd5:14 26 Jan '02  
GeneralPoor Plagiarism PinmemberBill Gates Antimatter Particle7:15 25 Nov '01  
GeneralRe: Poor Plagiarism PinmemberShaun Harrington13:12 21 Feb '06  
GeneralRed - Green Toggle PinmemberMarkKozel12:09 6 Nov '01  
GeneralMinor alignment bug... PinmemberKevin Pinkerton6:01 6 Jun '01  
GeneralRe: Minor alignment bug... PinmemberAnonymous8:30 6 Jun '01  
QuestionIf I do dialog docking, how I can show LED Button and control? PinmemberHeon18:02 30 Mar '01  
AnswerRe: If I do dialog docking, how I can show LED Button and control? PinmemberAnonymous5:22 6 Jun '01  
Generalcledbutton PinsussKunle Adeleye14:43 18 Jun '00  
GeneralRe: cledbutton PinsussBenjamin Mayrargue6:53 20 Jul '00  
GeneralRe: cledbutton PinmemberKevin Pinkerton3:35 6 Jun '01  

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

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 4 Mar 2000
Article Copyright 2000 by Benjamin Mayrargue
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid