srod wrote:
Code: Select all
TT = CreateWindowEx_(0, "Tooltips_Class32", "", #TTS_ALWAYSTIP|#TTS_BALLOON, 0, 0, 0, 0, WindowID(0), 0, 0, 0)
Thanks, srod!
Now it works nice (deleted my SetWindowPos_ already, see below :roll:) and is a fine, short - and working - code!
I thought, StickyWindows will do exactly the same like SetWindowPos, so I didn't feal bad
A feel a little bit more uncomfortable with my SendMessage() line in the Callback routine, can you give me a nice hint for that as well?
Code: Select all
Global InfoText.s
Global InfoID
Global InfoMessage.MSG
Global *InfoStruct.NMHDR
Global *InfoText.TOOLTIPTEXT
Global Callback
Global OnTop=#True
Procedure Callback(WindowID,Message,wParam,lParam)
Select Message
Case #WM_SYSCOMMAND
If wParam=#SC_MAXIMIZE
Callback=1
ProcedureReturn 0
EndIf
Case #WM_MOUSEMOVE
InfoMessage\hwnd=WindowID
InfoMessage\message=Message
InfoMessage\wParam=wParam
InfoMessage\lParam=lParam
SendMessage_(InfoID,#TTM_RELAYEVENT,0,InfoMessage)
Case #WM_NOTIFY
*InfoStruct=lParam
If *InfoStruct\code=#TTN_NEEDTEXT
*InfoText=lParam
z=*InfoText\hdr\idFrom
SendMessage_(InfoID,#TTM_SETTITLE,z%4,"Icon")
InfoText="Text "+Str(z)
*InfoText\lpszText=@InfoText
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
xsize=300
ysize=200
Anzahl=8
OpenWindow(0,40,40,xsize,ysize," Michael Vogel's Ping Utility ",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget |#PB_Window_MaximizeGadget)
InfoID=CreateWindowEx_(0,"Tooltips_Class32","",#TTS_ALWAYSTIP|#WS_EX_TOPMOST,0,0,0,0,WindowID(0),0,0,0);#TTS_BALLOON
;InfoID=CreateWindowEx_(0,"Tooltips_Class32","",#TTS_ALWAYSTIP|#WS_EX_TOPMOST|#TTS_BALLOON,0,0,0,0,0,0,0,0)
SendMessage_(InfoID,#TTM_SETMAXTIPWIDTH,0,200)
SendMessage_(InfoID,#TTM_SETTITLE,1,"SNMP Informationen")
InfoTool.TOOLINFO
InfoTool\cbSize=SizeOf(TOOLINFO)
InfoTool\uFlags=#TTF_CENTERTIP
InfoTool\hwnd=WindowID(0)
InfoTool\lpszText=#LPSTR_TEXTCALLBACK
CreateGadgetList(WindowID(0))
For i=1 To Anzahl
TextGadget(i,0,20*i,200,18,"Icon "+Str(i%4)+", Text "+Str(i),#PB_Text_Border)
InfoTool\uId=i
SetRect_(@InfoTool\rect,0,20*i,200,20*i+18)
SendMessage_(InfoID,#TTM_ADDTOOL,0,InfoTool)
Next i
StickyWindow(0,OnTop)
;SetWindowPos_(InfoID,#HWND_TOPMOST,0,0,0,0,#SWP_NOREDRAW|#SWP_NOMOVE|#SWP_NOSIZE); ****
SetWindowCallback(@callback(),0)
Define event.l
Repeat
Event=WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
exit=99
Case #WM_PAINT
; WriteAll()
EndSelect
If Callback
Callback=0
OnTop=1-OnTop
StickyWindow(0,OnTop); ****
EndIf
Until exit
Huiii - checked the program on an old notebook (WinXP) and a tooltip starts from transparent to not so transparent and before anything is really readable it fades away slowly, whats going on here
At least, the fade in is gone (with the following change) - but the fade out effect is still present
Code: Select all
#TTS_NOFADE=$20
#TTS_NOANIMATE=$10
InfoID=CreateWindowEx_(0,"Tooltips_Class32","",#TTS_ALWAYSTIP|#TTS_NOFADE|#TTS_NOANIMATE|#WS_EX_TOPMOST,0,0,0,0,0,0,0,0);#TTS_BALLOON
Added:
The actual state of my small Ping utility is here:
http://sudokuprogram.googlepages.com/vping.zip
On the left side (IP-addresses) I use the tooltip to see the name and type of the device (if available)...
Still fighting with some issues: fading is still present (and slow) and changing the title with sendmessage means wrong titles from time to time...