Solved

Setting pushbutton caption

Posted on 1998-08-14
3
206 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 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