macoslib toolbar button feedback?

Hi,
In the macoslib toolbar example - when you click on a toolbar button, it changes colour slightly (just for a split second) and then returns to normal.
This provides feedback to the user that the button has been clicked on.

Could someone please help me regarding where the code is which does this.
I have a macoslib toolbar in my app - but no visual feedback happens when the button items are clicked on.

All my buttons work perfectly, but the image state does not change for the split second that the mouse button is depressed.

Thank you all in advance.

I believe that feedback is part of how NSToolbarItems are. Are you doing anything custom with your toolbar items?

Nope.

[quote=129063:@Richard Summers]In the macoslib toolbar example - when you click on a toolbar button, it changes colour slightly (just for a split second) and then returns to normal.
This provides feedback to the user that the button has been clicked on.[/quote]

I do not see anything special beyond the normal darker clicked state of the icon while the mouse button is down. If you maintain the button pressed, all the regular icons get darker, except “Fonts”.

Is it another effect you see, and on which button ?

Of course, one could “flash” the icon by changing it to a lighter picture shortly in the Action event. But it seems redundant with the clicked state.

Michel, yes, I am talking about the darkened click state that you described.
This does not happen in my app, and I would like to know how it is achieved.

I have plain black toolbar button icons, and cannot detect any change during the clicked state.

If your icons are black you’re not going to see them get darker.

Tim - you have a knack for stating the obvious! :slight_smile:
Did you read my original post - I was asking where the code is which causes this change in image, as I need to provide some kind of feedback.

Alternatively, does anyone have any example code which changes or temporarily disables a macoslib toolbar button image?
Thank you all.

[quote=129087:@Richard Summers]Tim - you have a knack for stating the obvious! :slight_smile:
Did you read my original post - I was asking where the code is which causes this change in image, as I need to provide some kind of feedback.

Alternatively, does anyone have any example code which changes or temporarily disables a macoslib toolbar button image?
Thank you all.[/quote]
The code is inside AppKit.framework, and to disable an item you’re looking for however macoslib handles setEnabled:

Are you saying that it is not possible to disable a toolbar menu button? Or do you mean that I need to use setEnabled = false?

Thanks.

It is fairly easy in a Xojo Toolbar, it is possible in an NSToolbar but you need to be knowledgeable of the Cocoa framework since the function you want is not part of the MacOSLib example.

Since the clicked state is automatic, would it not be possible to use another color than black for your buttons ? That would be the easiest. Or make the button icons slightly smaller by one pixel or two over a transparent background, so when they are clicked, they appear to grow.

Guess I will have to re-color my images :frowning:
Thank you all vey much!

As a late addition: I couldn‘t find anything in NSToolbar that changes the look of the icons. They are forwarded to the NSToolbar as Strings and their button representations are built invisibly to the programmer – at least to my first look onto it.
I could find such behavior anyhow in the NSCellattribute class and it wouldn‘t surprise me if passing toolbar item strings to the Toolbar method adds them as such – but I am not sure how to address them yet.

Maybe you‘d like to have a look at https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCell_Class/Reference/NSCell.html#//apple_ref/doc/uid/20000074-BBCCBGBA
especially the setCellAttribute:To: method and its enumeration
NSCellAttribute
These constants specify how a button behaves when pressed and how it displays its state. These constants are used by the NSButton and NSButtonCell classes

Is the behavior described under its definitions what you are looking for?