Page 1 of 1

v0.6.2 Tooltips and MousePassThrough

Posted: Thu Oct 15, 2009 22:31
by Jamarr
This is in v0.6.2, as I do not have v0.7 yet I cannot test this there.

If you have a button with a tooltip, and the tooltip appears under the cursor, when you click the event is consumed by the tooltip and not the button. So the button doesnt fire and your window loses focus. Note that the tooltip must appear directly under the cursor, if the tooltip is offset from the cursor (because you are near the edge of the screen) this doesn't happen. To fix this, you can set MousePassThroughEnabled to true on the tooltip window; I believe this should be the default setting for a tooltip window.

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Fri Oct 16, 2009 12:10
by CrazyEddie
Hi,

I can see how this could be an issue. The thing about having pass-through enabled is that the tool-tip is not then informed about the mouse entering it; this notification is normally used to reposition the tool-tip window. Obviously you can set the state manually, or edit the looknfeel to set it as the default (I assume you already did this for yourself, though? :)). I guess a compromise would be to detect clicks on the tooltip window and dismiss it when the user clicks it?

CE.

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Fri Oct 16, 2009 17:29
by Jamarr
Right, I forgot about the repositioning.

Discarding click events wouldn't really help, because your still throwing away input when the user was obviously trying to click something - so in this respect there is no difference than if the tooltip consumes it. Imho, tooltips should be treated as transparent entities, and so the click should go through to the underlying window.

I think there are a couple of options. First, the tooltip window could appear offset from the cursor instead of the top-left corner being directly under it. Second, you could just forward click events from the tooltip to the target window. I'm not sure which is better...

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Sat Oct 17, 2009 08:43
by CrazyEddie
I'll fix the positioning anyway, since that's a very easy fix and I think would be better if offset from the image edge instead of the mouse 'hot-spot'.

I may add an option for forwarding the events ;)

CE.

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Sun Oct 18, 2009 18:33
by CrazyEddie
I looked at the positioning of the tooltip and it already takes account of the mouse image size - so really, unless space is extremely limited, the tooltip should only ever rarely appear directly beneath the cursor. Indeed, when I fixed bugs and implemented suggestions previously regarding this, I had to disable the repositioning code entirely in order to test! So this makes me wonder how you guys are doing this in the first place :D

With reference to what I said about mouse clicks, I did not mean to discard them, rather I meant that if the mouse is within the tooltip and you click the mouse button, the tooltip would go away exposing whatever is beneath.

Having thought about the 'forwarding' a little, this is not so straight forward; the logic of many widgets will check where the mouse is and decide what to do based on that - this means that when the mouse down / up events are forwarded the behaviour will rarely be correct since - under the conditions described earlier in the thread - the mouse is 'in' the ToolTip window. So for example, a PushButton would not fire the Clicked event under this arrangement, and similarly, things like checkboxes and radio buttons would not change state.

This leaves us with the original point of MousePassThough - which is user-configurable anyway via the looknfeel, although - as already discussed - doing this will cause the tip repositioning code to not do anything ;)

CE.

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Mon Oct 19, 2009 20:08
by Jamarr
CrazyEddie wrote:I looked at the positioning of the tooltip and it already takes account of the mouse image size - so really, unless space is extremely limited, the tooltip should only ever rarely appear directly beneath the cursor. Indeed, when I fixed bugs and implemented suggestions previously regarding this, I had to disable the repositioning code entirely in order to test! So this makes me wonder how you guys are doing this in the first place :D


But it only uses the mouse-image size if you are using a CEGUI mouse-cursor, otherwise it uses 0x0 for the size. This leads to the top-left corner of the tooltip being set to the position of the mouse :D

Re: v0.6.2 Tooltips and MousePassThrough

Posted: Tue Oct 20, 2009 08:46
by CrazyEddie
Yeah, I can see how this could be an issue. The reason being, of course, is that CEGUI only knows about it's own mouse cursor. What you could do is set a dummy image of the appropriate size, then the behaviour would be correct (yes, that's a hack :P)

CE.