Page 1 of 2

Posted: Thu Aug 29, 2002 8:15 pm
by BackupUser
Restored from previous forum. Originally posted by TerryHough.

Is there a flag to set to change the style of the tooltips
created with GadgetToolTip(#Gadget, Text$), etc. to the
balloon style?

I am trying to duplicate an application written in a different
language in PureBasic to exterminate the "bloat". The
conversion is easy enough. However, in trying to duplicate
the "look and feel" so that my users won't even know anything
has changed, I haven't been able to get balloon style tooltips.

Small difference, I know. But you know how users can be. The
least little thing gets them off track.

Thanks for your ideas.

Terry

Posted: Thu Aug 29, 2002 8:35 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

Hi TerryHough
Balon style for tooltips? Mhhh i dont know this... i only know this balontips from some appz on the systrayicon... I have cant remember to saw somewheere balonstyle tooltips else... If you have a code-snip, please let me know :wink:


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Thu Aug 29, 2002 8:39 pm
by BackupUser
Restored from previous forum. Originally posted by traumatic.

afaik the only way to do this (running on every win-version) is to use a regioned window and setup everything else on your own.

the following links only contain c++ sources, but maybe it's still useful for you:

http://www.codeproject.com/miscctrl/balloonhelp.asp
http://www.codeproject.com/dialog/message_balloons.asp



if you need a purebasic example to do window regioning/skinning let me know




--------
good programmers don't comment their code. it was hard to write - should be hard to read!

Posted: Thu Aug 29, 2002 9:05 pm
by BackupUser
Restored from previous forum. Originally posted by TerryHough.

Wow...

Way to complicated for my limited abilities.

Shame though, "balloon" style has been around for
quite a while. I have been using them since Win95
in the other language. And I see them frequently
now in use in software.

I may have "balloon help" and tooltips confused, but
they perform exactly the same without effort in the
original language. Which, of course, I want to get
away from.

Thanks for the response.

Terry

Posted: Thu Aug 29, 2002 11:08 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Originally posted by TerryHough

Wow...

Way to complicated for my limited abilities.

Shame though, "balloon" style has been around for
quite a while. I have been using them since Win95
in the other language. And I see them frequently
now in use in software.

I may have "balloon help" and tooltips confused, but
they perform exactly the same without effort in the
original language. Which, of course, I want to get
away from.

Thanks for the response.

Terry
Ask Danilo. He did this in his toolbar library and it looks pretty good. He might help.

Fangles

Posted: Thu Aug 29, 2002 11:30 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

Well, I'm not Danilo but here is what I could provide...

Code: Select all

; (c) 2002 - Franco's template - absolutely freeware
; how to create a user defined tooltip

Procedure AddButtonToolTip(Handle,Text$)
  ToolTipControl=CreateWindowEx_(0,"tooltips_class32","",$D0000000,0,0,0,0,WindowID(),0,GetModuleHandle_(0),0)
  sendMessage_(ToolTipControl,1044,0 + 0<<8 + 255<<16,0)          ;ForeColor Tooltip
  sendMessage_(ToolTipControl,1043,255 + 255<<8 + 0<<16,0)        ;BackColor Tooltip
  sendMessage_(ToolTipControl,1048,0,180)                         ;Maximum Width of tooltip

  Structure TOOLTIP
    size.l
    flags.l
    handle1.l
    handle2.l
    notused1.l
    notused2.l
    notused3.l
    notused4.l
    notused5.l
    text.l
  EndStructure

  ToolInfoButton.TOOLTIP\size=40
  ToolInfoButton.TOOLTIP\flags=$11
  ToolInfoButton.TOOLTIP\handle1=Handle
  ToolInfoButton.TOOLTIP\handle2=Handle
  ToolInfoButton.TOOLTIP\text=@Text$
  SendMessage_(ToolTipControl,$0404,0,ToolInfoButton)
EndProcedure

If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "ToolTip example")

  CreateGadgetList(WindowID())
  hButt=ButtonGadget(1, 110,60, 100, 100, "Button")
  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
  
EndIf

End

Tested under Win2k-Sp3. Hope this helps...

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Posted: Fri Aug 30, 2002 12:27 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

