?
Solved

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

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

770 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