Tooltips on MaxGUI buttons?

BlitzMax Forums/BlitzMax Programming/Tooltips on MaxGUI buttons?

ozak(Posted 2006) [#1]
I can't seem to find any info on doing so? Is it possible at all?

Regards

Ozak


ImaginaryHuman(Posted 2006) [#2]
something about adding tags springs to mind


assari(Posted 2006) [#3]
If you are talking about adding tooltips to toolbars, then look here


Grisu(Posted 2006) [#4]
I think he is talking about normal buttons.
The thing you could do is displaying help texts in the statusbar... :)


ImaginaryHuman(Posted 2006) [#5]
There's probably a `mouse enter` event you can get when the mouse enters the button area, in which you can set a flag to say you're inside the button, then you can set a timer, then in the mousedown event you can check for that and if the timer is past a certain amount, temporarily add a little box with a message in it to the GUI, and then when the mouse moves, with a mousemove event, remove it.


Kev(Posted 2006) [#6]
ozak, you need to look into the tooltips_class32 class, if you need any help let me now, this is how i have done them in winblitz3d.

kev


hub(Posted 2006) [#7]
Kev, is it possible to have this also with a textfield ? Personnaly, i don't know how to manage/access to the tooltips_class32 class !
Thanks!


Kev(Posted 2006) [#8]
@hub, yes ive working tooltip's on textfield in winblitz3d. basicly it possable on most standard winapi gadgets, ive little time to code this up but i will help if anyone wants to do this. athough this would only work under win32, im have no idea under linux or macos.

some c code i use to enable tooltips on any passed gadget, NOTE this is takin from my winblitz3d's sourcecode. so some modifcation would be needed to port it into blitzmax.


 DWORD dwStyle = WS_POPUP  |
                      TTS_ALWAYSTIP | // appears when button active/inactive
                      TTS_NOPREFIX |TTF_IDISHWND;  // don't strip ampersand (&) character

        if(type==1){
                dwStyle = dwStyle | TTS_BALLOON;
        }
        
     HWND hwndToolTip = CreateWindowEx( 0, "tooltips_class32", 0, dwStyle,
                                    CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
                                    CW_USEDEFAULT, gadget, (HMENU)0,
                                    GetModuleHandle(0),0 ) ;

      //+----------------------------------------------------------+
      //| You must explicitly define a ToolTip control as topmost. |
      //| Otherwise, it might be covered by the parent window.     |
      //+----------------------------------------------------------+
      SetWindowPos( hwndToolTip, HWND_TOPMOST,0, 0, 0, 0,
                    SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );

      //+------------------------------------------------------------+
      //| Get the bounding rect of the buttons. We will need this to |
      //| fill in the rect member of the TOOLINFO structures.        |
      //+------------------------------------------------------------+
      RECT rc ;
      GetClientRect( gadget, &rc ) ;

      //+--------------------------------------------+
      //| Fill in a TOOLINFO structure for Gadget.   |
      //+--------------------------------------------+
      TOOLINFO ti ;
      ti.cbSize   = sizeof ( TOOLINFO ) ;
      ti.hinst    = GetModuleHandle(0)  ;
      ti.hwnd     = hwndToolTip ;    // tooltip hwnd 
      ti.lpszText = TEXT(tiptext) ; // tooltip for gadget
      ti.rect     = rc ;
      ti.uFlags   = TTF_SUBCLASS | TTF_IDISHWND  ;  // tool tip control handles own messages
      ti.uId = (UINT)gadget; // gadget hwnd to add tooltip

      //+---------------------------------------------------+
      //| Add the tool for Gadget to the ToolTip control. |
      //+---------------------------------------------------+
      SendMessage( hwndToolTip,
                   TTM_ADDTOOL, // Registers a tool with a ToolTip control.
                   0,
                   (LPARAM)(LPTOOLINFO)(&ti) ) ; // address of TOOLINFO struct



kev