Restored from previous forum. Originally posted by TerryHough.
Danillo, thanks for your example.
Three questions:
1) This doesn't work until at least one button has been clicked.
Then it works for all Gadgets set up with the balloon tip. Did I
miss something?
2) I have seen these type tips above, below, and vertical beside
the button (control). In your wealth of knowledge, is there
another switch or flag to set to choose which way they appear?
3) I have figured out how to attach these to Gadgets. But how to
use with ToolBar items eludes me. Any suggestion?
Thanks for your help and wonderful examples.
Terry
Tooltip style?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.

Please don't ask me what the Style "$D0000000" stands for.
THIS was really old code that I had on my disk (aproximatly 1 year old - how did you know ?)
Danilo, thanks anyway.
I think it should be possible to change
Button.TOOLINFO\cbSize=44
to
Button.TOOLINFO\cbSize = SizeOf( TOOLINFO ) ; works under W2k-Sp3
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Me neitherOriginally posted by Danilo
The Code by Franco is completely unreadable because he didnt use Constants.
How should somebody know what the Style "$D0000000" stands for ??
Can you remember this style after 1 year, Franco ?? I cant..
Please don't ask me what the Style "$D0000000" stands for.
THIS was really old code that I had on my disk (aproximatly 1 year old - how did you know ?)
[german] Danilo, so feinfuelig wie immer... [/german]Sorry, but its a mess to read and change such a wrong code...
Danilo, thanks anyway.
I think it should be possible to change
Button.TOOLINFO\cbSize=44
to
Button.TOOLINFO\cbSize = SizeOf( TOOLINFO ) ; works under W2k-Sp3
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
Thanks
Fangles
Thanks, that works. But it doesn't do the shape yours does in your toolbar library. This just does a rectangle (On my XP system anyway)Originally posted by Danilo
Try to changetoCode: Select all
Button.TOOLINFO\cbSize=40Sorry, but its a mess to read and changeCode: Select all
Button.TOOLINFO\cbSize=44 ; SizeOf( TOOLINFO )
such a wrong code...
Try to add $40 to the style in Franco´s original example...
( #define TTS_BALLOON 0x40 )
cya,
...Danilo
(registered PureBasic user)
Thanks
Fangles
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Danilo.
@traumatic:
that doesnt have the CC-update, the old style Tooltips
are shown - but the program still works like expected.
Its only a little visual thing that looks a little bit different.
I use the Balloon Tooltips in my Toolbar Library and it worked
on older windows´ - but with the old look.
If you use the way with Regions, you should make it looking nice.
The above example looks... aehmmm... ugly (especially the 2nd example).
Better way would be to make the Tooltip margin bigger first (TTM_SETMARGIN) - IMHO.
btw: your eMail address doesnt work anymore.
Cant answer you because mail comes back..
@TerryHough:
http://www.microsoft.com/msdownload/pla ... sdkupdate/
We already said it 100 times here... the P-SDK is nearly
all you need for Windows programming.
Its directly from Microsoft and contains over 150 .chm Help files (!!)
(you can access all through 1 help file), many utilities (Binaries)
and all the latest C/C++ headers with all structures and constants
you ever need.
Microsoft is giving out this Software Development Kit FOR YOU
and for FREE, because they want you to program for the
Microsoft Operating Systems.
They write the OS, so they have the infos how to use and program it.
If it still doesnt work, you could try to Update the Gadget window.
IMO it should work without adding anything - just dont make the
mistake that the debugger window is activated.
The best should be to include the command ActivateWindow():
Yes, looks like you meant the thing with ActivateWindow()
I wrote a small example for you, but it doesnt work
together with the BALLOON style atm - so i only used
the default rectangular style here.
If you specify the BALLOON style, the thing doesnt
point in the direction of your gadget (try it to see what i mean).
I didnt find a way to change the BALLOON "pointer",
so for now we have to live with this.
The Procedure is now called AddButtonToolTipOnSide()
and has a new parameter "Side".
"Side" can be 1, 2, 3 or 4 (#NORTH,#EAST,#SOUTH,#WEST).
See yourself how it can look (only small example):
I tried to write it clean and easy to understand...
....hope it helps.
You can use the command ToolBarToolTip() directly in PureBasic.
And if you want to use my Toolbar Library, there is a command
SetTBbuttonTooltip(). By using TBtooltipID() you can get the
handle to the Tooltip control and change it with SendMessage.
(Colors for example)
By using API, you add 1 Tooltip control to the Toolbar
and for every new toolbar button you add a new Tool to
the Tooltip Control by using the right co-ordinates.
You get the co-ordinates of the button by sending
a TB_GETITEMRECT message to the Toolbar.
@Franco:
Sorry, wasnt meant bad.
I just had a "stressige" Week...
cya,
...Danilo
(registered PureBasic user)
@traumatic:
When you use the Balloon style and it runs on a machine> just wanted to add the following info:
>
> TTS_BALLOON is only supported by 'comctl32.dll' v5.80 or higher.
[...]
> if your software has to run on every win32-system (even on one
> without IE5 or commoncontrols-update) you should go the
> 'region-way' imho
that doesnt have the CC-update, the old style Tooltips
are shown - but the program still works like expected.
Its only a little visual thing that looks a little bit different.
I use the Balloon Tooltips in my Toolbar Library and it worked
on older windows´ - but with the old look.
If you use the way with Regions, you should make it looking nice.
The above example looks... aehmmm... ugly (especially the 2nd example).
Better way would be to make the Tooltip margin bigger first (TTM_SETMARGIN) - IMHO.
btw: your eMail address doesnt work anymore.
Cant answer you because mail comes back..
@TerryHough:
Download the "Microsoft Windows Platform SDK":> Any suggestions, book or website, to learn more about
> using the API for such items and their
> parameters?
http://www.microsoft.com/msdownload/pla ... sdkupdate/
We already said it 100 times here... the P-SDK is nearly
all you need for Windows programming.
Its directly from Microsoft and contains over 150 .chm Help files (!!)
(you can access all through 1 help file), many utilities (Binaries)
and all the latest C/C++ headers with all structures and constants
you ever need.
Microsoft is giving out this Software Development Kit FOR YOU
and for FREE, because they want you to program for the
Microsoft Operating Systems.
They write the OS, so they have the infos how to use and program it.
Works fine here (the main window must be activated, not the debugger).> 1) This doesn't work until at least one button has been clicked.
> Then it works for all Gadgets set up with the balloon tip. Did I
> miss something?
If it still doesnt work, you could try to Update the Gadget window.
IMO it should work without adding anything - just dont make the
mistake that the debugger window is activated.
The best should be to include the command ActivateWindow():
Code: Select all
Procedure AddButtonToolTip(Handle,Text$)
#TTS_BALLOON = $40
#TTM_SETTITLE = #WM_USER+32
#TTM_ADDTOOL = #WM_USER+4
#TTF_IDISHWND = $1
#TTF_CENTERTIP = $2
#TTF_SUBCLASS = $10
#TTF_ABSOLUTE = $80
#TTF_TRANSPARENT = $100
TT=CreateWindowEx_(0,"tooltips_class32","",$D0000000|#TTS_BALLOON,0,0,0,0,WindowID(),0,GetModuleHandle_(0),0)
sendMessage_(TT,1044,0 ,0) ;ForeColor Tooltip
sendMessage_(TT,1043,$58F5D6,0) ;BackColor Tooltip
sendMessage_(TT,1048,0,180) ;Maximum Width of tooltip
SendMessage_(TT,#TTM_SETTITLE, 1, "Information")
Button.TOOLINFO\cbSize=SizeOf( TOOLINFO )
Button\uFlags= #TTF_IDISHWND | #TTF_SUBCLASS | #TTF_TRANSPARENT ;| #TTF_CENTERTIP
Button\hWnd=Handle
Button\uId=Handle
Button\lpszText=@Text$
SendMessage_(TT,#TTM_ADDTOOL,0,Button)
ActivateWindow()
EndProcedure
If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "ToolTip example")
; Initialize Common Controls
Structure INITCOMMONCONTROLSEX
dwSize.l
dwICC.l
EndStructure
#ICC_BAR_CLASSES = $4
icex.INITCOMMONCONTROLSEX\dwSize = SizeOf( INITCOMMONCONTROLSEX )
icex\dwICC = #ICC_BAR_CLASSES
initCommonControlsEx_(icex)
; Create a Button
CreateGadgetList(WindowID())
hButt=ButtonGadget(1, 110,60, 100, 100, "Button")
; add Tooltip
ButtonTooltip$="Button Tooltip whatever you want is possible, even very big text like this one... nice isn't it?"
AddButtonToolTip(hButt,ButtonTooltip$)
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventCloseWindow ; If the user has pressed on the close button
Quit = 1
EndSelect
Until Quit = 1
EndIfYes, looks like you meant the thing with ActivateWindow()
Yes, thats possible with a Callback Procedure.> 2) I have seen these type tips above, below, and vertical beside
> the button (control). In your wealth of knowledge, is there
> another switch or flag to set to choose which way they appear?
I wrote a small example for you, but it doesnt work
together with the BALLOON style atm - so i only used
the default rectangular style here.
If you specify the BALLOON style, the thing doesnt
point in the direction of your gadget (try it to see what i mean).
I didnt find a way to change the BALLOON "pointer",
so for now we have to live with this.
The Procedure is now called AddButtonToolTipOnSide()
and has a new parameter "Side".
"Side" can be 1, 2, 3 or 4 (#NORTH,#EAST,#SOUTH,#WEST).
See yourself how it can look (only small example):
Code: Select all
Procedure AddButtonToolTipOnSide(Handle,Text$, Side)
#TTS_BALLOON = $40
#TTM_SETTITLE = #WM_USER+32
#TTM_TRACKACTIVATE = #WM_USER+17
#TTM_TRACKPOSITION = #WM_USER+18
#TTF_IDISHWND = $1
#TTF_CENTERTIP = $2
#TTF_SUBCLASS = $10
#TTF_ABSOLUTE = $80
#TTF_TRANSPARENT = $100
TT=CreateWindowEx_(0,"tooltips_class32","",$D0000000,0,0,0,0,0,0,GetModuleHandle_(0),0)
sendMessage_(TT,1044,0 ,0) ;ForeColor Tooltip
sendMessage_(TT,1043,$58F5D6,0) ;BackColor Tooltip
sendMessage_(TT,1048,0,180) ;Maximum Width of tooltip
SendMessage_(TT,#TTM_SETTITLE, 1, "Information") ; Add Header
Button.TOOLINFO\cbSize=SizeOf( TOOLINFO )
Button\uFlags= #TTF_IDISHWND | #TTF_SUBCLASS | #TTF_TRANSPARENT
Button\hWnd=WindowID() ; Handle to MainWindow ( for Callback )
Button\uId=Handle ; Handle to Gadget
Button\hInst = Side ; misused here for the side
Button\lpszText=@Text$
SendMessage_(TT,#TTM_ADDTOOL,0,Button)
ActivateWindow()
EndProcedure
Procedure WindowCallback(Window,Message,wParam,lParam)
result = #PB_ProcessPureBasicEvents
Select Message
Case #WM_NOTIFY
*notify.NMHDR = lParam
Select *notify\code
Case #TTN_SHOW
;beep_(1400,50)
ti.TOOLINFO\cbSize = SizeOf(TOOLINFO)
ti\hWnd = Window
ti\uId = *notify\idfrom
SendMessage_(*notify\hwndFrom,#TTM_GETTOOLINFO,0,ti)
GetWindowRect_(*notify\idfrom,area.RECT)
GetClientRect_(*notify\hwndFrom,size.RECT)
Select ti\hInst
Case 1 ; NORTH
SetWindowPos_(*notify\hwndFrom,#HWND_TOP,area\left,area\top-size\bottom,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
result = 1
Case 2 ; EAST
SetWindowPos_(*notify\hwndFrom,#HWND_TOP,area\right,area\top,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
result = 1
Case 3 ; SOUTH
SetWindowPos_(*notify\hwndFrom,#HWND_TOP,area\left,area\bottom,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
result = 1
Case 4 ; WEST
SetWindowPos_(*notify\hwndFrom,#HWND_TOP,area\left-size\right,area\top,0,0,#SWP_NOSIZE|#SWP_NOACTIVATE)
result = 1
Default
result = 0
EndSelect
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "ToolTip example")
SetWindowCallback(@WindowCallback())
; Initialize Common Controls
Structure INITCOMMONCONTROLSEX
dwSize.l
dwICC.l
EndStructure
#ICC_BAR_CLASSES = $4
icex.INITCOMMONCONTROLSEX\dwSize = SizeOf( INITCOMMONCONTROLSEX )
icex\dwICC = #ICC_BAR_CLASSES
initCommonControlsEx_(icex)
; Create some Buttons...
CreateGadgetList(WindowID())
hButt1=ButtonGadget(1, 10, 10, 100, 100, "Button 1")
hButt2=ButtonGadget(2, 110, 10, 100, 100, "Button 2")
hButt3=ButtonGadget(3, 10,110, 100, 100, "Button 3")
hButt4=ButtonGadget(4, 110,110, 100, 100, "Button 4")
; ...and add Tooltips
#NORTH = 1 : #EAST = 2 : #SOUTH = 3 : #WEST = 4
AddButtonToolTipOnSide(hButt1,"Set to #NORTH",#NORTH)
AddButtonToolTipOnSide(hButt2,"Set to #EAST" ,#EAST )
AddButtonToolTipOnSide(hButt3,"Set to #WEST" ,#WEST )
AddButtonToolTipOnSide(hButt4,"Set to #SOUTH",#SOUTH)
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventCloseWindow ; If the user has pressed on the close button
Quit = 1
EndSelect
Until Quit = 1
EndIf
I tried to write it clean and easy to understand...
....hope it helps.
Why do you want to do all this by API ??> 3) I have figured out how to attach these to Gadgets. But how to
> use with ToolBar items eludes me. Any suggestion?
You can use the command ToolBarToolTip() directly in PureBasic.
And if you want to use my Toolbar Library, there is a command
SetTBbuttonTooltip(). By using TBtooltipID() you can get the
handle to the Tooltip control and change it with SendMessage.
(Colors for example)
By using API, you add 1 Tooltip control to the Toolbar
and for every new toolbar button you add a new Tool to
the Tooltip Control by using the right co-ordinates.
You get the co-ordinates of the button by sending
a TB_GETITEMRECT message to the Toolbar.
@Franco:
Sorry, wasnt meant bad.
I just had a "stressige" Week...
cya,
...Danilo
(registered PureBasic user)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by TerryHough.
Thanks for your help, ideas and suggestions Danillo.
It isn't that I want to use the API. I definitely don't. I just wanted balloon style tool tips everywhere.
Appreciate your help.
Terry Hough
Thanks for your help, ideas and suggestions Danillo.
I wasn't very clear how I stated that. I meant that I haven't been able to get balloon type tool tips attached to the toolbar. I have only been able to get the old standard style using the PureBasic gadget.Why do you want to do all this by API ??> 3) I have figured out how to attach these to Gadgets. But how to
> use with ToolBar items eludes me. Any suggestion?
It isn't that I want to use the API. I definitely don't. I just wanted balloon style tool tips everywhere.
Appreciate your help.
Terry Hough