?
Solved

Bringing Modeless dialog with populated view control from main application

Posted on 2004-05-01
10
Medium Priority
?
416 Views
Last Modified: 2013-11-20
Hi, experts

I have CHTMLView as my main application.
When menu item is clicked I would like to bring up my modal/modeless dialog
containing CListView/CListCtrl populated with items.
I need your suggestions for a proper way to do this before i get started.

Thank you
0
Comment
Question by:khlauster
[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
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 19

Assisted Solution

by:mrwad99
mrwad99 earned 180 total points
ID: 10967825
I am sure you know how to create a dialogue; just create it on the handler (that will probably be in the view class) for the menu item that is clicked in.

>> containing CListView/CListCtrl populated with items.

You will need to add all the items to CListView/CListCtrl in OnInitDialog() within the dialogue class; this is the standard place to do such things.  Code specific to that depends on your requirements, but this is definitely the place to do it.

HTH !
0
 

Author Comment

by:khlauster
ID: 10967878
Hi, mrwad99!

I do have Dialog with clistview in it and can be called from my CHTMLView handler
The only thing in a classes pane for my CMyDlg class there is no OnInitDialog() vertual function provided(dialog was created from resource studio)

Any sugestion?

Thank you for your help
 
0
 
LVL 4

Assisted Solution

by:bkfirebird
bkfirebird earned 75 total points
ID: 10967891
Open Classwizard and create a function for the message WM_INITDIALOG ... that will give you InitDialog
0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
LVL 19

Assisted Solution

by:mrwad99
mrwad99 earned 180 total points
ID: 10967894
If you are using MSVC++, you can open the class via class wizard, and then choose to add handler for the WM_INITDIALOG.  This will add this handler for you.

Be sure to add your code in the appropriate place (i.e. where it says TODO) !
0
 
LVL 19

Assisted Solution

by:mrwad99
mrwad99 earned 180 total points
ID: 10967896
bkfirebird: LOL, bet me by sixty seconds !
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 120 total points
ID: 10968221
>> When menu item is clicked I would like to bring up my modal/modeless dialog

Modal or modeless? Modal is simple. Use modeless only if you need to keep view active at the time when dialog is shown. To show modal dialog:

void CMyView::OnMenuItem()
{
    CMyDialog dlg(this);
 
    // Pass here required information for dialog initializing it's members.
    // For example, CMyDialog may contain some list (not list control, just list) which is filled here.
    // Use this information in OnInitDialog to show it in dialog controls.

    dlg.DoModal();
}


0
 

Author Comment

by:khlauster
ID: 10969302
Everything you suggested worked just fine,experts.
Only one thing left unclear for me:

In my OnInitDialog()
I am trying to use the following code to populate my CListView inside my dialog:

      GetListCtrl().SetExtendedStyle(LVS_EX_FULLROWSELECT);

      GetListCtrl().InsertColumn(0, "Address", LVCFMT_LEFT, 100, 0);
      GetListCtrl().InsertColumn(1, "City", LVCFMT_LEFT, 100, 1);
      GetListCtrl().InsertColumn(2, "State", LVCFMT_LEFT, 100, 2);

But can not get to GetListCtrl() of CListView
After this one is solved I have to plit the points, I guess

Thank you very much for your participation
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 120 total points
ID: 10970249
GetListCtrl is function of CListView. In dialog you need to add member variable of CListCtrl type (open Class Wizard, select this dialog in combo box, select Member Variables tag). Add CListCtrl variable for list control (for example, m_list_ctrl). Code should be:

m_list_ctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
...
0
 

Author Comment

by:khlauster
ID: 10971642
Thank again for your help,experts!
0
 
LVL 19

Expert Comment

by:mrwad99
ID: 10971644
Glad to help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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