[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2003-12-09
2
Medium Priority
?
478 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

656 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