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.

LVL 1
ramsayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramsayAuthor Commented:
my diagrams are screwed...

ignore below (experiment)

|      |      |      |
\       \       \       \
\.......\.......\.......\
0
ramsayAuthor Commented:
damn thing.. EVER HEARD OF COURIER!

try and decipher the diagrams as best u can
0
psdavisCommented:
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
0
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

psdavisCommented:
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
0
ramsayAuthor Commented:
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

0
psdavisCommented:
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

0
ramsayAuthor Commented:
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?


0
ramsayAuthor Commented:
I need an answer pretty soon
0
psdavisCommented:
// Ahh, good to be back from Florida!  No wait, what am I saying!!!

void CSCVisTestView::OnViewTest1() {

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

Oops! dlg isn't initialized.  It shouldn't be a null pointer that you're using!

To call the dialog box from the view, try something like...

void CSCVisTestView::OnViewTest1()
{
   CMyChildFrame* pFrame = (CMyChildFrame*) GetParentFrame( );

   if( pFrame->m_wndMyDialogBar )
      pFrame->m_wndMyDialogBar->ViewTest2( );
}

Where CMyChildFrame is the class that you created the dialog bar in.

Now, you can't get the dialog to communicate with the view?  Probably because you're not SUPPOSED to!  I know this might sound strange, but in the doc/view architecture, the view should never be talked to!  Strange concept ain't it?  

The only one who should send messages to the view is the document and that is through the hint mechanism.  It is because there can be many views for the document and many documents to the frame.  The dialog bar should tell the document that data has changed. The document should receive the change and UpdateAllViews with the new information.  Then the views will acknowledge and update their views.

Good luck!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ramsayAuthor Commented:
got it working!
thanx for your time!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.