3 views in same document in mdi app

Does anyone know how to switch between 3 views in the same window in a mfc
application.

I  have 3 menu functions, OnSalesChart, OnSalesTable, OnCategoryChart. the
sales chart is the default view.

I'm doing a variation of the code extract listed, which works but only if i
swap between one to the other and then back again before switching to
another view.

I think the problem lies with
    m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
    m_pCategoryView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
and how im processing them.

Could anyone help, if you need to email me, remove the obvious


void CChildFrame::OnDataListView()
{
if(m_pDataList == 0)     //Creating the datalist view
 {
  if(flag = 1 )
   m_pAssignmentView = (CAssignmentView*)GetActiveView();  //Cast and get
the active view
  else if(flag=3)
   m_pCategoryView = (CCategoryView*)GetActiveView();

  m_pDataList = new CDataList();        //create the new view

m_pDataList->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,rectDefault,this,AFX_IDW_P
ANE_FIRST+1); //initialise it
 }
 pDoc->AddView(m_pDataList);

 if(flag = 1)
 {
  m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
  m_pAssignmentView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
  m_pDataList->ShowWindow(SW_SHOW);
  m_pAssignmentView->ShowWindow(SW_HIDE); //hide the old view
  SetActiveView(m_pDataList);    //set the active view to the datalist
  pDoc->RemoveView(m_pAssignmentView); //remove the graph view
 }
 else if(flag =3)
 {
  m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
  m_pCategoryView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
  m_pDataList->ShowWindow(SW_SHOW);
  m_pCategoryView->ShowWindow(SW_HIDE); //hide the old view
  SetActiveView(m_pDataList);    //set the active view to the datalist
  pDoc->RemoveView(m_pCategoryView); //remove the graph view
 }
 m_pDataList->OnInitialUpdate();   //call this method so that it displays
the datalist
 RecalcLayout();
 flag = 2;
}


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004


0
4/17/2004 12:15:47 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
409 Views

Similar Articles

[PageSpeed] 35

Try this:

http://www.codeproject.com/useritems/MultiViewsMFC_MDI.asp?target=MFC%7CMultiple%7Cview

-- 

Hank Williams
Quantum Technologies, Inc.
HaWilliams(at)spamcop.net
"Kristian Jones" <kjones16muk@hotmail.com> wrote in message
news:Jc9gc.58$tq5.50@newsfe1-win...
> Does anyone know how to switch between 3 views in the same window in a mfc
> application.
>
> I  have 3 menu functions, OnSalesChart, OnSalesTable, OnCategoryChart. the
> sales chart is the default view.
>
> I'm doing a variation of the code extract listed, which works but only if
i
> swap between one to the other and then back again before switching to
> another view.
>
> I think the problem lies with
>     m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
>     m_pCategoryView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
> and how im processing them.
>
> Could anyone help, if you need to email me, remove the obvious
>
>
> void CChildFrame::OnDataListView()
> {
> if(m_pDataList == 0)     //Creating the datalist view
>  {
>   if(flag = 1 )
>    m_pAssignmentView = (CAssignmentView*)GetActiveView();  //Cast and get
> the active view
>   else if(flag=3)
>    m_pCategoryView = (CCategoryView*)GetActiveView();
>
>   m_pDataList = new CDataList();        //create the new view
>
>
m_pDataList->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,rectDefault,this,AFX_IDW_P
> ANE_FIRST+1); //initialise it
>  }
>  pDoc->AddView(m_pDataList);
>
>  if(flag = 1)
>  {
>   m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
>   m_pAssignmentView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
>   m_pDataList->ShowWindow(SW_SHOW);
>   m_pAssignmentView->ShowWindow(SW_HIDE); //hide the old view
>   SetActiveView(m_pDataList);    //set the active view to the datalist
>   pDoc->RemoveView(m_pAssignmentView); //remove the graph view
>  }
>  else if(flag =3)
>  {
>   m_pDataList->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
>   m_pCategoryView->SetDlgCtrlID(AFX_IDW_PANE_FIRST+1);
>   m_pDataList->ShowWindow(SW_SHOW);
>   m_pCategoryView->ShowWindow(SW_HIDE); //hide the old view
>   SetActiveView(m_pDataList);    //set the active view to the datalist
>   pDoc->RemoveView(m_pCategoryView); //remove the graph view
>  }
>  m_pDataList->OnInitialUpdate();   //call this method so that it displays
> the datalist
>  RecalcLayout();
>  flag = 2;
> }
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004
>
>


