Programming note: tooltips

This posting is of historical interest. It exists to help other programmers who may come across the same problem.

Once Cardbox was working under Wine, we found something very awkward about using it. Whenever you moved the mouse onto a button, intending to click it, Cardbox would lose the input focus and you would have to click the mouse twice: once to get the focus back to Cardbox and once to click the button.

Observation showed that this happened with any control that had a tooltip that popped up when the mouse was over the tooltip.It turns out that while Windows allows you to create tooltips with

CreateWindow(TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP|TTS_NOPREFIX,...

Wine requires you to use

CreateWindow(TOOLTIPS_CLASS,NULL,WS_POPUP|TTS_ALWAYSTIP|TTS_NOPREFIX,...

to prevent the tooltip from seizing the input focus.

Once this change was made, buttons behaved normally and only needed to be clicked once. Fortunately Windows does not object to the use of WS_POPUP, so there was no need for Cardbox to detect Wine and behave differently for it.

Programs such as Internet Explorer suffer from the same problem for the same reason, but of course no-one has access to Internet Explorer’s source code to make the necessary changes. Wine itself needs to be corrected.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: