Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dialog box inside scrolling view

Posted on 1998-10-05
10
Medium Priority
?
276 Views
Last Modified: 2013-11-20
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.

0
Comment
Question by:ramsay
  • 6
  • 4
10 Comments
 
LVL 1

Author Comment

by:ramsay
ID: 1322937
my diagrams are screwed...

ignore below (experiment)

|      |      |      |
\       \       \       \
\.......\.......\.......\
0
 
LVL 1

Author Comment

by:ramsay
ID: 1322938
damn thing.. EVER HEARD OF COURIER!

try and decipher the diagrams as best u can
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1322939
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:psdavis
ID: 1322940
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
 
LVL 1

Author Comment

by:ramsay
ID: 1322941
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
 
LVL 7

Expert Comment

by:psdavis
ID: 1322942
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
 
LVL 1

Author Comment

by:ramsay
ID: 1322943
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
 
LVL 1

Author Comment

by:ramsay
ID: 1322944
I need an answer pretty soon
0
 
LVL 7

Accepted Solution

by:
psdavis earned 800 total points
ID: 1322945
// 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
 
LVL 1

Author Comment

by:ramsay
ID: 1322946
got it working!
thanx for your time!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question