0
Hank
4/18/2004 4:04:42 PM
Reply:

Similar Artilces:

Custom format #3
To format a custom format for credit cards I tried 0000-0000-0000-0000 and it looks good like it should work. Somehow the last digit changes to 0 no matter what number I put in. Yes have tried it several times, on sheet the church sent me and again trying it on Excel 2003. Weird problem always ends in 0 ?? On Mon, 25 May 2009 12:56:59 -0400, "John McCabe" <jlmccabes@cfl.rr.com> wrote: >To format a custom format for credit cards I tried > 0000-0000-0000-0000 and it looks good like it should work. >Somehow the last digit changes to 0 no...

Individual default views
Is it possible for each user to set different default views? For example, we have a couple of users who work with records owned by another person, and it would be much more efficient for them if they could default to a view that showed all of this other person's records. On a similar line, is it possible to set saved views as a default view? As far as I know, it is not possible to have multiple default view. You can have only one default view per entity. You can have saved Advance find views and share among the users, but users have to select to see the view. The other option is to hav...

3 leaflets in landscape on an A4 page. Any suggestions?
Microsoft has wonderful templates. Love them. Can't find a leaflet back and front which is on an A4 page which requires only 2 slices to make it in to 3 leflets. Max usage of paper, minimum cost and minimum environmental cost. Start with something close and modify it. Or remember that not everything needs to be started with a template. Creativity goes a long way. -- JoAnn Paules MVP Microsoft [Publisher] "Rosemarie" <Rosemarie@discussions.microsoft.com> wrote in message news:777EFC05-28DA-45A1-A6FA-687400391573@microsoft.com... > Microsoft has wonderful...

WU hangs on 3 of 3
Fresh SBS 2008 install, installed SP2 afterwards, reboot all ok, then executed windows update with all criticals, it downloads and installs succesfully. After reboot it starts windows with "configuring updates x of 3, don't turn off your computer" and the server hangs there on the "3 out of 3" on 0%, there's no lan or disk activity at all and the progress circle just keeps running. This already happened yesterday with a canceled WU(before installing SP2) and we had to format and reinstall thanks to this problem because safe mode worked but after th...

mail delivery #3
i just install new echange 2003 ent. to existing 2000 ad where is exchange 2000 standard. In my test enviroment all mail delivery succees in new server, but when i do exactly same in production, those one's which are in exchange 2003 they can't get any mails from "old server" or outside our corporate. They can send mail to users which mailboxes are inside our corporate, and they received mails from new servers. ...

Windows Sharepoint Services 3.0 Migration.
Hello, I am in a bit of trouble here and need some help. We have a Windows 2003 Standard server (X86) running SQL 2005 and SharePoint Services 3.0. We need to migrate the SharePoint Services 3.0 to a Windows 2008 R2 server running SQL 2005 X64. The server name will be different than the original server. Since we have the server name, the operating system version and the processor architecture changing I am looking for clear instructions on how to migrate the SharePoint Application. I read a lot websites including this one here http://technet.microsoft.com/en-us/library/cc5...

MDI: Open file in existing child frame
I have an MDI application that I would like to modify the File -> Open function. Right now after File -> Open is called, a new child frame is created with the selected document displayed. I do not want File -> Open to create a new child frame, I would like to be able to have File -> Open use the existing child frame. Can anyone provide me with information on how to achieve this? Do I need to overload the CDocument::OnOpenDocument function or is there a simpler way? Thanks. No, essentially this is impossible within the default framework. The reason is that the default ID_FI...

Duplicate look_up values in VLOOKUP #3
Hi all, I've got a VLOOKUP formula functioning in the usual way. However, sometimes the look_up value is duplicated. When this occurs VLOOKUP always returns the first instance of the entry. Is there a means to get Excel to ignore entries it has already returned an entry for? The VLOOKUP is part of a bigger formula, being: =IF(AND('Dependency Log'!$A2=Matrix!$B3, 'Dependency Log'!$E2=Matrix!D$2),(VLOOKUP($B3,look_up,2,FALSE) ),"") Any ideas? TIA, SamuelT -- SamuelT ------------------------------------------------------------------------ SamuelT's Prof...

