Solved

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

Posted on 2003-12-09
2
423 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
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 93
Adapt this command to show who installed 29 108
Host to IP 7 78
substring method in java 1 120
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…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

773 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