Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - [solved] tooltip on CNavigateButtonActiveFiles
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[solved] tooltip on CNavigateButtonActiveFiles

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: [solved] tooltip on CNavigateButtonActiveFiles
    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?
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 891
Post Options Post Options   Thanks (1) Thanks(1)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2017 at 6:39am
Hello rdhd,

Your improvement was implemented. Thank you for clear description.

Regards,
 Oleksandr Lebed
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.