Re: Creating popup dialog as child of a view



<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]

.



Relevant Pages

  • Creating popup dialog as child of a view
    ... 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. ... The user can open various graph dialogs, ...
    (microsoft.public.vc.mfc)
  • Re: Saving and Restoring a Child Window to its Former Position and Size
    ... The parent of this child is the main window of the applicaion and is ... I expected the attempt at restoration showed the relative position of the ... the upper left corner of the Main Window's client area. ...
    (microsoft.public.vc.mfc)
  • Re: Saving and Restoring a Child Window to its Former Position and Size
    ... The child window is descended from CScrollView. ... The pView pointer is a member of that object's ...
    (microsoft.public.vc.mfc)
  • Re: MDI Min Max - still there - solved
    ... When the child first form gets created it doesnt open in maximize. ... window look pretty than actually trying to code the real code needed ... Basically think of a form with a Panel docked left, ... the space where the new mdi child form can be displayed is ...
    (microsoft.public.dotnet.languages.vb)
  • Re: MDI Min Max - still there
    ... When the child first form gets created it doesnt open in maximize. ... window look pretty than actually trying to code the real code needed ... Basically think of a form with a Panel docked left, ... the space where the new mdi child form can be displayed is ...
    (microsoft.public.dotnet.languages.vb)

Loading