Now, how to get this into a proper balloon, speech bubble shape?? (I'm greedy)

Posted: Fri Aug 30, 2002 4:48 am
by BackupUser
Restored from previous forum. Originally posted by Franco.
Originally posted by Fangbeast

Now, how to get this into a proper balloon, speech bubble shape?? (I'm greedy)
Well I don't know how bubbles looks like in 'down under' but I hope this elliptic form is close enough :)

Code: Select all

; (c) 2002 - Franco's template - absolutely freeware
; how to create a user defined tooltip
; added Elliptic form...
 
Procedure AddButtonToolTip(Handle,Text$)
 
  ToolTipControl=CreateWindowEx_(0,"tooltips_class32","",$D0000000,0,0,0,0,WindowID(),0,GetModuleHandle_(0),0)
  
  Shared Elliptic.l
  Elliptic=CreateEllipticRgn_(1,1,178,56)
  SetWindowRgn_(ToolTipControl,Elliptic,1)
 
  sendMessage_(ToolTipControl,1044,0 + 0<<8 + 255<<16,0)          ;ForeColor Tooltip
  sendMessage_(ToolTipControl,1043,255 + 255<<8 + 0<<16,0)        ;BackColor Tooltip
  sendMessage_(ToolTipControl,1048,0,180)                         ;Maximum Width of tooltip
 
  Structure TOOLTIP
    size.l
    flags.l
    handle1.l
    handle2.l
    notused1.l
    notused2.l
    notused3.l
    notused4.l
    notused5.l
    text.l
  EndStructure
 
  ToolInfoButton.TOOLTIP\size=40
  ToolInfoButton.TOOLTIP\flags=$11
  ToolInfoButton.TOOLTIP\handle1=Handle
  ToolInfoButton.TOOLTIP\handle2=Handle
  ToolInfoButton.TOOLTIP\text=@Text$
  SendMessage_(ToolTipControl,$0404,0,ToolInfoButton)
EndProcedure
 
If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "ToolTip example")
 
  CreateGadgetList(WindowID())
  hButt=ButtonGadget(1, 110,60, 100, 100, "Button")
  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
  
EndIf
 
DeleteObject_(Elliptic)
 
End
Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.

Posted: Fri Aug 30, 2002 6:00 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

I'm impressed. I did a screenshot of the bubble I meant, just need to post it to you

Fangles

Posted: Fri Aug 30, 2002 6:21 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

This is part of what I wanted. Now I need to add the downward pointing spike as if it were a chat bubble. Might be able to use the CombineRegion_ API to do that somehow

Shared RoundRect.l
RoundRect = CreateRoundRectRgn_(1, 1, 178, 56, 10, 10)
SetWindowRgn_(ToolTipControl, RoundRect, 1)


Fangles

Posted: Fri Aug 30, 2002 7:00 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

You simply have to add the Style TTS_BALLOON ($40)
to CreateWindowEx_():

Code: Select all

; (c) 2002 - Franco's template - absolutely freeware
; how to create a user defined tooltip
 
Procedure AddButtonToolTip(Handle,Text$)
  #TTS_BALLOON = $40
  ToolTipControl=CreateWindowEx_(0,"tooltips_class32","",$D0000000|#TTS_BALLOON,0,0,0,0,WindowID(),0,GetModuleHandle_(0),0)
  sendMessage_(ToolTipControl,1044,0 ,0)          ;ForeColor Tooltip
  sendMessage_(ToolTipControl,1043,$58F5D6,0)     ;BackColor Tooltip
  sendMessage_(ToolTipControl,1048,0,180)         ;Maximum Width of tooltip
 
  Button.TOOLINFO\cbSize=44 ; SizeOf( TOOLINFO )
  Button\uFlags=$11
  Button\hWnd=Handle
  Button\uId=Handle
  Button\lpszText=@Text$
  SendMessage_(ToolTipControl,$0404,0,Button)
EndProcedure
 
If OpenWindow(0, 200, 200, 320, 240, #PB_Window_SystemMenu | #PB_Window_MaximizeGadget, "ToolTip example")
 
   CreateGadgetList(WindowID())
   hButt=ButtonGadget(1, 110,60, 100, 100, "Button")
   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
 
EndIf
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..

cya,
...Danilo
(registered PureBasic user)

Posted: Fri Aug 30, 2002 9:16 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

Your code did not function as expected on XP. No tooltip at all but no errors either

Fangles

Posted: Fri Aug 30, 2002 9:59 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Try to change

Code: Select all

Button.TOOLINFO\cbSize=40
to

Code: Select all

Button.TOOLINFO\cbSize=44 ; SizeOf( TOOLINFO )
Sorry, but its a mess to read and change
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)

Posted: Fri Aug 30, 2002 12:59 pm
by BackupUser
Restored from previous forum. Originally posted by traumatic.

just wanted to add the following info:

TTS_BALLOON is only supported by 'comctl32.dll' v5.80 or higher. well, this isn't a problem but it still means that not everyone will be able to see these balloon-style tooltips.

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

Posted: Fri Aug 30, 2002 1:42 pm
by BackupUser
Restored from previous forum. Originally posted by TerryHough.

Thanks Franco and Danillo,

I thought there had to be a way to do this.

Any suggestions, book or website, to learn more about
using the API for such items and their
parameters?

Appreciate everyones help to a "newbie"

Terry