Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to display a ToolTip in a CEdit with input keyboard focus?

178 views
Skip to first unread message

Philip Chang

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to

In my modal dialog, I am able to display a ToolTip when my mouse pointer
is positioned over a CEdit control.

But how can I force ToolTip to be displayed for the same CEdit control
when it has input keyboard focus, but the mouse pointer is not
positioned over it?

Thanks,
Philip Chang


Ajay Kalra

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to

This would be a very unusual behavior. You also have to keep in mind that
when mouse is over other controls, they may decide to show a tooltip. At the
same time you are also showing the tooltip. Usually you have one tooltip
object which is used by all the controls. Of course, you can customize your
edit control to have its own tooltip.

Are you sure you want to do this?

--
Ajay Kalra [MVP]
ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

Philip Chang <philip...@checksol.com> wrote in message
news:399ACE79...@checksol.com...

Philip Chang

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to

Well, when input keyboard focus is in a CEdit control, I would like to display a
short message to the user to help the user decide what to type into the CEdit
control.

I have no real estate to display this short message in a CStatic, so I was
hoping to display it in a temporary "floating" ToolTip...

If I don't use ToolTip, what other control can I use to display a temporary
message near the CEdit control?

Thanks,
Philip Chang

=======================================

Ajay Kalra

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to

If I understand you correctly, you want to show a tooltip ONLY when mouse is
over CEdit. Thats acceptable behavior. However I dont know what CStatic you
are talking about. Additionally, you mentioned somethinkg about showing a
tootip even when mouse is not over CEdit.

Following example is very helpful:

SuperTip Demonstrates Tool Tips in an MFC Application
ID: Q188317

In addition, there are several examples in tootip section of
codeguru.developer.com.

--
Ajay Kalra [MVP]
ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

Philip Chang <philip...@checksol.com> wrote in message

news:399B13AE...@checksol.com...

FDB

unread,
Aug 17, 2000, 2:53:02 AM8/17/00
to
Hello,

I'm sorry but I can't help you.
I'm interested in how you make tooltips for CEdit boxes.
Could you perhaps give me some hints of how to set up something like that;
info, documentation, sites, MSDN?

Many thanks in advance, Kimball

Philip Chang <philip...@checksol.com> schreef in berichtnieuws

Ajay Kalra

unread,
Aug 17, 2000, 3:00:00 AM8/17/00
to

See my earlier reply to this posting mentioning sites and examples in MSDN.

--
Ajay Kalra [MVP - VC++]
ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

FDB <fdb...@worldonline.nl> wrote in message
news:8ng24t$cha$1...@nereid.worldonline.nl...

Philip Chang

unread,
Aug 17, 2000, 3:00:00 AM8/17/00
to

CStatic is a C++ class. Let me clarify...When user tabs into a CEdit control, I
want to display a short message to tell the user what data to type into the
CEdit control.

For example, I would like to display a short message "Please type in your name",
so the user would know to type in a name into the CEdit control.

I was hoping to display "Please type in your name" in a ToolTip. I do not have
any room in my dialog box to display "Please type in your name" in a CStatic
text control.

The user is using keyboard only. The mouse pointer is off screen and the user
is not using the mouse.

Thanks,
Philip Chang

Ajay Kalra wrote:

> If I understand you correctly, you want to show a tooltip ONLY when mouse is
> over CEdit. Thats acceptable behavior. However I dont know what CStatic you
> are talking about. Additionally, you mentioned somethinkg about showing a
> tootip even when mouse is not over CEdit.
>
> Following example is very helpful:
>
> SuperTip Demonstrates Tool Tips in an MFC Application
> ID: Q188317
>
> In addition, there are several examples in tootip section of
> codeguru.developer.com.
>
> --
> Ajay Kalra [MVP]

> ajay...@yahoo.com
>
> Note: Please post all replies to newsgroup only.
>

> > > ajay...@yahoo.com
> > >
> > > Note: Please post all replies to newsgroup only.
> > >

> > > Philip Chang <philip...@checksol.com> wrote in message

> > > news:399ACE79...@checksol.com...

Ajay Kalra

unread,
Aug 17, 2000, 3:00:00 AM8/17/00
to
You can certainly do it. But all the work of showing/hiding the window
should be done by you. You do not really need a tooltip for this. All you
need a child window which is visible when you get focus and invisible
otherwise. Any CWnd derived window would do.

1. Create a child window in OnInitDialog(CTooltipCtrl or CStatic or any
other CWnd derived object) without WS_VISIBLE flag. Use SetWindowText to set
the text on the window.
2.Override OnSetFocus and OnKillFocus of your edit control.
3. In OnSetFocus, use pchildWnd->ShowWindow(SW_SHOW) and OnKillFocus, use
pChildWnd->ShowWindow(SW_HIDE)

These are general steps that you can use. Another option you can think of is
to use a Status Bar in your dialog, if you have real estate for it.

--
Ajay Kalra [MVP - VC++]

ajay...@yahoo.com

Note: Please post all replies to newsgroup only.

Philip Chang <philip...@checksol.com> wrote in message

news:399C5A42...@checksol.com...

cweiske

unread,
Aug 18, 2000, 3:00:00 AM8/18/00
to
What about a status bar? This thing is for work like you need.

--
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
Christian Weiske, RealDreams
cwe...@web.de
www.realdreams.purespace.de
<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>

0 new messages