Hi,
I have an MDI app, which contains some menus. One of the menu command
let me open a dialog box (CMyListDialog), which contains a list box
with a number of items.
I have added a double click handler (LBN_DBLCLK), which allow the user
to double click on a particular item, and then display the result in a
child frame.
On the dialog, there are also an "OK" and "Cancel" buttons. So
basically, this handler servers the same purpose as the OK button.
I am handling the OK event (when the user clicks on the OK button)
within CMainFrame, something like this:
void CMainFrame::OnPressOK()
{
CMyListDialog listDlg;
if (listDlg.DoModal() == IDOK)
{
// Code for creating new child frame
// and display selected result
}
}
In the double-click event handler, which is added for the list box in
the class CMyListDialog, is where I'm a little bit unsure. What should
I do here to return the selected item to the main frame? I have added
an event handler for the OK button, so should I just call that
function. My thinking is that since the double-clicking is effectively
the same as clicking the OK button, I can just simply call the OK
handler.
Any help would be much appreciated.
CS