October 30, 2025, 02:43:52 PM

News:

IWBasic runs in Windows 11!


Tooltips Help

Started by Brian, February 11, 2011, 12:06:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

Hi,

Has anyone got a small working example of using Tooltips with a @SYSBUTTON?

My efforts work the first time you hover over a button, but subsequently nothing
happens then. I fancy it is something to do with my using a manifest, as the length
of the TOOLINFO struct appears to change when using Themes

Anybody care to advise me?

Brian



LarryMc

This works fine for me with a copy of the IWB/EB manifest file on a XP machine with the "XP Windows" theme selected on the PC.

$INCLUDE "WindowsSDK.inc"
$INCLUDE "CommCtrl.inc"

CONST BUTTON_1 = 1
CONST BUTTON_2 = 2
CONST BUTTON_3 = 3
WINDOW w1
OPENWINDOW w1,0,0,512,347,0x80C80080,0,"Tooltip",&w1_handler
CONTROL w1,@sysBUTTON,"SYSButton",28,55,80,20,0x50000000,BUTTON_1
CONTROL w1,@BUTTON,"Button2",28,89,80,20,0x50000000,BUTTON_2

'create the tool tip control
uint hTooltip = ToolTipControl(w1,@TTS_ALWAYSTIP|@TTS_BALLOON,0)
'add tooltips for our buttons
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(w1,1),w1.hwnd,"Button number one"
ttAddTool hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GetControlHandle(w1,2),w1.hwnd,"Button number two"


WAITUNTIL w1=0

SUB w1_handler
    SELECT @MESSAGE
        CASE @IDCREATE
            CENTERWINDOW w1
            /* Initialize any controls here */
        CASE @IDCLOSEWINDOW
            CLOSEWINDOW w1
        CASE @IDCONTROL
            SELECT @CONTROLID
                CASE BUTTON_1
                    IF @NOTIFYCODE = 0
                        /*button clicked*/
                    ENDIF
                CASE BUTTON_2
                    IF @NOTIFYCODE = 0
                        /*button clicked*/
                    ENDIF
            ENDSELECT
    ENDSELECT
RETURN
ENDSUB


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Larry,

That works great, thanks. I think it must be the $INCLUDE "CommCtrl.inc" line that does it.
I notice it has different TOOLINFO structs, depending on what version you are requesting

Thanks again,

Brian