Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - No tooltip for context menus. Why?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

No tooltip for context menus. Why?

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

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: No tooltip for context menus. Why?
    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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 05 July 2010 at 5:00pm
No?
PokerMemento - http://www.pokermemento.com/
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post 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


Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2010 at 3:37pm
Hi,

Look into ToolTipContext sample.
here it work.

  Jimmy
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
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.188 seconds.