math #3
How do I get the average of a group of years. Like 1999, 1998, 2000, etc. I think you need to provide much more detail to get a useful reply. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Bill" <Bill@discussions.microsoft.com> wrote in message news:044868EC-8884-4E40-9F93-EE9C5EFABCFA@microsoft.com... > How do I get the average of a group of years. Like 1999, 1998, > 2000, etc. maybe something like =AVERAGE(ROW(INDIRECT("1998:2005"))) as an array formula, so commit with Ctrl-Shift-Enter -- ...

View only calendar access...
We have a third-party scheduling events for us. They need be able to see our schedules WITHOUT DETAIL (Just time blocked as busy or not busy). The 3rd party only needs to view, not make any updates. We use Exchange Server whereas the 3rd does not have access to the Exchange Server. Is there a way or tool that we can use to give them this limited view capability? What version of Exchange? The best you can do is free/busy time. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.sli...

Upgrade #3
Hi Folks; If I am running MS Office 2000 on my XP Home Edition box can I upgrade just the Outlook portion of Office to Outlook 2003 or Outlook XP ????????????????? TIA Later, Malcolm On Sat, 19 Nov 2005 07:38:57 GMT, Malcolm <malcolm34465@yahoo.com> wrote: > >If I am running MS Office 2000 on my XP Home Edition box can I upgrade >just the Outlook portion of Office to Outlook 2003 or Outlook XP >????????????????? > Sure. Just know that you will not be able to use Word as your message editor in Outlook and you will not be able to use Word in a mail merge. -- <<&...

Visio 2003
Hi all. I've been banging my head against the wall here, and would certainly appreciate a hand. I'm working on a reasonably-sized org chart of 400 companies using the Org Chart US Units template & stencil. The source is an Excel sheet with a combination of entered text, numbers, and formulas. Some of the columns are used to modify the appearance of the shape instance, for example, if the parent company is A, then the outline is regular black. But if it's B, then the outline is blue. Or if another value is C, then the shape is a regular rectangle, but if it's D, the co...

CCheckListBox #3
Dear Charles As you suggested to my question posted in ADO.Net news group I added the implimentation of the Create() function of CCheckListBox class. but it is still giving following error: error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CMyCheckListBox::GetRuntimeClass(void)const " (?GetRuntimeClass@CMyCheckListBox@@UBEPAUCRuntimeClass@@XZ) Thanks Manjree "Manjree Garg" <garg@newsgroup.nospam> ha scritto nel messaggio news:F59BE84D-88CA-4994-8F1F-D6888AD8D45E@microsoft.com... > As you suggested to my qu...

more than 3 conditional formating in excel
Hi I am new to conditional formating in Excel. In row 2 I need to enter nos. between 1-5. I want each color to have a particular color. I have managed to do 4 (3 with conditional formating and the 4th retaining the default color). Is there a way i can do all 5 colors? Thanks You need to use VBA. Try this:- Private Sub Worksheet_Calculate() 'Code must be placed in the codemodule of the actual sheet you are working with. Dim oCell As Range For Each oCell In Range("A1:A20") Select Case oCell.Value Case Is < 1 oCell.Interior.Colo...

OWA #3
Hi , we have the following setup and would like advice as to what others are doing. Internet-->Router->Cisco Pix-->(Internal Network->Exchange Srv) We would like to publish our Outlook Web Access the most secure way possible. We do not want to put a Windows 2k box in the DMZ or outside or Network to use as a front end server. Could we do the following: Internet-->Router->Cisco Pix with port 443 mapped to FrontEndSrv->(Internal Network->FrontEndSrv Exchange with tight security providing OWA for Internal Exchange server)...and of course ssl cert on the Exch box....

Event id 1000 #3
Hello, I have office xp installed on pc with profing tools and sometimes when using outlook reply message, crash and open word with recouvering document. the error on event viewer is event id 1000 source microsoft office 10 . Please can help me! Thanks in advance. ...

