Solved

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

Posted on 2003-12-09
2
395 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
2 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 50 total points
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 94
Tab names are off by one 5 49
sum67 challenge 35 88
Change to event 1 72
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now