Re: Creating popup dialog as child of a view
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Mon, 10 Dec 2007 10:56:55 -0500
<zorrothefox@xxxxxxxxxxxxxx> wrote in message news:047bc73c-55e6-42ce-a17e-1caa2eae931e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I maintain an SDI document-view architecture based
application, for which I'm also writing an extension dll. Basically,
this extension dll defines a viewer for some particular log data.
Now this viewer has a splitter window, in which I'm loading two views.
One is a CListView, and the other is a CScrollView. The list view
shows the log entries, and the idea is that when a user double clicks
on any entry, a dialog with some graphs related to that event needs to
be displayed. The user can open various graph dialogs, then tile
vertically or horizontally, as he wishes.
The problem I'm facing is that when I popup the dialog, then it pops
up as a separate window, and not as part of the CScrollView. If I pop
it up as a child window, then there is no title bar to the dialog,
which is something I require, so that the user can re-position the
dialog within the view. I need the popup to be within the view area of
the Scrollview window. Also, I want to allow the user to tile and
cascade the graph dialogs within the view.
How I'm finally supporting this behaviour is by doing something like
this...
CGraphDlg * CGraphView::CreateGraph(DWORD dwIndex)
{
CGraphDlg * pDlg = new CGraphDlg(eventIndex, this);
if(pDlg)
pDlg->Create(IDD_DLG_GRAPH,GetDesktopWindow());
pDlg->SetParent(this);
pDlg->ShowWindow(SW_SHOW);
return pDlg;
}
However, sometimes I unexpectedly encounter a crash in the SetParent()
call. Is this because I'm doing something terribly hacky? Is there a
better way to ensure the required effect?
From what I've read, you should not usually use SetParent to force
parent to be changed. This can lead to unexpected side-effects.
However, I need the above mentioned characteristics.
Please note that since I'm extending the application, I cannot
reimplement it as MDI based or something like that.
Please help me out here. This problem has been bugging me for a few
days now, and I'd really appreciate any hints on how to implement this
in a strictly correct manner.
Thanks in advance,
Bharat.
Check your settings for the dialog style and other properties. None of the styles should make the dialog's titlebar disappear. Perhaps you turned off the title bar property? It is not clear why you are trying to make the dialog a child of the desktop. Making it a child of the view should do what you want.
None of the settings will make dialogs tile and cascade for you. But you can do that yourself in code using SetWindowPos on each dialog.
--
Scott McPhillips [VC++ MVP]
.
- Follow-Ups:
- Re: Creating popup dialog as child of a view
- From: zorrothefox
- Re: Creating popup dialog as child of a view
- References:
- Creating popup dialog as child of a view
- From: zorrothefox
- Creating popup dialog as child of a view
- Prev by Date: RE: Creating popup dialog as child of a view
- Next by Date: Recommended log file class
- Previous by thread: Re: Creating popup dialog as child of a view
- Next by thread: Re: Creating popup dialog as child of a view
- Index(es):
Relevant Pages
|
Loading