![]() |
Managing Panes |
Post Reply ![]() |
Author | |
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() Posted: 18 December 2005 at 1:43pm |
I am currently using the Shortcut bar and I am confused on how to update the panes when there is a selection made. I want to click on of the buttons such as Accounts, Contacts, New Leads, etc. and update the view on one of the right panel. Thank you in advance for helping me out. If you need to know more information please do not hesiate to contact me and ask me. Thank you developer community!!!!! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, If you use CXTSplitterWnd, you can call CXTSplitterWnd::ReplaceView(int nRow, int nCol, CView* pNewView) CXTSplitterWnd::ReplaceView(int nRow, int nCol, CRuntimeClass* pViewClass) recommend to find sources of this methods and learn how they work.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Oleg, thank you for your help. I am able to get the toolbar to work without any problems and have the right pane views update correctly. However I can't get the shortcut bar to work. I am still having some difficulty having the the right pane view updated when clicking on the left hand side. I have been trying to get this done all day today and seem to be getting nowhere. I uploaded the files for review. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, In CMainFrame::OnShortcutBarNotify add
case XTP_SBN_SELECTION_CHANGED: m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS (CSearchAccounts1)); return TRUE; |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Great! I'll give that shot! Just curious will that give me a differnet view for every shortcut I click on or will it be the same view for all buttons? Thanks Oleg for helping out!
|
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Oleg, Thanks again for you help. I tried doing what you asked me to do and I am getting a debug assertion error. any ideas?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, I can't debug it, because you only attached cpp file. Show call stack or attach whole project. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Oleg, I have attached the entire source files. I don't know if this will help you at all but if the case is left empty the program compiles and runs fine. When I add the ReplaceView Command inside the case that is when I get the Assert Debug error. Another question I have is how would the views change on each shortcut bar click? i think we have it set now to only show the one view. Thanks for all your help! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, Here code you need: case XTP_SBN_SELECTION_CHANGED: { if (m_wndSplitter2.GetSafeHwnd()){ switch (((CXTPShortcutBarItem*)lParam)->GetID()){ case ID_SHORTCUT_ACCOUNTS:m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS(CSearchAccounts1)); break; case ID_SHORTCUT_SALES:m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS(CSearchAccounts)); break; case ID_SHORTCUT_MARKETING:m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS(CAccountsView)); break;} } return TRUE;
} |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Oleg your are the man. You got the outside buttons to work. However I'm still looking to the get the inside buttons to work. Like the accoutns, contacts, new leads, etc buttons, which is within the accounts pane. Here are the id's for the buttons IDI_accounts_Accounts Thank you.....your are such a great help to this community. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Ok, here steps: 1. Add message map BEGIN_MESSAGE_MAP(CShortcutAccounts, CXTPShortcutBarPane) ON_NOTIFY(TVN_SELCHANGED, 100, OnSelChanged) END_MESSAGE_MAP() in header: DECLARE_MESSAGE_MAP() 2. Replace line VERIFY(m_wndTreeFavorites.Create(WS_VISIBLE|TVS_HASBUTTONS|T VS_LINESATROOT|TVS_SHOWSELALWAYS, CXTPEmptyRect(), this, 100));
3. Add handler
void CShortcutAccounts::OnSelChanged(NMHDR* phrd, LRESULT*){ LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)phrd; int nImage, nSelectedImage;m_wndTreeFavorites.GetItemImage(pnmtv->itemNew.hItem, nImage, nSelectedImage); switch (nImage){ case IDI_accounts_Accounts: break;} } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Here is the error i can't get rid of ShortcutAccounts.cpp c:\Documents and Settings\amatesic\My Documents\Visual Studio Projects\falcon1\ShortcutAccounts.cpp(81) : error C2228: left of '.ReplaceView' must have class/struct/union type type is 'int' I have attached the new code for ShortcutAccounts.cpp
Thank you, |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, m_wndSplitter2 defined in CMainFrame not in CShortcutAccounts.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg, I defined it in the wrong place. I redefined in the begining of ShortcutAccounts.cpp and it compiles fine. However nothing happens when clicking on the button. Below is the source code for ShortcutAccounts.cpp. // ShortcutPaneMail.cpp : implementation file // #include "stdafx.h"#include "falcon1.h"#include "ShortcutAccounts.h"#include "SearchAccounts.h"#include "MainFrm.h"static CSplitterWndEx m_wndSplitter2;BEGIN_MESSAGE_MAP(CShortcutAccounts, CXTPShortcutBarPane) ON_NOTIFY(TVN_SELCHANGED, 100, OnSelChanged) END_MESSAGE_MAP()
static UINT treeIcons[] ={ IDI_accounts_Accounts ,IDI_accounts_Contacts, IDI_accounts_NewLeads, IDI_accounts_ToDos, IDI_accounts_PrintCompanies, IDI_accounts_PrintContacts }; CShortcutAccounts::CShortcutAccounts() { m_ilTreeIcons.Create(24, 24, ILC_MASK|ILC_COLOR32, 1, 1); for (int i = 0; i < _countof(treeIcons); i++){
HICON hIcon = AfxGetApp()->LoadIcon(treeIcons); ASSERT(hIcon); m_ilTreeIcons.Add (hIcon); } } CShortcutAccounts::~CShortcutAccounts() { } BOOL CShortcutAccounts::Create(LPCTSTR lpszCaption, CXTPShortcutBar* pParent) { if (!CXTPShortcutBarPane::Create(lpszCaption, pParent)) return FALSE; //VERIFY(m_wndTreeFavorites.Create(WS_VISIBLE|TVS_HASBUTTONS |TVS_LINESATROOT, CXTPEmptyRect(), this, 100));VERIFY(m_wndTreeFavorites.Create(WS_VISIBLE|TVS_HASBUTTONS|T VS_LINESATROOT|TVS_SHOWSELALWAYS, CXTPEmptyRect(), this, 100));m_wndTreeFavorites.SetImageList(&m_ilTreeIcons, TVSIL_NORMAL); m_wndTreeFavorites.InsertItem (_T("Accounts"), 0, 0); m_wndTreeFavorites.InsertItem (_T("Contacts"), 1, 1); m_wndTreeFavorites.InsertItem (_T("New Leads"), 2, 2); m_wndTreeFavorites.InsertItem (_T("To-Dos"), 3, 3); m_wndTreeFavorites.InsertItem (_T("Print Companies"), 4, 4); m_wndTreeFavorites.InsertItem (_T("Print Contacts"), 5, 5);
AddItem(_T("Account Information"), &m_wndTreeFavorites, 115); return TRUE; } void CShortcutAccounts::OnSelChanged(NMHDR* phrd, LRESULT*){ LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)phrd; int nImage, nSelectedImage; m_wndTreeFavorites.GetItemImage(pnmtv->itemNew.hItem, nImage, nSelectedImage); switch (nImage){ case IDI_accounts_Accounts:{ m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS(CSearchAccounts)); } break; case IDI_accounts_Contacts:{ m_wndSplitter2.ReplaceView(1, 0, RUNTIME_CLASS(CSearchAccounts)); } break;} } |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
???? now you have 2 variables called m_wndSplitter2. Remove it, ant use ((CMainFrame*)(AfxGetMainWnd()))->m_wndSplitter2.ReplaceV iew(1, 0, RUNTIME_CLASS(CSearchAccounts));
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
I removed what i supposed to remove and I added what you told me to do. Below is what the function looks like now. However, I get nothing in the right pane.
void CShortcutAccounts::OnSelChanged(NMHDR* phrd, LRESULT*){ LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)phrd; int nImage, nSelectedImage; m_wndTreeFavorites.GetItemImage(pnmtv->itemNew.hItem, nImage, nSelectedImage); switch (nImage){ case IDI_accounts_Accounts:((CMainFrame*)(AfxGetMainWnd()))->m_wndSplitter2.ReplaceV iew(1, 0, RUNTIME_CLASS(CSearchAccounts)); break;} Thank you in advance! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, Right... Instead IDI_accounts_Accounts use 0, 1, ... switch (nImage){ case 0:{ ((CMainFrame*)(AfxGetMainWnd()))->m_wndSplitter2.ReplaceV iew(1, 0, RUNTIME_CLASS(CSearchAccounts2)); } break; case 1:{ ((CMainFrame*)(AfxGetMainWnd()))->m_wndSplitter2.ReplaceV iew(1, 0, RUNTIME_CLASS(CSearchAccounts)); } break;} |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
almatesic ![]() Newbie ![]() ![]() Joined: 25 November 2005 Location: United States Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg....thank you so much helping me through this. Everything seems to be working out just fine. I was wondering what resorces are good to look into to learn and understand the language at your level? Thanks again! Al |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |