Page 1 of 1
StatusBar & #SB_SETTIPTEXT
Posted: Wed Dec 14, 2011 11:00 pm
by User_Russian
Why is not the tool tip?
Code: Select all
#SBT_TOOLTIPS = $800
#SB_SETICON = #WM_USER + 15
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
If OpenWindow(0, 0, 0, 400, 100, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hSB=CreateStatusBar(0, WindowID(0))
SetWindowLongPtr_(hSB, #GWL_STYLE,GetWindowLongPtr_(hSB, #GWL_STYLE)|#SBT_TOOLTIPS)
AddStatusBarField(40)
AddStatusBarField(40)
StatusBarImage(0, 1, ImageID(0))
SendMessage_(hSB, #SB_SETTIPTEXT, 1, @"ToolTip")
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
If StatusBar created using WinAPI, then there is a hint.
Code: Select all
#SBT_TOOLTIPS = $800
#SB_SETICON = #WM_USER + 15
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
If OpenWindow(0, 0, 0, 400, 100, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hSB=CreateWindowEx_(0,"msctls_statusbar32","",#WS_VISIBLE|#WS_CHILD|#SBT_TOOLTIPS, 0, 300, 100, 24, WindowID(0),0,0,0)
z.q=$008000000040
SendMessage_(hSB, #SB_SETPARTS, 2, @z)
SendMessage_(hSB, #SB_SETICON, 1, ImageID(0))
SendMessage_(hSB, #SB_SETTIPTEXT, 1, "ToolTip")
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
What should I do to work with the tool tip CreateStatusBar()?
Re: StatusBar & #SB_SETTIPTEXT
Posted: Wed Dec 14, 2011 11:50 pm
by IdeasVacuum
I could be wrong but I think the PB Status bar might be 'home grown', perhaps for cross-platform purposes. If so, that would explain why the tooltips fail. If your app is Windows only, then you have already found your solution. I can't think of a reasonable work-around, though I wouldn't mind betting that netmaestro would have a good idea. Perhaps placing a transparent gadget over the top of the StatusBar - sounds really clumsy, but then only you would know it was there..... The other possibility would be a balloon type tip, either API or DIY (2D sprite), and track the mouse cursor position.
Re: StatusBar & #SB_SETTIPTEXT
Posted: Thu Dec 15, 2011 12:24 am
by skywalk
From ts-soft...use a container + textgadget + resize for a statusbar.
Code: Select all
OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "Statusbar Dummy", #PB_Window_SizeGadget | #PB_Window_SystemMenu)
ContainerGadget(0, 0, 0, 0, 0, #PB_Container_Single)
LoadFont(0, "Consolas", 12)
StringGadget(1, 1, 1, 180, 24, "Status", #PB_String_BorderLess | #PB_Text_Center)
SetGadgetFont(1, FontID(0))
SetGadgetColor(1,#PB_Gadget_BackColor,RGB(219, 175, 175))
GadgetToolTip(0, "I'm a Statusbar!")
GadgetToolTip(1, "I'm a Statusbar Entry!")
CloseGadgetList()
ResizeGadget(0, 0, WindowHeight(0) - 24, WindowWidth(0), 24)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_SizeWindow
ResizeGadget(0, 0, WindowHeight(0) - 24, WindowWidth(0), 24)
EndSelect
ForEver
Re: StatusBar & #SB_SETTIPTEXT
Posted: Thu Dec 15, 2011 2:50 am
by netmaestro
It's a normal windows statusbar control alright, there's nothing special being done with it by PB. The code as presented is written correctly but there is one factor keeping it from working: Some control styles cannot be added in after creation and this is one of them. Best thing to do here imho is put in a feature request for statusbar tooltips.
Re: StatusBar & #SB_SETTIPTEXT
Posted: Thu Dec 15, 2011 10:38 am
by User_Russian
Used to display icons ImageGadget in the status bar.
Code: Select all
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
If OpenWindow(0, 0, 0, 400, 100, "", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
hSB=CreateStatusBar(0, WindowID(0))
AddStatusBarField(40)
AddStatusBarField(40)
hList=UseGadgetList(hSB)
ImageGadget(0, 44, 2, 16, 16,ImageID(0))
GadgetToolTip(0,"ToolTip")
UseGadgetList(hList)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Re: StatusBar & #SB_SETTIPTEXT
Posted: Thu Dec 15, 2011 2:48 pm
by RASHAD
Code: Select all
Global Tip
LoadImage(0,#PB_Compiler_Home+"Examples\Sources\Data\CdPlayer.ico")
If OpenWindow(0, 0, 0, 400, 300, "StatusBar ToolTip", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget| #PB_Window_SizeGadget|#PB_Window_ScreenCentered)
hSB=CreateStatusBar(0, WindowID(0))
SendMessage_(hSB, #SB_SETMINHEIGHT, 30, 0)
SendMessage_(hSB, #WM_SIZE, 0,0)
AddStatusBarField(40)
AddStatusBarField(40)
StatusBarImage(0, 0, ImageID(0))
StatusBarImage(0, 1, ImageID(0))
Tip = CreateWindowEx_(0,"ToolTips_Class32","",#WS_POPUP | #TTS_NOPREFIX ,0,0,0,0,0,0,GetModuleHandle_(0),0)
SendMessage_(Tip, #TTM_SETDELAYTIME, #TTDT_INITIAL, 10)
SendMessage_(Tip, #TTM_SETDELAYTIME, #TTDT_AUTOPOP, 1000)
ti.TOOLINFO
ti\cbSize = SizeOf(TOOLINFO);
ti\uFlags = #TTF_IDISHWND | #TTF_SUBCLASS
ti\uId=hSB
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #WM_MOUSEMOVE
x = WindowMouseX(0)
If x > 0 And x < 40
ti\lpszText = @"Tool #1"
SendMessage_(Tip, #TTM_ADDTOOL, 0, ti)
ElseIf x > 40 And x < 80
ti\lpszText = @"Tool #2"
SendMessage_(Tip, #TTM_ADDTOOL, 0, ti)
ElseIf x > 80
ti\lpszText = @"Tool #3"
SendMessage_(Tip, #TTM_ADDTOOL, 0, ti)
EndIf
EndSelect
Until Quit = 1
EndIf
Edit: Modified