-
May 18th, 2007, 03:12 PM
#1
How do I add a variable to a control ?
After I've designed a dialog with say, a ListBox... How do I connect the resource (display) with the CListBox variable in my main dialog class ?
-
May 18th, 2007, 03:15 PM
#2
Re: How do I add a variable to a control ?
I don't quite understand you, can you be more specific?? Possibly posting some minimal yet complete code? [please see my signature below....]
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
May 18th, 2007, 03:18 PM
#3
Re: How do I add a variable to a control ?
Take a look here. It's similar.
-
May 18th, 2007, 03:21 PM
#4
Re: How do I add a variable to a control ?
The code is too complex to paste, but here is the problem:
I created a dialog Project. In the main dialog I placed a ListBox control.
I want to add a varaiable to the control so I can update the information displayed in it. I tried using the class wizard, which creates the control variable. But I can't access the variable from within my main dialog even though it is a member of that dialog.
I was thinking that if I declare the CListBox m_listBox in the public section of the main dialog, and then attach is to the visual control, it might work. At least, it would help me understand it a little more if it doesn't work.
Understand now ?
-
May 18th, 2007, 03:30 PM
#5
Re: How do I add a variable to a control ?
Yeah, that's what I was looking for. I've done it before but couldn't remember. What DDX function is used for a CListBox ? DDX_Text isn't the right one...
-
May 18th, 2007, 03:37 PM
#6
Re: How do I add a variable to a control ?
Nevermind... Found it. DDX_Control. :-)
-
May 18th, 2007, 03:47 PM
#7
Re: How do I add a variable to a control ?
I'm still having the same problem...
Code:
CDialog {
...
public:
CListBox m_ListBox;
static BOOL CALLBACK GetWndName(HWND hWnd, LPARAM lParam){
m_ListBox.AddString("HEY!");
return TRUE;
}
...
}
So I can't access the ListBox in that function. They are both declared in the public section of the same dialog. What's the deal?
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
|