Toolbar Event
Toolbar Event
Does anybody know how to receive a event from a Toolbarbutton?
I want to display some text in a Statusbar when a Toolbarbutton is focused.
I'm using the PB Standard Toolbar. Thanks for any suggestions.
I want to display some text in a Statusbar when a Toolbarbutton is focused.
I'm using the PB Standard Toolbar. Thanks for any suggestions.
Windows 7 & PureBasic 4.4
Keep in mind that status bars are for showing status and not tooltips.
This is the closest I get.
This is the closest I get.
Code: Select all
Procedure Callback(WindowID, Message, wParam, lParam)
Protected Result = #PB_ProcessPureBasicEvents
If Message = #WM_NOTIFY
StatusBarText(0, 0, "Toolbar hover")
EndIf
ProcedureReturn Result
EndProcedure
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
SmartWindowRefresh(0, 1)
CreateGadgetList(WindowID(0))
CreateToolBar(0, WindowID(0))
ToolBarStandardButton(0, 0)
ToolBarStandardButton(1, 1)
ToolBarStandardButton(2, 2)
ToolBarStandardButton(3, 3)
ToolBarStandardButton(4, 4)
CreateStatusBar(0, WindowID(0))
SetWindowCallback(@Callback())
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
Break
Case 675
StatusBarText(0, 0, "")
EndSelect
ForEver
You can always use the #TB_GETHOTITEM message in combination with #WM_MOUSEMOVE.
The following conversion of Danillo's ToolBar pro library to PB source shows how it might be done. (See example program 1 or indeed the source for the nxMouseOverTBbutton() function.)
http://www.purebasic.fr/english/viewtop ... =nxtoolbar
The following conversion of Danillo's ToolBar pro library to PB source shows how it might be done. (See example program 1 or indeed the source for the nxMouseOverTBbutton() function.)
http://www.purebasic.fr/english/viewtop ... =nxtoolbar
Last edited by srod on Tue May 15, 2007 4:13 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
It's not at all uncommon for an application to show a brief tooltip giving the name of the command, and a more detailed usage message on the statusbar. This is especially handy when button functionality changes due to context or the application of modifier keys (shift, alt, etc.). There is absolutely nothing wrong with using the statusbar in this way.Trond wrote:Keep in mind that status bars are for showing status and not tooltips.
1. Not uncommon <> Goodr_hyde wrote:It's not at all uncommon for an application to show a brief tooltip giving the name of the command, and a more detailed usage message on the statusbar. This is especially handy when button functionality changes due to context or the application of modifier keys (shift, alt, etc.). There is absolutely nothing wrong with using the statusbar in this way.Trond wrote:Keep in mind that status bars are for showing status and not tooltips.
2. If button functionality changes due to context then the user interface is seriously flawed and needs a re-design and a new UI designer.
3. Toolbar buttons are short-cuts for menu items. The Windows Vista User Experience Guidelines explicitly says to not use the status bar for explaining menu items: "Don't use the status bar to explain menu bar items."
In wxWidgets, a popular C++ UI Framework, a Statusbar is always
used to explain the Toolbar Items.
used to explain the Toolbar Items.
That's Microsofts opinion3. Toolbar buttons are short-cuts for menu items. The Windows Vista User Experience Guidelines explicitly says to not use the status bar for explaining menu items: "Don't use the status bar to explain menu bar items."

Windows 7 & PureBasic 4.4
Just as uncommon <> bad. There's no absolute standard here.Trond wrote:1. Not uncommon <> Good
It might be flawed, or maybe not. Again, this is not an absolute--it depends upon the purpose and design of the application, and upon how thoughtfully the idea is employed. Under the right conditions, context-aware controls can make for a powerful, flexible, and intuitive interface. Otherwise, I'll concede it's possible that they might only confuse the user. If you're going to use the paradigm, though, one good step to avoiding end-user confusion is to provide some kind of indication--a status message, perhapsTrond wrote:2. If button functionality changes due to context then the user interface is seriously flawed and needs a re-design and a new UI designer.

As for #3, I can only echo what milan1612 said.
Yeah, it' better to use TOOLTIPS for that.Trond wrote: ...The Windows Vista User Experience Guidelines explicitly says to not use the status bar for explaining menu items: "Don't use the status bar to explain menu bar items."
Usage:
Move mouse cursor over a toolbar button.
It just takes a few seconds to show the tooltip....
Here it is.
Thanks to the tooltip, now I know it's the wrong toolbar button.
Try next toolbar button...
It just takes a few seconds to show the tooltip....
Here it is.
Thanks to the tooltip, now I know it's the wrong toolbar button.
Try next toolbar button...
In the statusbar the hint/tip is instantaneous.
Way better "User Experience"

It's their operating system...milan1612 wrote:That's Microsofts opinion
fsw, if you can't see what the toolbar buttons does from their image, then the image is not good enough and might as well be replaced with a text-only button. This will enable you to know what it does without moving your mouse over it. WAY better user experience. Especially if you have difficulties using a mouse because you are somehow disabled.