Tailbite Bug ?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Tailbite Bug ?

Post by Droopy »

The function ToolTipShow don't works when compiled with Tailbite / purebasic 3.94 ( Works with tailbite / PureBasic 3.93 )

Code: Select all

;/ Author : Andre / Balatro / Berikco

; ToolTipAdd
; Type : 0 = Balloon Tip / 1 Square Tip
; MaxWidth : Max Width of the ToolTip
; Icon : 0 (no Icon) / 1 (information icon) / 2 (warning icon) / 3 (error icon) 

ProcedureDLL ToolTipAdd(Type,MaxWidth,WindowID, Gadget, Text$ , Title$, Icon,TextColor,BKColor,Font.s,FontSize) 
  
  ;/ Initialise le Tableau au premier appel
  Static Initialised
  If Initialised=0
    Dim PtrToolTip(500)
    Initialised=1
  EndIf
  
  
  If Type=0 ;/ Ballon
    Type=#WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON
  Else      ;/ Or Square
    Type=#WS_POPUP | #TTS_NOPREFIX
  EndIf
  
  If TextColor=0 : TextColor=GetSysColor_(#COLOR_INFOTEXT) : EndIf
  If BKColor=0 : BKColor=GetSysColor_(#COLOR_INFOBK) : EndIf
  ToolTip=CreateWindowEx_(0,"ToolTips_Class32","",Type,0,0,0,0,WindowID(WindowID),0,GetModuleHandle_(0),0) 
  SendMessage_(ToolTip,#TTM_SETTIPTEXTCOLOR,TextColor,0) 
  SendMessage_(ToolTip,#TTM_SETTIPBKCOLOR,BKColor,0) 
  SendMessage_(ToolTip,#TTM_SETMAXTIPWIDTH,0,MaxWidth) 
  Balloon.TOOLINFO\cbSize=SizeOf(TOOLINFO) 
  Balloon\uFlags= #TTF_IDISHWND | #TTF_SUBCLASS
  Balloon\hWnd=WindowID(WindowID) 
  Balloon\uId=GadgetID(Gadget) 
  Balloon\lpszText=@Text$ 
  ;/ Fonts
  If Font>""
    LoadFont(#PB_Any, Font, FontSize); : UseFont(1) 
    SendMessage_(ToolTip, #WM_SETFONT, FontID(), #True) 
  EndIf
  
  SendMessage_(ToolTip, #TTM_ADDTOOL, 0, Balloon) 
  If Title$ > "" 
    SendMessage_(ToolTip, #TTM_SETTITLE, Icon, @Title$) 
  EndIf 
  PtrToolTip(Gadget)=ToolTip
EndProcedure 

ProcedureDLL ToolTipRemove(Gadget.l) 
  ttRemove.TOOLINFO\cbSize = SizeOf(TOOLINFO) 
  ttRemove\hWnd = WindowID() 
  ttRemove\uId = GadgetID(Gadget) 
  SendMessage_(PtrToolTip(Gadget), #TTM_DELTOOL, 0, ttRemove) 
EndProcedure 

ProcedureDLL ToolTipChange(Gadget.l, Text$) 
  ttChange.TOOLINFO\cbSize = SizeOf(TOOLINFO) 
  ttChange\hWnd = WindowID() 
  ttChange\uId = GadgetID(Gadget) 
  ttChange\lpszText = @Text$ 
  SendMessage_(PtrToolTip(Gadget), #TTM_UPDATETIPTEXT, 0, ttChange) 
EndProcedure 

ProcedureDLL ToolTipShow(Gadget.l,x,y)
  ttChange.TOOLINFO\cbSize = SizeOf(TOOLINFO) 
  ttChange\hWnd = WindowID() 
  ttChange\uId = GadgetID(Gadget)   
  SendMessage_(PtrToolTip(Gadget), #TTM_TRACKACTIVATE, 1, ttChange) 
  SetWindowPos_(PtrToolTip(Gadget), 0, x, y, -1, -1, #SWP_NOSIZE | #SWP_NOZORDER | #SWP_SHOWWINDOW | #SWP_NOACTIVATE) 
EndProcedure

ProcedureDLL ToolTipHide(Gadget.l)
  ttChange.TOOLINFO\cbSize = SizeOf(TOOLINFO) 
  ttChange\hWnd = WindowID() 
  ttChange\uId = GadgetID(Gadget)  
SendMessage_(PtrToolTip(Gadget), #TTM_TRACKACTIVATE, 0,ttChange) 

EndProcedure

;/
;/ LIBRARY TEST
;/

Procedure BackGroundTask()
  Repeat
    ToolTipChange(0,FormatDate("%hh:%ii:%ss", Date()))
    Delay(1000)
  ForEver
EndProcedure

OpenWindow(0,0,0,270,160,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"GadgetTooltip") 
CreateGadgetList(WindowID(0))
ButtonGadget(0,10,5,250,30,"Show/Hide ToolTip")
ButtonGadget(1,10,40,250,30,"Button 2")
ButtonGadget(2,10,75,250,30,"Button 3")
ButtonGadget(3,10,110,250,30,"Button 4")
ButtonGadget(4,0,0,0,0,"") ;/ Hidden Button
ToolTipAdd(0,200,0,0,"Tooltip n°1","ClockTip",0,RGB(255,255,0),RGB(255,0,0),"Comic sans ms",34)
ToolTipAdd(0,200,0,1,"This is a text","Tooltip n°2",3,0,0,"",0)
ToolTipAdd(0,200,0,2,"TOOLTIP 3"+#CRLF$+"MULTILINE"+#CR$+"    INPUT","",0,RGB(0,0,255),RGB(255,255,255),"impact",25)
ToolTipAdd(1,200,0,3,"This is a text","ToolTip n°4",1,RGB(100, 128, 128),RGB(128, 255, 128),"",0)
ToolTipAdd(1,300,0,4,"This is a multiline"+#CR$+"Tooltip and i can write"+#CR$+"what i want !","",0,0,65535,"Arial",12)

CreateThread(@BackGroundTask(),0)
Repeat
  temp=WaitWindowEvent()
  If temp=#PB_Event_Gadget And EventGadgetID()=0 And EventType()=#PB_EventType_LeftClick  
        Temp2=Not(Temp2)
        If Temp2
          ToolTipShow(4,512,384)
        Else
          ToolTipHide(4)
        EndIf
  EndIf
Until temp=#PB_Event_CloseWindow
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

I'll check this, thx and sry for the inconvenience.

Regards,
El_Choni
User avatar
Techie42
User
User
Posts: 58
Joined: Sun Oct 30, 2005 12:28 pm
Location: UK (Berkshire)

Possibly...

Post by Techie42 »

Hi,

I have just been using Droopy's lib to add tooltips to a control, and I noticed a problem.

If Droopy's library contains the same code that has been posted in the forums here, such as :

Code: Select all

Dim PtrToolTip(500)
Then, I believe, a problem occurs when "#PB_Any" is used as an index number, as the index number / gadget ID is used as the index to the array.

#PB_Any returns index numbers over 500, and so the array mentioned above is not large enough.

I have checked this by specifying an index number below 500 and then over 500; over 500 causes a program crash.

I'm not sure if this helps, but this is the problem I have experienced WITHOUT TailBite.
If the temperature today was 0 degrees, how can it be twice as cold tomorrow?
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

thanks, i look @ this
User avatar
Techie42
User
User
Posts: 58
Joined: Sun Oct 30, 2005 12:28 pm
Location: UK (Berkshire)

BTW...

Post by Techie42 »

Hi Droopy,

While I think about it, I also noticed a strange quirk...I'm not sure if this is how Tooltips usually work under Windows...I've never really thought about it.

However, when I create a ButtonGadget (or several) and then use your library to assign Tooltips, when I then click on a button, the Tooltip never returns.

I have also tried this using the standard GadgetTooltip command, and the same effect occurs.

Maybe this is Windows, or maybe this is PB...not sure...but I'm deferring to you as a much greater expert than I :wink:

Thanks again.
If the temperature today was 0 degrees, how can it be twice as cold tomorrow?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

>> Maybe this is Windows, or maybe this is PB...not sure
it's a windows XP feature :lol:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

when I then click on a button, the Tooltip never returns
I think it's a XP future
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Damn our anti-droopy agreement just expired with ElChoni.. but hopefully we'll get to send him a new check anytime soon!.
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Post Reply