Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dialog box inside scrolling view

Posted on 1998-10-05
10
Medium Priority
?
275 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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