Transparency for listboxes, so they would work with OSX 10.10 vibrancy?

Is there a way to make a listbox transparent, so that only the text is displayed but no background color?

I have a listbox in the navigation area and I would like it to display text only and inherit its background from the underling (virbrant) Window (on OSX Yosemite)

Is there a declare or any other way which would allow us to make a listbox transparent?

For that I would almost say for certain: not possible. :slight_smile:
You could use the dtListbox (native ‘listbox’) - http://www.dethomsoft.com/DtPlugins.html

AFAIK, you got two choices…

Fake it with a canvas and scrollbar.
Use a real NSTableView.

I choose the first option!

No, but you could file a feature request asking for ListBox to play nicer with vibrancy.

[quote=140788:@Joe Ranieri]No, but you could file a feature request asking for ListBox to play nicer with vibrancy.
[/quote]

I already think there is a long standing feature request for making the Listbox native. :wink:

You could fake it… using declares to get a screenshot behind the window and use CIFilters to do the blending, then draw the corresponding portion in CellBGPaint… pretty major workaround though for an appearance.

The native effect is a NSVisualEffectView
It basically does what I outlined above, but within the Cocoa framework.
I wonder if you could place an NSVisualEffectView under the listbox and draw it into a picture, and use that to fill the cells… hmm

[quote=140821:@jim mckay]You could fake it… using declares to get a screenshot behind the window and use CIFilters to do the blending, then draw the corresponding portion in CellBGPaint… pretty major workaround though for an appearance.

The native effect is a NSVisualEffectView
It basically does what I outlined above, but within the Cocoa framework.
I wonder if you could place an NSVisualEffectView under the listbox and draw it into a picture, and use that to fill the cells… hmm[/quote]

This sounds very slow and like a lot of work.

A listbox with a background transparent option would rock. And make that trivial. Does it sound possible ?

Yes… I’m wondering though if using cacheDisplayInRect:toBitmapImageRep: when the drawRect: selector is called would be faster. Only problem being that if the view is below the listbox, it might not draw anything at all, and then bleh…

I’d recommend filing a feature request.

36389 - ListBox transparent background option
<https://xojo.com/issue/36389>

Not at my computer right now, so I can’t check Feedback, I think a better solution would be to request that listbox is based upon a NSTableView, then it would be trivial to support the correct display modes, scroll view etc etc.

But would it then be possible to have all the current events and be as consistent Xplatform?

  • Karen

Yes its been in feedback since 2009…
(https://xojo.com/issue/7836)]Feeback Case #7836

[quote=140897:@Karen Atkocius]But would it then be possible to have all the current events and be as consistent Xplatform?

  • Karen[/quote]
    That’s why we use Xojo, so we don’t have to worry about that :slight_smile:

Darn it, you replied before I could fix my spelling of feedback. :frowning:

[quote=140821:@jim mckay]You could fake it… using declares to get a screenshot behind the window and use CIFilters to do the blending, then draw the corresponding portion in CellBGPaint… pretty major workaround though for an appearance.

The native effect is a NSVisualEffectView
It basically does what I outlined above, but within the Cocoa framework.
I wonder if you could place an NSVisualEffectView under the listbox and draw it into a picture, and use that to fill the cells… hmm[/quote]
I wouldn’t recommend trying to replicate Apple’s vibrancy process, in the past I’ve faked a great deal of controls only to run into issues with them. Using the genuine controls wherever possible is going to cause the least amount of headaches (he says).

Using CoreAnimation (you can attach a string of CoreImage effects to a NSView) it would be possible to replicate their process, except for one thing… That’s obtaining the correct section of the background picture, cacheDisplayInRect:toBitmapImageRep: I don’t think would help here as you still need to break through into the desktop layer (which you can do with some declares and some math) and providing the user is using a standard OS X desktop picture, if not then this won’t work in the App Sandbox.

Meanwhile, signing on the feedback request for a genuine NSTableView will not only solve this problem, but it will empower the listbox beyond belief on OS X, while still maintaining Win32 compatibility (and Linux too).

As I mentioned earlier, we have faked it by using a genuine NSVisualEffectView on 10.10 and the background of a NSTableView on 10.9, then used a canvas to create a listbox. This works with minimal effort, but it’s not as correct as using a NSTableView (which of course requires a heck of a lot more work and is only for OS X).

@Oliver Osswald Can you massage the Enihugur tableview to make it replicate what you use the listbox for?

[quote=140911:@Sam Rowlands]<…>
@Oliver Osswald Can you massage the Enihugur tableview to make it replicate what you use the listbox for?[/quote]
Yes, I guess in my case I could use the treeview instead of the listbox and write a wrapper which mimics the behavior of the listbox, as far as I use it.

A whole lot of work for a little bit of appearance …

But then I think that the standard listbox is the official Xojo control which allows us for building a navigator. And according to the latest OSX Human Interface Guidelines, vibrancy is expected there : (Color and Typography)

So, adding my points to the feedback cases:

1.) NSTableViewSupport: <https://xojo.com/issue/7836>
2.) Transparent Background option: <https://xojo.com/issue/36389>

IMHO NSTableViewSupport is the smartest option, once the OS X Listbox is based on NSTableView we’ll get the correct scrolling and access to much more functionality. Asking Xojo to patch their custom listbox for transparency might be quicker as of now, but will still be lacking in other areas.

Apple’s sole recommendation for Vibrancy is to use a NSTableView or NSOutlineView as it will provide the correct blue gradient on 10.9 and Vibrancy on 10.10.

There is a third party plugin for NSTableView already existing, but I don’t know if it has a Windows counterpart, so that makes it harder to use one code base for multiple OSes.

NSTableView will not be cross platform so it would require wrapping up it’s properties and events so they comply to Xojo set. Given that restriction, and with the use of conditional compilation, that looks feasible. At that point the Mac OS version could support vibrancy, while it would not ruin the Windows side.

Ideally, the transparent background option would allow much more on a cross platform basis.