Solved

Setting pushbutton caption

Posted on 1998-08-14
3
203 Views
Last Modified: 2013-11-20
I'm pretty new to MFC, and I have the following problem:

I simply want to change the the caption of a pushbutton so that when the user clicks it, the text changes from "Start" to "Stop"or vice versa. I don't want to use bitmaps, and I don't want to create two buttons and show/hide them - I would like to learn how to programatically change the text of just one button.

In an MFC created dialog-based app called MyTest, with classes MyTest and MyTestDlg, and a pushbutton called  ID_START_STOP, how do I implement this feature ?

Thanks a lot,

Boedeker



0
Comment
Question by:boedeker
  • 2
3 Comments
 
LVL 6

Expert Comment

by:snoegler
ID: 1320781
The following lines must be placed in your CDialog object
(perhaps in the OnStartStop handler function):

CString newCaption;
// set newCaption to the desired text
GetDlgItem(ID_START_STOP)->SetWindowText(newCaption);

I would suggest that you re-open this question with 50 points - 100 points are really much for
this question :) :) :)

0
 

Author Comment

by:boedeker
ID: 1320782
Thanks for the answer snoegler - it works fine, so post anything as an answer and I'll give you the points :)


Boedeker
0
 
LVL 6

Accepted Solution

by:
snoegler earned 100 total points
ID: 1320783
Thanks :)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now