Print Page | Close Window

No tooltip for context menus. Why?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=16706
Printed Date: 17 June 2024 at 6:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: No tooltip for context menus. Why?
Posted By: znakeeye
Subject: No tooltip for context menus. Why?
Date Posted: 13 May 2010 at 1:46pm
I've tried enabling tooltips for context menus. Can't get it working (and I suspect it's not supported).
 
pCommandBars->GetCommandBarsOptions()->bShowPopupBarToolTips = TRUE;
Only works for ribbon menus... :(
 
Not affected:
CXTPCommandBars::TrackPopupMenu(pPopupBar, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pos.x, pos.y, pWnd, NULL, 0);
 


-------------
PokerMemento - http://www.pokermemento.com/



Replies:
Posted By: znakeeye
Date Posted: 05 July 2010 at 5:00pm
No?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: jimmy
Date Posted: 06 July 2010 at 5:55am
Hi,
how do you create pPopupBar ?
with
  CXTPPopupBar* pPopupBar = CXTPPopupBar::CreatePopupBar(((CXTPMDIFrameWnd*)AfxGetMainWnd())->GetCommandBars());
or with ...(NULL).

 Jimmy




Posted By: rdhd
Date Posted: 12 July 2010 at 4:22pm
I get my tips by doing this:
 
pOptions->bShowPopupBarToolTips = TRUE;

Not sure what the default is. I am creating my own CCommandBars object when I do that. Since I have not had a complaint when I use the frame's CComandBars object, I assume TRUE is the default.


Posted By: znakeeye
Date Posted: 16 July 2010 at 5:45pm
Since I haven't seen such tooltips in CJ's samples, I assume it's not supported. I did dig through the source code, and I couldn't find anything that would yield the desired behavior.
 
When I'm talking about context menus, I mean right-click menus. bShowPopupBarToolTips does not affect those menus, which is why I created the post.


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: jimmy
Date Posted: 27 July 2010 at 3:37pm
Hi,

Look into ToolTipContext sample.
here it work.

  Jimmy


Posted By: rdhd
Date Posted: 28 July 2010 at 9:30am
But Zan that is what I do for my right-click context menus. We have our own TrackPopupMenu on our frame that takes in a CMenu. If the frame is the tracking window, I get the command bars object from the frame and obtain the command bar options (to set bShowContextMenuAccelerators to TRUE) and also so I can pass in the TPM_RETURNCMD flag since CJ context menus call SendMessage instead of PostMessage (Send versus Post causes us all sorts of problems).
 
If the frame is not the tracking window (we have params to tell us that) I create a new CXTPCommandBars object and set the site to the tracking window. I set up a theme and then give the new cbars an image manager (to avoid CJ going to the frames image manager). I get the tooltip context from the cbars object I created and initialize it to our specifications. Finally I get the options and if an input flag indicates tips are wanted, I get the options from the cbars object I created and set bShowPopupBarToolTips to TRUE.
 
We also have an app setting that allows the user to turn off all tipping. If that flag is set, I ignore the caller's flag and honor the global setting and bShowPopupBarToolTips is set to FALSE.
 
This works for me. All our shortcut/context/right-click menu invokation calls now go through my frame's method and I either get tooltips on the shortcut menur or don't get them based on my call to set the option. Here is the code I go thru when I detect the caller does NOT want the frame to track the menu. In such cases it is up to the caller to provide the tip strings and images by handling WM_XTP_INITCOMMANDSPOPUP if the menu contains "command" IDs that are not known to our frame window.
 

CRuntimeClass* pCommandBarsClass = RUNTIME_CLASS(CXTPCommandBars);

CXTPCommandBars* pCommandBars = (CXTPCommandBars*) pCommandBarsClass->CreateObject();

ASSERT(pCommandBars);

if (!pCommandBars)

return FALSE;

...
 

pCommandBars->SetTheme(xtpThemeRibbon);

 

if( (Options & JSetSiteToMenuOwner) && pWnd && pWnd->GetSafeHwnd() )

{

// variable table flashes too much if site is set to its frame so we

// added the new option to force the site to the tracking/owner window.

// The var table can leave a bit of "trash" on the bottom edge if the

// user right-clicks a lot and fast and we decided that is better than

// the excessive flashing due to the var table updating.

pCommandBars->SetSite(pWnd);

}

else if( pWnd )

{

CFrameWnd* pFrame = pWnd->GetParentFrame();

if( pFrame != this )

{

if( pFrame )

{

pCommandBars->SetSite(pFrame);

}

else

{

// out of options. Dennis said the hyperlink command in draft has no parent frame and that causes an exception.

pCommandBars->SetSite(this);

}

}

else

{

//pCommandBars->SetSite(pWnd);

pCommandBars->SetSite(this);

}

}

else

{

// out of options. Dennis said the hyperlink command in draft has no parent frame and that causes an exception.

pCommandBars->SetSite(this);

}

pCommandBars->SetImageManager(new CXTPImageManager()); // Keeps icons from appearing due to usage of the frames command bars image manager
 

// Implement a message handler for the CodeJock WM_XTP_INITCOMMANDSPOPUP notification in ComamndBars.

// See \Samples\CommandBars\Notifications for an example. Or see x:\dsl\src\dcx\dimcmd\dev\skdimrib.cpp for

// and example that gets the notification and then calls skmoddim.cpp where icons, tooltips and descriptions are added.

// To display the prompts listen to WM_SETMESSAGESTRING and then call SetPrompt(). Again, see the skmoddim.cpp

// and skdimrib.cpp file for an example. And no, CodeJock does not seem to use the description when setting the

// prompt. And if the ID of the control is not part of the current resource module chain, CodeJock will call send

// the WM_SETMESSAGESTRING with the lparam set to some string saying something like "the description for cmd xxx is

// not available".

CXTPToolTipContext* pTipContext = pCommandBars->GetToolTipContext();

if( pTipContext )

{

InitializeToolTipContext( pTipContext );

}

CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions();

if( pOptions )

{

pOptions->bDisableCommandIfNoHandler = Options & JDisableCommandIfNoHandler ? TRUE:FALSE;

if( GetDisplayTooltips() )

{

pOptions->bShowPopupBarToolTips = Options & JShowToolTips ? TRUE:FALSE;

}

else

{

// Frame rules supreme.

pOptions->bShowPopupBarToolTips = FALSE;

}

pOptions->bShowContextMenuAccelerators = TRUE;

}

bSelected = pCommandBars->TrackPopupMenuEx(pMenu, nFlags, xPos, yPos, pWnd, lptpm);

pCommandBars->InternalRelease();// delete the object

You may not be getting tips if your site is not your frame and the window that is the site does not implement tipping in the standard way and does not respond to WM_XTP_INITCOMMANDSPOPUP.



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