|
-
April 11th, 2004, 02:57 PM
#1
Change caption on checkbox button at Runtime in VC++ 7.0
I am looking for a way to modify the caption of a checkbox in a MFC dialog at runtime.
// With associated member variable to the checkbox
m_Checkbox.SetWindowText("Caption");
does not work. GetWindowText shows an empty string and
SetWindowText does nothing.
The mfc help says "If the window is a control, the text within the contol is set" (not the caption)
How to set the caption? Am I doing something wrong in SetWindowsText or is it not the correct way?
Thank you for your help
-
April 12th, 2004, 07:22 AM
#2
Check to see that if control variable points to control properly or not.
Try using GetLastError and determine cause in Error Lookup utility.
-
April 15th, 2004, 12:54 AM
#3
Thank you for your suggestion.
Since it was a simple dialog, I restarted from scratch and it worked, some file must have been corrupt.
>Check to see that if control variable points to control properly or not.
I was wondering how to do this. How do you determine the connection between the appname.rc, the apnname.h and the Resource.h file. In the apnname.h file I only see the declaration of the variables, but not to which control they are linked.
-
April 15th, 2004, 01:04 AM
#4
posted by petermcwerner
but not to which control they are linked.
in your DoDataExchange(CDataExchange* pDX)
there will be lines like this that determine the linking and subclassing behind the scenes.
DDX_Control(pDX, IDC_BUTTON1, m_Btn);
-
April 15th, 2004, 01:19 AM
#5
That solves it
Thank you all for the help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|