Modeless Dlg Tooltips sans Focus
PP mail system -- LAWSONW@sydney.ccur.com
Wednesday, October 23, 1996
Environment: Win 95, MVC++ 4.1
G'Day!
Problem: How to get Tooltips displayed when the owning modeless
dialog does not have the focus?
Background.
I am extending an existing application with a number of modeless dialogs
which each employ (typically) a dozen "standard" wizard-built buttons.
These dialogs are all owned/hidden/displayed by the MainFrame. The aim
is to replace the dialog buttons with toolbars, "pallette"-style, and
thereby get more buttons in less area.
Using the sample CMNCTRLS as a guide, my CToolBarCtrl works fine so long
as the dialog has the focus. However, the application is essentially an
edit, so as the document is modified, the focus shifts from the dialog
to the current view. Depending upon the function selected, there may be
several ways of terminating the sequence, but now the toolbar buttons
give no clues as to which to use!
Substituting "p_MainFrame" for "this" in CMyToolBarCtrl::Create loses
the relationship between placement of the dialog and the placement of
the toolbar; the toolbar is displayed on startup though the dialog is
concealed; no tooltips are displayed anyway! No sign of anything going
to the Mainframe except the standard Afx stuff E100, E101, etc.
Watching "OnNotify" in both the Dialog and the ToolBar shows that a
particular TB Button is only identified in the WPARAM value when the
dialog has the focus. Only "OnNcHitTest" is invoked regardless of the
focus, but the code-sequence into the source-library disappears into a
mire of thread-state analysis and message-filtering which I would prefer
not to have to unravel, and most likely can't change anyway. Putting in
a (yuk!)
CWnd* pWndOwner = GetParent();
CWnd* pWndPrev = pWndOwner->SetActive();
UINIT i=CToolBarCtrl::OnNcHitTest(...);
pWndPrev->SetActive();
just caused the screen to flash -- still no tooltips!
I am reluctant to start experimenting with CToolTipCTrls because of the
sheer convenience of using the Wizard/.RC file/CToolBarCtrl approach.
Little geometry to consider, neat rows and columns, and simple to add
new buttons or change the button order.
So, can anyone throw any light on how to enable these tooltips so long
as the application has the focus?
Yours in hope,
Jim LW
Jim Tannenbaum -- jimt1@voicenet.com
Friday, October 25, 1996
[Mini-digest: 2 responses]
>Problem: How to get Tooltips displayed when the owning modeless
> dialog does not have the focus?
>
Jim,
Enable the TTN_ALWAYSTIP attribute for ToolTips.
Jet
JJM Systems, Inc Phone: (215) 672-3660
1 Ivybrook Blvd, Suite 190 Fax: (215) 672-5702
Ivyland, PA 19874 Net: jimt1@voicenet.com
-----From: Dong Chen
Try to overwrite the OnToolHitTest() function.
Inside the function, use ChildWindowFromPoint() to get a CWnd* pointer. It
will ensure you get one no matter if it has the focus. Then display your
tooltip.
This worked in my App Bar application.
Hope this help.
| Вернуться в корень Архива
|