Print Page | Close Window

Managing Panes

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3422
Printed Date: 17 May 2024 at 10:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Managing Panes
Posted By: almatesic
Subject: Managing Panes
Date 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!!!!!




Replies:
Posted By: Oleg
Date Posted: 19 December 2005 at 1:03am

Hi,

If you use CXTSplitterWnd, you can call

CXTSplitterWnd::ReplaceView(int nRow, int nCol, CView* pNewView)
or

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


Posted By: almatesic
Date Posted: 19 December 2005 at 4:26pm

https://forum.codejock.com/uploads/almatesic/2005-12-19_162550_falcon1.rar - 2005-12-19_162550_falcon1.rar

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.  



Posted By: Oleg
Date Posted: 20 December 2005 at 12:22am

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


Posted By: almatesic
Date Posted: 20 December 2005 at 1:00am
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!


Posted By: almatesic
Date Posted: 20 December 2005 at 1:37am
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?


Posted By: Oleg
Date Posted: 20 December 2005 at 3:25am

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


Posted By: almatesic
Date Posted: 20 December 2005 at 12:15pm

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.

https://forum.codejock.com/uploads/almatesic/2005-12-20_121207_falcon1.rar - 2005-12-20_121207_falcon1.rar

Thanks for all your help!



Posted By: Oleg
Date Posted: 20 December 2005 at 1:44pm

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


Posted By: almatesic
Date Posted: 20 December 2005 at 1:58pm

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
IDI_accounts_Contacts
IDI_accounts_NewLeads

Thank you.....your are such a great help to this community.



Posted By: Oleg
Date Posted: 21 December 2005 at 12:28am

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


Posted By: almatesic
Date Posted: 21 December 2005 at 8:44am

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

https://forum.codejock.com/uploads/almatesic/2005-12-21_084355_falcon1.rar - 2005-12-21_084355_falcon1.rar

 

Thank you,



Posted By: Oleg
Date Posted: 21 December 2005 at 9:34am

Hello,

m_wndSplitter2 defined in CMainFrame not in CShortcutAccounts.

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: almatesic
Date Posted: 21 December 2005 at 10:30am

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;

}

}



Posted By: Oleg
Date Posted: 21 December 2005 at 12:53pm

????

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


Posted By: almatesic
Date Posted: 21 December 2005 at 1:56pm

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!



Posted By: Oleg
Date Posted: 22 December 2005 at 12:21am

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


Posted By: almatesic
Date Posted: 22 December 2005 at 5:29am

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 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net