Christian (et. al.),

Can anyone give me advice on how I can put a small (16x16 pixel) canvas into 
the Mac title bar? I'm trying to add a second "button" just beside the Lion 
"Fullscreen" button, similar to the "Coherence Mode" button in Parallels or the 
"MiniController" button in iTunes. 

I can follow the "View in Titlebar" example and can see how to add an 
NSButtonMBS object. It seems as if I should be able to do the same thing using 
an NSViewMBS object and point it's Handle to the Canvas.Handle in the 
constructor. If I do this, then I don't see how to position it correctly in the 
window (Option 1 below). If I use the form of the constructor that places the 
view in the window and then set the handle (Option 2 below), this doesn't seem 
to work either and results in errors when the program terminates because 
something isn't getting released. 

Here's my logic:

cvsMiniControllerButton is created in the IDE with a nice background image and 
has all the correct mouseover, mousedown, mouseup events, etc.

Private WindowView As NSWindowMBS
Private MiniControllerButton As NSViewMBS 

winMain.Open Event:

Sub Open()
 
  If TargetMacOS Then
    
    WindowView = New NSWindowMBS(Self)

    'Option 1: Set the NSViewMBS.Handle in the constructor, but then how does 
it get positioned? Setting frameLeft, frameTop, etc. doesn't seem to work...
    MiniControllerButton = New 
NSViewMBS(cvsMiniControllerButton.NSViewMBS.Handle)
    MiniControllerButton.frameWidth = 16
    MiniControllerButton.frameHeight = 16
    MiniControllerButton.frameLeft = Self.Width - 40
    MiniControllerButton.frameTop = Self.Height + 1
    
    'Option 2: Set the position in the constructor, and then set the handle - 
this doesn't work either and causes errors when the program quits
    'MiniControllerButton = New NSViewMBS(Self.Width - 40, Self.Height + 1, 16, 
16)
    'MiniControllerButton.Handle = cvsMiniControllerButton.NSViewMBS.Handle

    MiniControllerButton.autoresizingMask = 
MiniControllerButton.NSViewMinXMargin + MiniControllerButton.NSViewMinYMargin
    WindowView.contentView.superview.addSubview(MiniControllerButton)
    WindowView.Show
            
  End If

End Sub

Hopefully someone can set me on the correct path...

Cheers.

-bill k


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to