Solved

Changing a Group Box Caption...

Posted on 1998-03-11
5
359 Views
Last Modified: 2013-11-19
I think this is a simple thing to do, but I can't seem to get it working.  I am trying to change the caption that
appears at the top of a Group Box control at run time.  How do I reference the Group Box since it doesn't appear
as a control on my Dialog Box (even though it is there) when viewing it using the ClassWizard (under the
"Member Variables" tab)?  Since it doesn't appear as a control, I can't assign it a name like I can with a
ListBox or Button.  Any ideas?
0
Comment
Question by:tdiamond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:tflai
ID: 1316925
Change your group box resource ID to something like IDC_GBOX.  GetDlgItem(IDC_GBOX)->SetWindowText("Blah, Blah, Blah.");
0
 

Author Comment

by:tdiamond
ID: 1316926
I tried that, and the program dies, reporting that my program performed an illegal operation.  Any ideas why that might be happening?
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1316927
It seems like you are trying to set the caption before the window exists. You should do this in OnInitDialog AFTER you call the base class. Confirm that GetDlgItem() returns a NON-NULL value.

0
 

Author Comment

by:tdiamond
ID: 1316928
Sorry, the first answer proposed from tflai should of worked.  It was my fault.  I left the static control's resource ID as IDC_STATIC instead of changing it to something like ID_STATIC.  It works fine now.

Thanks everyone...
0
 
LVL 4

Expert Comment

by:tflai
ID: 1316929
Oop!  There goes the points...  :-(
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

724 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