Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing CEdit in CDialogBar

Posted on 1999-01-29
2
Medium Priority
?
286 Views
Last Modified: 2013-11-20
I am having problems getting and setting text to edit controls in a dialog bar.

I have a CDialogBar with a few edit controls in the dialog resource.  In my CMainFrame class I have declared public CEdit member variables for these controls , and I invoke their Create() method in CMainFrame::OnCreate(), with the dialog bar class as the parent window and the appropriate resource ID from the dialog resource.

How do I get/set text to these edit controls ? SetWindowText() does not appear to be working. Do I need to subclass ? If so, what window do I subclass ?

Thanks.
0
Comment
Question by:xn12z9i
2 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1328534
Do you mind sending some piece of code of how you declare your controls and stuff?

-Viktor
--Ivanov
0
 
LVL 3

Accepted Solution

by:
luisr earned 400 total points
ID: 1328535
The problem is that you are creating some set of edit controls in the dialog resource, and again creating the,m programatically.

The solution is to call SubclassDlgItem instead of Create like this:

m_edit1.SubclassDlgItem(IDC_EDIT1, this);
m_edit2.SubclassDlgItem(IDC_EDIT2, this);

during the dialogbar initialization.


0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

824 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