![]() |
Toolbar protocol isn’t implemented |
Post Reply
|
| Author | ||
Chilly32
Newbie
Joined: 03 July 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: Toolbar protocol isn’t implementedPosted: 03 July 2005 at 12:21pm |
|
|
G’Day, I have a question about tooltips support in your library. Before we bought your library, we were using a tooltips component from www.tooltips.net, which provided very colourful and descriptive tooltips. We used it via Command ID-s for menus commands and toolbar commands. That tooltip component supported both standard menu and toolbar classes and custom ones, I could call AddToolbarClass or AddMenuClass to recognize derived objects correctly. Now as I added XTP menus and toolbars – it all stopped working. It seems that not only you override toolbars and menus with your own classes, but you also do not implement corresponding protocols. For instance, all toolbar classes are supposed to implement such messages as TB_HITTEST and TB_GETBUTTON (see in MSDN). Code example: LPPOINT pt; int iButtonIndex = ::SendMessage(hToolbarWnd, TB_HITTEST, 0, (long)pt); TBBUTTON info; ::SendMessage(hToolbarWnd, TB_GETBUTTON, iButtonIndex, (long)&info); Now, that code doesn’t work for your toolbars at all, and hence we cannot see any tooltips for that matter. And since your library doesn’t offer anything like those tooltips, please advice us how we should get around this problem. Thank you, Edited by Chilly32 |
||
![]() |
||
Chilly32
Newbie
Joined: 03 July 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 July 2005 at 4:39am |
|
|
To put it simply, your toolbars must implement TB_HITTEST and TB_GETBUTTON, or they become unusable for other components, i.e. cannot be recognized as toolbars, and hence cannot be integrated with other software bits. And if your menus are also toolbars - them too. I think you must implement those, which shouldn't be a big deal for you, but would make a world of difference for us, as we are stuck now with this issue: too much effort has been put in documenting our software via those tooltips, and now they don't work.
Edited by Chilly32 |
||
![]() |
||
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 July 2005 at 1:44am |
|
|
2005-07-06_014247_VXPMenus.zip See attched sample how to use CommandBars and Tooltips |
||
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
![]() |
||
Chilly32
Newbie
Joined: 03 July 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 July 2005 at 5:27am |
|
|
Thank you Oleg, Before you published this example I got some reply from your tech support guys just suggesting to derive and implement my own CXTPToolbar class. So I did that yesterday, and actually managed to make it work for toolbar buttons. But when I tried the same for menu items – just didn’t work. Mistakenly, I derived from CXTPMenuBar instead of CXTPPopupBar. Your code example clarified all that, thank you. And since I had already my own class written for toolbars that worked, I simply applied the same for CXTPPopupBar – and oh miracle!!! I now can see tooltips for menu items, now that’s some hi-tech stuff J And it looks just amazing!!! Those VXPLib tooltips in combination with XTP library is kick-ass!!! I’m sending you a screenshot of what I got:
And for the menu items:
Now I would like to share the code I used for toolbars and menus, and which worked nicely for me:
class { DECLARE_XTP_COMMANDBAR(CXTPToolBarEx) public CXTPToolBarEx(); protected afx_msg LRESULT OnHitTest(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnButtonCount(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnGetButton(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnGetButtonInfo(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() }; class { DECLARE_XTP_COMMANDBAR(CXTPPopupBarEx) public CXTPPopupBarEx(); protected afx_msg LRESULT OnHitTest(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnButtonCount(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnGetButton(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnGetButtonInfo(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() };
// CXTPToolBarEx IMPLEMENT_XTP_COMMANDBAR(CXTPToolBarEx, CXTPToolBar) CXTPToolBarEx::CXTPToolBarEx() { } CXTPToolBarEx::~CXTPToolBarEx() { } int { iState |= pControl->GetChecked()?TBSTATE_CHECKED:0; iState |= (pControl->GetHideFlags()&xtpNoHide)?0:TBSTATE_HIDDEN ; iState |= pControl->GetPressed()?TBSTATE_PRESSED:0; iState |= pControl->GetWrap()?TBSTATE_WRAP:0; } BEGIN_MESSAGE_MAP(CXTPToolBarEx, CXTPToolBar) ON_MESSAGE(TB_HITTEST, OnHitTest) ON_MESSAGE(TB_BUTTONCOUNT, OnButtonCount) ON_MESSAGE(TB_GETBUTTON, OnGetButton) ON_MESSAGE(TB_GETBUTTONINFO, OnGetButtonInfo) END_MESSAGE_MAP() // CXTPToolBarEx message handlers LRESULT CXTPToolBarEx::OnHitTest(WPARAM wParam, LPARAM lParam) { LPPOINT lpPoint = (LPPOINT)lParam; CXTPControl * pControl = GetControls()->HitTest(CPoint(lpPoint->x, lpPoint->y)); } LRESULT CXTPToolBarEx::OnButtonCount(WPARAM wParam, LPARAM lParam) { } LRESULT CXTPToolBarEx::OnGetButton(WPARAM wParam, LPARAM lParam) { LPTBBUTTON lpButton = (LPTBBUTTON)lParam; CXTPControl * pControl = GetControls()->GetAt(( lpButton->iBitmap = pControl->GetIndex(); lpButton->idCommand = pControl->GetID(); lpButton->fsState = GetControlState(pControl); lpButton->dwData = pControl->GetTag(); lpButton->iString = (INT_PTR)(LPCTSTR)pControl->GetCaption(); lpButton->fsStyle = 0; } LRESULT CXTPToolBarEx::OnGetButtonInfo(WPARAM wParam, LPARAM lParam) { LPTBBUTTONINFO lpInfo = (LPTBBUTTONINFO)lParam; CXTPControl * pControl = GetControls()->FindControl(xtpControlButton, ( lpInfo->fsState = GetControlState(pControl); } //////////////////////////////////////////////////////////// / // CXTPPopupBarEx IMPLEMENT_XTP_COMMANDBAR(CXTPPopupBarEx, CXTPPopupBar) CXTPPopupBarEx::CXTPPopupBarEx() { } CXTPPopupBarEx::~CXTPPopupBarEx() { } int { iState |= pControl->GetChecked()?TBSTATE_CHECKED:0; iState |= (pControl->GetHideFlags()&xtpNoHide)?0:TBSTATE_HIDDEN ; iState |= pControl->GetPressed()?TBSTATE_PRESSED:0; iState |= pControl->GetWrap()?TBSTATE_WRAP:0; } BEGIN_MESSAGE_MAP(CXTPPopupBarEx, CXTPPopupBar) ON_MESSAGE(TB_HITTEST, OnHitTest) ON_MESSAGE(TB_BUTTONCOUNT, OnButtonCount) ON_MESSAGE(TB_GETBUTTON, OnGetButton) ON_MESSAGE(TB_GETBUTTONINFO, OnGetButtonInfo) END_MESSAGE_MAP() // CXTPPopupBarEx message handlers LRESULT CXTPPopupBarEx::OnHitTest(WPARAM wParam, LPARAM lParam) { LPPOINT lpPoint = (LPPOINT)lParam; CXTPControl * pControl = GetControls()->HitTest(CPoint(lpPoint->x, lpPoint->y)); } LRESULT CXTPPopupBarEx::OnButtonCount(WPARAM wParam, LPARAM lParam) { } LRESULT CXTPPopupBarEx::OnGetButton(WPARAM wParam, LPARAM lParam) { LPTBBUTTON lpButton = (LPTBBUTTON)lParam; CXTPControl * pControl = GetControls()->GetAt(( lpButton->iBitmap = pControl->GetIndex(); lpButton->idCommand = pControl->GetID(); lpButton->fsState = GetControlState(pControl); lpButton->dwData = pControl->GetTag(); lpButton->iString = (INT_PTR)(LPCTSTR)pControl->GetCaption(); lpButton->fsStyle = 0; } LRESULT CXTPPopupBarEx::OnGetButtonInfo(WPARAM wParam, LPARAM lParam) { LPTBBUTTONINFO lpInfo = (LPTBBUTTONINFO)lParam; CXTPControl * pControl = GetControls()->FindControl(xtpControlButton, ( lpInfo->fsState = GetControlState(pControl); }
|
||
![]() |
||
Chilly32
Newbie
Joined: 03 July 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 July 2005 at 5:40am |
|
|
Oleg, I have a related question for you… You showed the following code to switch off the standard tooltips on start up: pCommandBars->GetCommandBarsOptions()->bToolBarScreenT ips = FALSE; This, however, doesn’t prevent the user from going into “Customize”, tab “Options” and switch the tooltips ON again. Is there any way to override that behavour? For instance, disable that tooltip option, or override the event of switching that option so that I can switch ON/OFF my own tooltips, and not the standard tooltips? Regards, Vitaly Tomilov Edited by Chilly32 |
||
![]() |
||
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 July 2005 at 11:45pm |
|
|
Hi, glad you find solution for tooltips :) I think in CMainFrame::OnCustomize before you call DoModal you can set pCommandBars->GetCommandBarsOptions()->bToolBarScreenT ips = m_bToolBarScreenTips;
and after DoModal
m_bToolBarScreenTips = pCommandBars->GetCommandBarsOptions()->bToolBarScreenT ips; pCommandBars->GetCommandBarsOptions()->bToolBarScreenT ips; = FALSE; UpdateToolTips(); |
||
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
![]() |
||
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 |