Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Bringing Modeless dialog with populated view control from main application

Posted on 2004-05-01
10
Medium Priority
?
420 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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