MBS examples for Any examples for using NSAppearanceMBS, NSVisualControlMBS and NSVisualEffectViewMB

It seems Christian isn’t willing to make some small example for NSAppearanceMBS, NSVisualControlMBS and NSVisualEffectViewMBS ?
I tried but failed to get some use out it.

Anyone else having luck getting this to work?

isn’t willing sounds too hard.

Hmm… I asked but you say no. Thats about not willing to do it? Not?

Ah … never mind. Lets move on.

There is another thread about vibrancy with the NSVisualEffectView, but using declares instead of Christian’s plugins. Since he exposes all of the same functions as are available to declares, you can probably mimic the functionality from the other thread using the same functions but in the plugin instead. There are only like 3 properties so it shouldn’t be that hard to figure out.

Still I need to find some time to make an example.

No often means “not now”.

For a OSX toolbar, I am making use of a modified version of the MBS example project “/Examples/CocoaControls/Toolbar buttons/Toolbar buttons.xojo_binary_project”.

I also would like to be able to make its look compliant with Yosemite and I need an example on how to do this with MBS plugins.

I already tried to follow the suggestion at this thread: https://forum.xojo.com/16453-window-transparency-vibrancy

But they mess up my existing work and before I’m going to sort that out, I hope for a more elegant solution with MBS plugins.

I would like to know how to do a toolbar with vibrancy, as Norman showed it with this picture:

I also would like to know how to apply vibrancy to the Main Window (or part of the window?) so that the navigation area is translucent.

Has anyone done that already? Will there be an example available with the MBS plugins in the near future?
A modified version of Toolbar buttons.xojo_binary_project might help!

I tried everything but it keeps failing.

Christian mailed me he also cannot get it working (for now).

With MBS Plugin you can use code like this window open event:

[code] // Sets up a NSVisualEffectView for the Window
#if targetmacos
dim win as NSWindowMBS = self.NSWindowMBS

// left light
dim view1 as new NSVisualEffectViewMBS(0, 0, width/2, height)

win.contentView.addSubview(view1, -1, nil)

// right dark
dim view2 as new NSVisualEffectViewMBS(width/2, 0, width, height)

view2.material = view2.NSVisualEffectMaterialDark

win.contentView.addSubview(view2, -1, nil)

#endif[/code]

Thanks Christian! Something is not (yet) working right, your code above crashes at this line:

dim view1 as new NSVisualEffectViewMBS(0, 0, width/2, height)

This occurs on Xojo 2014r2.1 and on 2014r3b2

The code works fine here. Did you run in OSX10.10 ?

yes

Odd

OK, now I got it working. I installed the latest pre-release of the MBS plugins and cleared any cache I know of. And now it works.

And it is as short and concise as I had hoped for. Thanks, Christian!

There is an issue though. Try rescaling the window and you know what I mean.

When using Sams code it also works when you rescale the window.

[quote=140501:@Christoph De Vocht]There is an issue though. Try rescaling the window and you know what I mean.

When using Sams code it also works when you rescale the window.[/quote]

Simply add code to the resizing event as well:

[code]Sub Resizing()
// Sets up a NSVisualEffectView for the Window
#If targetmacos
Dim win As NSWindowMBS = Self.NSWindowMBS

// right dark
Dim view2 As New NSVisualEffectViewMBS(0, 0, width, height)

view2.material = view2.NSVisualEffectMaterialDark

win.contentView.addSubview(view2, -1, Nil)

#EndIf
End Sub
[/code]

you need newer plugins. Sorry.

for resizing, better use autoresizing mask:

[code] // Sets up a NSVisualEffectView for the Window
#if targetmacos
dim win as NSWindowMBS = self.NSWindowMBS

// left light
dim view1 as new NSVisualEffectViewMBS(0, 0, width/2, height)
view1.autoresizesSubviews = true
view1.autoresizingMask = view1.NSViewMaxXMargin + view1.NSViewHeightSizable

win.contentView.addSubview(view1, -1, nil)

// right dark
dim view2 as new NSVisualEffectViewMBS(width/2, 0, width, height)

view2.material = view2.NSVisualEffectMaterialDark
view2.autoresizingMask = view2.NSViewWidthSizable + view2.NSViewHeightSizable

win.contentView.addSubview(view2, -1, nil)

#endif[/code]

Which MBS plugin needs to be installed, in order for this to work?
Thanks.

NSVisualEffectViewMBS is in CocoaExtras.

Also probably Cocoa, CocoaBase, CocoaControls and MacOSXCG or MacOSXCF.

Thanks Christian !
Is it possible to modify this, so that it also works on a toolbar?

Thank you.