Print Page | Close Window

[solved] tooltip on CNavigateButtonActiveFiles

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=23455
Printed Date: 28 April 2024 at 5:47pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] tooltip on CNavigateButtonActiveFiles
Posted By: rdhd
Subject: [solved] tooltip on CNavigateButtonActiveFiles
Date Posted: 28 September 2017 at 6:12pm
I set the xtpWorkspaceShowActiveFiles flag on the CXTPTabClientWnd object in our application. When I click the drop arrow and CXTPTabClientWnd::CNavigateButtonActiveFiles::PerformClick is called, a popup control is populated with controls. The control IDs are 1, 2, 3 ...

CodeJock is loading string resources from its own resource file when it calls CXTPControl::SetID. So, for instance, the tooltip text becomes "MS Sans Serif1" for the first entry in the dropdown. After setting the icon id, the caption for the tab item is set on the control.

But if tooltips are enabled, when one hovers over a control on the popup, the OnToolHit test code ends up returning "MS Sans Serif1" as the tooltip text.

I would like a way to set the full path of the file the control is representing. At the very least, the tooltip text should not be "random" entries from the toolkitpro resource file.

I do handle WM_XTP_INITCOMMANDSPOPUP and the frame gets that message. But the popup bar is a generic bar. So is its command bar member. Basically, I see nothing that gives me a clue that this bar can be treated special.

My current option is to constantly scan every control when the above message is sent and compare the caption to all open filenames and then set the tooltip text to be the full path to the document. But that doesn't seem very robust.

Is there an alternative I'm missing?



Replies:
Posted By: rdhd
Date Posted: 29 September 2017 at 11:26am
So I have examined the CJ code some more to see why the tooltips on the navigate button active files popup menu doesn't match the tooltips on the MDI tab items.

CXTPTabManager::PerformToolHitTest finds the CXTPTabManagerItem by calling HitTest. If an item is returned, the tooltip is obtained via a call to a virtual method, GetItemTooltip(pItem); That allows our application to return a full path to the document or a document formula when we are dealing with a PDM system such as Sharepoint, SAP, Teamcenter, ... etc., etc.

Meanwhile, when populating the controls for the popup menu that displays when the active files button on the workspace is clicked, CXTPTabManager::PerformClick is called and it calls CXTPTabClientWnd::CNavigateButtonActiveFiles::PerformClick.

CXTPTabClientWnd::CNavigateButtonActiveFiles has a direct link to the same tab manager instance via a m_pManager member. It gets each tab item and gets the caption from the item and sets the caption. But even though it has the item it got from the tab manager, it doesn't call GetItemTooltip(pItem).

Why not? Life would be so much easier if it did.

Can CJ kindly consider adding this code to CXTPTabClientWnd::CNavigateButtonActiveFiles::PerformClick?


CString strTip = m_pManager->GetItemTooltip( pItem );
pControl->SetTooltip( strTip );


It could be added after this line:

pControl->SetDescriptionText(_T(""));

That way, the tool tip displayed when hovering over one of the MDI tabs would be the same tool tip one would see when hovering over the corresponding control on the active files popup instead of the now currently "random" tooltip found by walking the resource chain looking for the first resource module that as a string with ID 1, 2, 3 ... N where N is the number of controls on the popup menu being created.


Posted By: olebed
Date Posted: 30 September 2017 at 6:39am
Hello rdhd,

Your improvement was implemented. Thank you for clear description.

Regards,
 Oleksandr Lebed



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