Macro Help #3
I turn to you guru's for help with a macro question. I have to worksheets in my workbook. Both have a coulmn that has a 6 digit number in each cell (an invoice number) What I need to do is have a macro that starts with the first invoice # in sheet 1, searches for it in sheet 2. If it finds it, delete that row from Sheet 2. Then it will look at the 2nd invoice number on sheet 1, Search from it in Sheet 2 If it finds it, delete that row from Sheet 2. etc, etc, etc so, my question to you is..... How? Modify this to suit. Sub Deletematches() On Error Resume Next For Each cel In [c14:...

Integration with the list view
Hi, I have an ASP page that performs some processing on a Case record when called from a detail form toolbar button. I am using the PassParams attribute within the ISV.config to send the Case GUID to my ASP page. This works really well, however, my problem is that I also need to be able to perform this process on a group of cases selected in the list view by ticking the record (as with assigning/deleting multiple records etc.). Is this possible? I have not yet found a way of adding buttons to the list view, adding entries to the Actions list or passing multiple GUID's as a parameter to a...

Disclaimer #3
Hi We run Win2003, Exchange2003 and I would like to add a disclaimer on all outgoing emails. Is there an other way then buying a Add-on tool? If not what is good tool? Thanks Roman Sure. You can take a look at this: http://support.microsoft.com/default.aspx?scid=kb;EN-US;317680 or this http://support.microsoft.com/default.aspx?scid=kb;EN-US;317327 -- Martin Blackstone MVP - Exchange http://www.swinc.com/resource/exchange.htm http://www.swinc.com/resource/e2kfaq_appxc.htm "Roman" <roman@schwabbrothers.com> wrote in message news:OUj1pkBoEHA.4008@TK2MSFTNGP14.phx.gbl....

how do i make 1/3 look like a fraction
i can get 1/4 and 1/2 to look like a fraction but the rest (1/3 1/8 1/16) don't happen There are a couple of possibilities - see: http://www.gmayor.com/createfraction.htm or http://www.word.mvps.org/FAQs/Formatting/CreateFraction.htm -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<...

Resource booking #3
Hi everyone, I can't book an resorce , it always says that it is recurring and I can't change recurrence. Thanx in advance. And is the meeting you are organizing a recurring meeting? A bit more details would be nice here, such as how you have set up the resource mailboxes, what version of Exchange, and so forth. -- Ben Winzenz Exchange MVP MessageOne Read my blog! http://winzenz.blogspot.com http://feeds.feedburner.com/winzenz (RSS Feed) "Peter" <Peter@discussions.microsoft.com> wrote in message news:03C60C8B-8E7E-4A6A-9E68-1EC160315027@microsoft.com... > H...

Free Busy information #3
Free busy information for Exchange 5.5 not visible in Exchange 2003 in mix mode. Exchanhe 2003 free busy information not visible in different admin groups either. Why is this happening?? You need to configure the free/busy folder to replicate to the different admin groups. For more information and some topology descriptions, see "Working with the Exchange Server 2003 Store" (http://go.microsoft.com/fwlink/?LinkId=33049). Chapter 6 deals with free/busy. -- Teresa Appelgate Exchange User Education ****** Disclaimers ****** This posting is provided "AS IS" with no warran...

CRM 3.0 Installation Issue 02-01-06
I have tried installing CRM 3.0 3 times on a Windows 2K server, IIS 5, .NET 1.1, SQL Server 2K w/SP 4, with all updates and patches. Everytime I install it ends with the same error. When I attempt to loogin into the admin page I get : Authentication Error Microsoft CRM could not log you on to the system. Make sure your user record is enabled and that you have been assigned at least one security role. For more information, contact your system administrator. I am not sure where to go with this now. Can anybody help? ...

Rounding Off #3
$248,071 $260,290 $261,640 $106,316 $111,553 $112,131 $0 $0 $0 $354,387 $371,843 $373,771 I need to enter all of the above numbers into a form that looks like this: xx 0,000 So, I have to enter the first two didgits. I need to round off the rest. The first row would be: $250,000 $260,000 $260,000 How would I construct a formula to do that? Thanks If you enter the 2 digits in A1:Axxx, put this formula in B1 =A1*10000 and drag the formula down through Bxxx. Then format the cells as currency with 0 places of decimal. If you enter the...

Process map about CRM 3.0
Hello! I'm looking for the process map about CRM. I need it to know the entities which I have to use. Very thanks for your help. ...