Solved

AddString to a CComboBox on a Dialog from CView::OnLButtonDown(...)

Posted on 2003-12-09
2
447 Views
Last Modified: 2013-11-20
Hi,  hopefully my question title didn't lead you astray, so i'll try and be as clear as i can (with pictures :)

i have a window that is split using a CSplitterWnd which is setup like so:

+---+-------------------+
|     |                        |
| A  |        B              |
|     |                        |
|     |                        |
+---+-------------------+

A - is a Dialog with a baseclass of CFormView loaded from a resource file
B - is a CView (Doc/View)

On A i have a CComboBox named IDC_SOURCEDOOR.
when when i click on B, i'd like to add a string to that combobox.

eg.

CMyAppView::OnLButtonDown(....)
{
    CComboBox *cb;
    cb = (CComboBox*)GetDlgItem(IDC_SOURCEDOOR);
    cb->AddString("Hiya");
}

unfortunately this crashes, and i'm just confused.

Thanks for any info.
Scott
0
Comment
Question by:ScottWojtowicz
[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 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 50 total points
ID: 9909920
Try this

CMyAppView::OnLButtonDown(....)
{
   CYourFormView *pFMVw = (CYourFormView *)m_wndSplitter.GetPane(0, 0);
   CComboBox *cb;
   cb = (CComboBox*)pFMVw->GetDlgItem(IDC_SOURCEDOOR);
   cb->AddString("Hiya");
}


Good Luck
0
 

Author Comment

by:ScottWojtowicz
ID: 9909953
works great! i made the mistake of concentrating my searchs around dialogs, and not so much of the splitter itself, which is why i guess i was painfully unsuccessful.

thanks again,
Scott
0

Featured Post

Technology Partners: 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

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

738 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