OverlayWindowMBS replacement?

  1. 3 months ago

    Oliver O

    Jan 9 Pre-Release Testers, Xojo Pro https://udemy.seminar.pro

    OverlayWindowMBS can no longer be used on 64bit macOS.

    I used it to make a Window transparent, which has a picture on it, a progressbar and a label.

    I see that I can use OverlayMBS now and somehow mimic the behaviour of controls by painting myself, but I have hoped to find a solution which works more like the old (now obsolete) solution: use a window, drop some controls on it, make the window transparent.

    Are there declares to achieve this?

  2. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    Like NSPopoverMBS?

    vcTask = new NSViewControllerMBS
    vcTask.view = CCPrivacyShort.NSViewMBS
    
    pvrTask = new NSPopoverMBS
    pvrTask.animates = true
    pvrTask.contentViewController = vcTask
    pvrTask.behavior = pvrTask.NSPopoverBehaviorTransient
    
    dim v as NSViewMBS = CocoaControlMBS1.View
    dim r as NSRectMBS = NSMakeRectMBS(0, 0, 500, 500)
    
    pvrTask.showRelativeToRect(r, v, pvrTask.MinXEdge)
  3. Oliver O

    Jan 9 Pre-Release Testers, Xojo Pro https://udemy.seminar.pro

    No .. I am using NSPopoverMBS somewhere else, but here I have hoped for something which simply makes a plain box window transparent and leaving the controls on it opaque.

  4. Oliver O

    Jan 9 Pre-Release Testers, Xojo Pro https://udemy.seminar.pro

    OK, for macOS I found this code which works for me:

    Const Cocoa = "Cocoa"
    Declare Sub setOpaque Lib Cocoa selector "setOpaque:" (id As Integer, b As Boolean)
    Declare Function NSClassFromString Lib Cocoa (aClassName As CFStringRef) As Ptr
    Declare Function clearColor Lib Cocoa selector "clearColor" (NSColorClass As Ptr) As Ptr
    Declare Sub setBackgroundColor Lib Cocoa selector "setBackgroundColor:" (w As Integer, c As Ptr)
    
    //allow for transparency by setting opaqueness false
    setOpaque(Self.Handle, False)
    
    //set the background completely transparent
    setBackgroundColor(self.Handle, clearColor(NSClassFromString("NSColor")))

    kudos to Will Shank
    https://forum.xojo.com/18739-make-sheet-window-transparent/p1#p157078

  5. Beatrix W

    Jan 9 Pre-Release Testers Europe (Germany)

    This one?

    'make transparent
    dim t As integer = self.MakeTransparentMBS
    
    self.HasNoTitleBarMBS = true
    self.HasBorderMBS = true
    
    'make the pic for the background
    dim Pic as Picture 
    if IsDarkMode then
    Pic = mailbox_name_change_dm
    else
    Pic = mailbox_name_change
    end if
    dim Mask as Picture = mailbox_name_change_mask
    WindowPic = CGCreateImageMBS(Pic, Mask)
    
    self.Height = mailbox_name_change.Height
    self.Width = mailbox_name_change.Width
    CLabel.Invalidate 'otherwise label will not show

    Needs a pic with a mask, though.

  6. Christian S

    Jan 9 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    You can decide wether OverlayMBS helps you.
    Or a normal Xojo window made transparent.

or Sign Up to reply!