Link to home
Start Free TrialLog in
Avatar of ramsay
ramsay

asked on

Dialog box inside scrolling view

Dear Experts,

This is about placing a dialog box inside a scrolling view but in a specific way.

At the moment i have a normal scrolling view and a dialogue box

-------------------------------             ==========
|                             |                  /        /
-------------------------------                  /       /
|                           |^|            /        /
|                           | |             ==========
|                           | |
|                           | |
|                           | |
|                           | |
|                           | |
|                           |v|
-------------------------------

i want to place the dialog box modlessly (currently is modal) into the view yet still
maintain scrolling ability. so that it looks like this:

-------------------------------
|                             |
--------------------===========
|                |^|/         /
|                | |/         /
|                | |/         /
|                | |/         /
|                | |/         /
|                | |/         /
|                | |/         /
|                |v|/         /
--------------------===========

Hopefully the whole thing will be able to be resized and maintain its look.  the new button still only clears the viewing area.

Is this possible and if so may i have a very detailed explination.

Thanks in advance me.

Avatar of ramsay
ramsay

ASKER

my diagrams are screwed...

ignore below (experiment)

|      |      |      |
\       \       \       \
\.......\.......\.......\
Avatar of ramsay

ASKER

damn thing.. EVER HEARD OF COURIER!

try and decipher the diagrams as best u can
Have you considered using CDialogBar?  Since you want to dock the dialog inside of the view, you pretty much have to go that direction anyway.  Once the dialog bar is docked, then the scroll bars will work per normal.

Really take a close look at Stingray's Objective Toolkit.  I know it's a decent chunk of money, but the advantages that you will get are astronomical.  Your dialog bars will have the look and feel of the coolbars, plus you'll get quite a few enhancements throughout the MFC environment.

Phillip
p.s.  Your diagrams are fine.  All we have to do is cut and paste into notepad and we can see what you want.

Phillip
Avatar of ramsay

ASKER

Ok i placed a member variable in the visual test view so that when i double click on the screen it should create the window.
However when i try it nothing happens unless i resize the window.
Even after I resize it ant the box is displayed the box's initialisation is not carried out.
I used the code:

void CSCVisTestView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
   
      m_bar.Create(GetParent(),IDD_TREE,CBRS_LEFT,NULL);
          CScrollView::OnLButtonDblClk(nFlags, point);


}


I am not sure what it means by nID. (that is the parameter i placed NULL in)

THe dialog box i am using is IDD_TREE.

it has two controls in it
IDC_TREE - Tree Control
and
IDC_CHECK1 - check box

I have assigned them variables in the Class wisard

m_tree
m_check1 respectivly.

The first problem is how do i display the box without resising the window? The second is how
do i manipulate the controls within the box? The third is why does it not carry out its initialisation?

Thankx again Mr Ramsay

Ramsay,

> The first problem is how do i display the box without resising the window?

The frame should always be the parent of the dialog box, not the view.  You should ALWAYS have the dialog bar created in the frame, then you can hide the dialog when you want to.  Once tied to the frame, then the resizing will automatically take place.

The nID number is a little tricky.  The best thing to do is create yourself an entry in the resource.h file and add a variable somewhere between E800 and E900.  The first few E800-E804 are taken by the CPrintPreviewBar and such, as well as a few from E820-E826.  Add it something like

#define AFX_IDD_TREE E806

Then in your view menu option, you can turn off and on the bar as required.  You'll really will want to find a sample program if you're new to dialog bars.  They have a few 'personality' traits that you'll want to get used to.

> The second is how do i manipulate the controls within the box?
> The third is why does it not carry out its initialisation?

You might want to look out at www.codeguru.com and look for an article that adds DDX and OnInitDialog support to the CDialogBar.  It is invaluable!

I'll be out of town until Friday, I wish you good luck and godspeed with your project.

Phillip

Avatar of ramsay

ASKER

Ok I got this very effective piece of code from codeguru.com that allows a dockable cdialogbar
but I cannot for the life of me get the dialog to communicate with the view.
The code I used is below:

///THE VIEW
void CSCVisTestView::OnViewTest1() {

    CTestDialog* dlg;
    dlg->test2();
}

This calls
//THE DIALOG

void CTestDialog::test2()
{
    CSCVisTestView* pView;
    pView->ViewTest2();
}

Which calls
//THE VIEW AGAIN
void CSCVisTestView::OnViewTest2() {

      CSCVisTestDoc* pDoc = GetDocument();

}


The code i got from codeguru is in the page a docking_window/devstudio_like_CControlbar_2 it comes with a downloadable
 project file so you can see exactly what i mean.

 The communication screws up because I try to call getdocument() from within the viewtest()
Is there any way around this?


Avatar of ramsay

ASKER

I need an answer pretty soon
ASKER CERTIFIED SOLUTION
Avatar of psdavis
psdavis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ramsay

ASKER

got it working!
thanx for your time!