CFrameWnd and CToolBar and tooltips. Should be simple but.. [modified]
-
I have now been strugling since several days, but I can't get my tooltips to show. I have a CFrameWnd that I dynamically create, which contains a CToolBar for which I want tooltips to show up. Here is what I have so far: CFrameWnd creation:
HINSTANCE aa=AfxGetInstanceHandle();
LPCTSTR theClass=AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_OWNDC|CS_DBLCLKS,0,0,LoadIcon(aa,MAKEINTRESOURCE(IDR_MY_ICON)));
MyCFrameWnd->Create(theClass,"MyAppName",WS_TABSTOP|WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS);CToolBar creation (in MyCFrameWnd):
EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM|CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
MyCToolBar=new CToolBar();
MyCToolBar->CreateEx(this,TBSTYLE_FLAT,WS_CHILD|WS_VISIBLE|CBRS_SIZE_DYNAMIC|CBRS_TOP|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|CBRS_TOOLTIPS);//|CBRS_FLYBY );
MyCToolBar->LoadToolBar(IDR_TOOLBAR);
MyCToolBar->SetWindowText("Navigation");
MyCToolBar->EnableDocking(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM);
MyCToolBar->SetButtons(toolbarStruct(containing command IDs),toolbarItemNb);
MyCToolBar->SetButtonStyle(MyCToolBar->CommandToIndex(TOOLBAR_CMD_1),TBBS_CHECKBOX);
... (similar for the other buttons as above line)
DockControlBar(CMyToolBar,AFX_IDW_DOCKBAR_TOP);Then for every toolbar image in the toolbar editor, I added the tooltip text under "Prompt" (in the properties view). e.g. "hello world\nhello world" Finally, my MyCFrameWnd has a custom message handler (WindowProc) and at the end of that routine I call:
return (CFrameWnd::WindowProc(uMsg,wParam,lParam));
When I look at messages that my toolbar generates/receives (using spy++), I cannot see any WM_NOTIFYFORMAT, WM_NOTIFY or WM_TIMER like other applications showing tooltips. Does anyone have a small clue why my tooltips don't show?
modified on Monday, August 31, 2009 11:44 PM