tooltips w/ scroll bar thumb
Gene Sewell -- genes@fast.net
Tuesday, September 17, 1996
Environment: Win NT 3.51/4 /Win95 VC++ 4.1
Hi,
I'm would like to use the tooltip widget to give information to the user as
he manipulates the thumb on a scroll bar. I am just about to start this,
and thought perhaps someone knew of some code example that would save me
some time.
What I most need is to figure out how to get the window handle to the thumb
of the scrollbar. Once I have that, I assume it wouldn't be too hard to
attach that to the tooltip thingie, and then to figure out how to
continuously change the text with each movement of the thumb.
So, anyone have any help for this project?
Thanks so much,
Gene
----
Experience is what you get when you were expecting something else.
Randy Taylor -- randy_taylor@ebt.com
Friday, September 20, 1996
[Mini-digest: 4 responses]
Environment: Win NT 3.51/4 /Win95 VC++ 4.1
There are at least two things to consider:
1. Many scroll bars are not windows (the do not have HWND's). The are just
drawn
by real window based upon the existance of the style bits like
WS_HSCROLL.
Ordinary tooltips are actually siblings to the CFrameWnd and you can get
info about that tooltip in the AFX_MODULE_THREAD_STATE structure.
2. As soon as the mouse is clicked inside the active CFrameWnd, the default
behaviour is to remove the tooltip. So you'll have to do some work to
make it persist.
-----From: =?iso-8859-1?Q?Gunnar_=D6rn_Rafnsson?=
The thumb is a part of the scrollbar, not a separate window. The solution would be to track the scrollbar messages.
void CYourView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
// Update the tool tip text
CView::OnVScroll(nSBCode, nPos, pScrollBar);
}
Gunnar Rafnsson
-----From: Mike Blaszczak
By using Spy++, you can tell in short order that the thumbtracker of a
scrollbar isn't a separate window and is instead actually just something that's
drawn by the control in its own window.
Why do you need the thumb? Why can't your tool tip control be parented to
the whole scrollbar?
>Once I have that, I assume it wouldn't be too hard to
>attach that to the tooltip thingie, and then to figure out how to
>continuously change the text with each movement of the thumb.
Yep.
.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.
-----From: "Alexander Grigoriev"
Scrollbar thumb is not a window. Scrollbar itself can be a window, if it =
is
created as a child control of a view. Anyway, you don't need a handle to =
a
thumb. You can activate the tooltip from any window that recieves scrollb=
ar
messages.
Mark Conway -- mrc@mfltd.co.uk
Monday, September 23, 1996
I've done this. I didn't use a tooltip control, because you just need a
window that looks like a tooltip control, without the complexities of
routing messages, etc. You might possibly save yourself some code by
using a tooltip control, but I figured it wasn't worth it. I handle the
scroll bar drag messages, and create a window which contains the
relevant text. To calculate the position, I found I had to get the
scroll bar range and work is out myself. Scrollbar thumb sliders are not
windows, so you can't get their x,y position. The code isn't hard, but
there is some faffing about trying to reduce flicker, eg hiding the
window, before moving it to a new position.
If there's some deamd for this, I'll hack out the relevant code and make
it available.
Mark.
>----------
>From: Gene Sewell[SMTP:genes@fast.net]
>Sent: 17 September 1996 22:29
>To: mfc-l@netcom.com
>Subject: tooltips w/ scroll bar thumb
>
>Environment: Win NT 3.51/4 /Win95 VC++ 4.1
>
>Hi,
>
>I'm would like to use the tooltip widget to give information to the
>user as
>he manipulates the thumb on a scroll bar. I am just about to start
>this,
>and thought perhaps someone knew of some code example that would save
>me
>some time.
>
>What I most need is to figure out how to get the window handle to the
>thumb
>of the scrollbar. Once I have that, I assume it wouldn't be too hard
>to
>attach that to the tooltip thingie, and then to figure out how to
>continuously change the text with each movement of the thumb.
>
>So, anyone have any help for this project?
>
>Thanks so much,
>
>Gene
>----
>Experience is what you get when you were expecting something else.
>
>
Mark Conway -- mrc@mfltd.co.uk
Friday, September 27, 1996
After numerous requests, I've put the sample code for this on
http://ourworld.compuserve.com/homepages/MRConway/
Mark.
>----------
>From: Mark Conway[SMTP:mrc@mfltd.co.uk]
>Sent: 23 September 1996 10:05
>To: 'mfc-l@netcom.com'
>Subject: RE: tooltips w/ scroll bar thumb
>
>I've done this. I didn't use a tooltip control, because you just need
>a
>window that looks like a tooltip control, without the complexities of
>routing messages, etc. You might possibly save yourself some code by
>using a tooltip control, but I figured it wasn't worth it. I handle the
>scroll bar drag messages, and create a window which contains the
>relevant text. To calculate the position, I found I had to get the
>scroll bar range and work is out myself. Scrollbar thumb sliders are
>not
>windows, so you can't get their x,y position. The code isn't hard, but
>there is some faffing about trying to reduce flicker, eg hiding the
>window, before moving it to a new position.
>
>If there's some deamd for this, I'll hack out the relevant code and
>make
>it available.
>
>Mark.
>
>>----------
>>From: Gene Sewell[SMTP:genes@fast.net]
>>Sent: 17 September 1996 22:29
>>To: mfc-l@netcom.com
>>Subject: tooltips w/ scroll bar thumb
>>
>>Environment: Win NT 3.51/4 /Win95 VC++ 4.1
>>
>>Hi,
>>
>>I'm would like to use the tooltip widget to give information to the
>>user as
>>he manipulates the thumb on a scroll bar. I am just about to start
>>this,
>>and thought perhaps someone knew of some code example that would save
>>me
>>some time.
>>
>>What I most need is to figure out how to get the window handle to the
>>thumb
>>of the scrollbar. Once I have that, I assume it wouldn't be too hard
>>to
>>attach that to the tooltip thingie, and then to figure out how to
>>continuously change the text with each movement of the thumb.
>>
>>So, anyone have any help for this project?
>>
>>Thanks so much,
>>
>>Gene
>>----
>>Experience is what you get when you were expecting something else.
>>
>>
>
| Вернуться в корень Архива
|