Code: Select all
Procedure MyBalloonToolTips(btWindow.l, btText.s)
httip = CreateWindowEx_(0, "ToolTips_Class32", "", #WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON |#TTS_ALWAYSTIP, 0, 0, 0, 0, WindowID(btWindow), 0, GetModuleHandle_(0), 0)
SetWindowTheme_(httip, @null.w, @null.w)
ttip.TOOLINFO\cbSize = SizeOf(TOOLINFO)
SendMessage_(httip, #TTM_SETTIPTEXTCOLOR,$2E35FE, 0)
SendMessage_(httip, #TTM_SETTIPBKCOLOR, $C8FEFE, 0)
ttip\uFlags = #TTF_SUBCLASS
ttip\hwnd = WindowID(btWindow)
ttip\uID = WindowID(btWindow)
SetRect_(@ttip\rect, 20,-25,80,20)
ttip\lpszText = @btText
SendMessage_(httip, #TTM_ADDTOOL, 0, ttip)
EndProcedure
If OpenWindow(0,0,0,140,120,"test",#PB_Window_SystemMenu| #PB_Window_ScreenCentered)
MyBalloonToolTips(0,"test")
SetActiveWindow(0)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
EndIf
Code: Select all
Global TTip,TTip2
#TTS_BUBBLE = $40
#TTF_TRACK = $20
#TTF_ABSOLUTE = $80
Procedure GadToolTip(Gadget,Tip$)
ti.TOOLINFO
ti\cbSize = SizeOf(ti)
ti\hInst = GetModuleHandle_(0)
ti\uFlags = #TTF_IDISHWND | #TTF_SUBCLASS
ti\hwnd = GadgetID(Gadget)
ti\uId = GadgetID(Gadget)
ti\lpszText = @Tip$
SendMessage_(TTip, #TTM_ADDTOOL, 0, ti)
EndProcedure
Procedure TTip_Command(x,y,dTime,Title$,Tip$,Icon)
ti2.TOOLINFO
ti2\cbSize = SizeOf(ti2)
ti2\hInst = GetModuleHandle_(0)
ti2\uFlags = #TTF_TRACK | #TTF_ABSOLUTE
ti2\lpszText = @Tip$
SendMessage_(TTip2, #TTM_ADDTOOL, 0, ti2)
SendMessage_(TTip2,#TTM_SETTOOLINFO,0,ti2)
SendMessage_(TTip2, #TTM_SETTITLE, Icon, @Title$)
SendMessage_(TTip2,#TTM_TRACKPOSITION,0,x+y<<16)
SendMessage_(TTip2,#TTM_TRACKACTIVATE,1,ti2)
SendMessage_(TTip2,#TTM_TRACKPOSITION,0,x + 50 + y<<16)
Delay(dTime)
SendMessage_(TTip2,#TTM_TRACKACTIVATE,0,ti2)
EndProcedure
TTip = CreateWindowEx_(#WS_EX_TOPMOST, "tooltips_class32", 0, #TTS_ALWAYSTIP| #TTS_NOPREFIX| #WS_POPUP| #TTS_BUBBLE,0,0,0,0, 0, 0, GetModuleHandle_(0), 0)
SetWindowTheme_(TTip, @null.w, @null.w)
SendMessage_(TTip,#TTM_SETTIPTEXTCOLOR,$0202FD,0)
SendMessage_(TTip,#TTM_SETTIPBKCOLOR,$DCFFFF,0)
TTip2 = CreateWindowEx_(#WS_EX_TOPMOST, "tooltips_class32", 0, #TTS_ALWAYSTIP| #TTS_NOPREFIX| #WS_POPUP| #TTS_BUBBLE,0,0,0,0, 0, 0, GetModuleHandle_(0), 0)
SetWindowTheme_(TTip2, @null.w, @null.w)
SendMessage_(TTip2,#TTM_SETTIPTEXTCOLOR,$0202FD,0)
SendMessage_(TTip2,#TTM_SETTIPBKCOLOR,$DCFFFF,0)
If OpenWindow(0, 0, 0, 300, 300, "Tooltips by Command",#PB_Window_ScreenCentered| #PB_Window_SystemMenu)
ButtonGadget(0,10,10,80,20,"TEST # 0")
GadToolTip(0,"This is a test for"+#CRLF$+"Multiline Balloon")
ButtonGadget(1,10,40,80,20,"TEST # 1")
GadToolTip(1,"Gadget # 1 Tooltip")
StringGadget(2,10,70,120,20,"This is a test")
GadToolTip(2,"Gadget # 2 Tooltip")
ButtonGadget(3,10,260,80,20,"Title Bar")
ButtonGadget(4,100,260,80,20,"TEST 1")
AddWindowTimer(0,100,100)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Timer
x = DesktopMouseX()
y = DesktopMouseY()
If x > WindowX(0) And x < WindowX(0) + 80 And y > WindowY(0) And y < WindowY(0)+20
TTip_Command(WindowX(0)-20,WindowY(0)+20,1500,"Hi","This is a test for"+#CRLF$+"Multiline Balloon",#TOOLTIP_WARNING_ICON)
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case 3
x = WindowX(0)-20
y = WindowY(0)+10
TTip_Command(x,y,1500,"Hi","This is a test for"+#CRLF$+"Multiline Balloon",#TOOLTIP_WARNING_ICON)
Case 4
x = GadgetX(1,#PB_Gadget_ScreenCoordinate)
y = GadgetY(1,#PB_Gadget_ScreenCoordinate)
TTip_Command(x,y,1500,"Remember","Gadget # 1 Tooltip",#TOOLTIP_INFO_ICON)
EndSelect
EndSelect
Until Quit = 1
End
EndIf