[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [lmi] Popup contextual help appears at mouse position
From: |
Vadim Zeitlin |
Subject: |
Re[2]: [lmi] Popup contextual help appears at mouse position |
Date: |
Fri, 29 Feb 2008 23:51:17 +0100 |
On Fri, 29 Feb 2008 20:22:53 +0000 Greg Chicares <address@hidden> wrote:
GC> > I agree and so I propose to fix this in the following way: if the mouse
is
GC> > inside the control when Shift+F1 is pressed, show help at its position.
GC>
GC> At first, I was wondering why you'd distinguish that special
GC> case instead of using the "near" method (below) unconditionally.
GC> My guess is that you're thinking of a large text control, like
GC> the main screen of a text editor, where a "tip" might otherwise
GC> pop up far from the user's visual focus. That sounds like a
GC> good enough reason to me; I just wonder whether there's another
GC> rationale as well.
No, you've given exactly the reason I proposed to do it like this (and in
fact I did mean to add a rationale for it too but forgot, sorry).
GC> > Otherwise, show help "near" the control: by default, position it just
under
GC> > it but place it above instead if it wouldn't fit on screen otherwise (this
GC> > is a bit tricky as I don't know right now how to get the size of the
GC> > tooltip window).
GC>
GC> 'src/msw/tooltip.cpp' calls GetTextExtentPoint32() already, to
GC> get the maximum width, so the height is available, too. Doesn't
GC> TTM_ADJUSTRECT then give you the window size? Or, if you want to
GC> avoid depending on a modern version of comctl32.dll, wouldn't it
GC> suffice to add, say, ten pixels to both dimensions? (That's what
GC> our legacy app, with its ancient GUI library, seems to do.)
I can indeed estimate the tooltip window size using the font measurements
but there is also a margin and the shadow (it wouldn't be fatal if it were
cut out but this still wouldn't look very good). I'll probably end up by
just adding 10 pixels or maybe something similar in (resolution-
independent) dialog units anyhow but I wanted to look a bit more if there
wasn't a simpler and less fragile way of getting the tooltip size. But I
still didn't find anything so I'll probably just hack around it as usual.
Regards,
VZ