Platforms to show: All Mac Windows Linux Cross-Platform

OverlayMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Window MBS Overlay Plugin 8.6 ✅ Yes ✅ Yes ❌ No ❌ No Desktop only
This class gives you a window overlaying all other windows with an alpha channel.
Example
dim o as OverlayMBS
dim p as Picture

o=new OverlayMBS(100,100,300,300)

p=New Picture(300,300,32)
p.Graphics.ForeColor=&c000000
p.Graphics.FillRect 0,0,300,300

o.Pict=p

p=New Picture(300,300,32)
p.Graphics.ForeColor=&c000000
p.Graphics.FillOval 0,0,300,300
p.Graphics.ForeColor=&cFFFFFF
p.Graphics.FillOval 100,100,100,100

o.Mask=p

o.UpdateShow

// wait 5 seconds to see the window
DelayMBS 5

Requires Mac OS X 10.3.9 or Windows 2000 or newer.

Cocoa implementation added with Mac OS X 10.4 class.
To support high resolution mode on Mac OS X high resolution displays, please make the picture+mask exact the double width and height of the window.

  • 17 events
    • event Draw(CGContext as Variant, NSGraphicsContext as Variant)
    • event GotFocus
    • event KeyDown(key as String, keyCode as Integer, modifiers as integer) as Boolean
    • event KeyUp(key as String, keyCode as Integer, modifiers as integer) as Boolean
    • event LostFocus
    • event menuForEvent(NSEvent as variant) as Variant
    • event MouseDown(x as Integer, y as Integer, modifiers as Integer) as boolean
    • event MouseDragged(x as Integer, y as Integer, modifiers as Integer) as boolean
    • event MouseEnter(x as Integer, y as Integer, modifiers as Integer)
    • event MouseExit(x as Integer, y as Integer, modifiers as Integer)
    • event MouseMoved(x as Integer, y as Integer, modifiers as Integer) as boolean
    • event MouseUp(x as Integer, y as Integer, modifiers as Integer) as boolean
    • event MouseWheel(x as Integer, y as Integer, dx as Double, dy as Double, modifiers as Integer)
    • event WindowBoundsChanged
    • event WindowClosed
    • event WindowHidden
    • event WindowShown
  • 19 properties
  • 12 methods
    • method Close
    • method Constructor(left as Integer, top as Integer, width as Integer, height as Integer, MacAttributes as Integer, WinExStyle as Integer, WinStyle as Integer)
    • method Constructor(left as Integer, top as Integer, width as Integer, height as Integer, WindowsNoActivate as boolean = false, WindowsTopMost as boolean=true)
    • method Hide
    • method InvalidateShadow
    • method Move(left as Integer, top as Integer)
    • method Resize(width as Integer, height as Integer)
    • method SetFocus
    • method Show(WindowsShowMode as Integer = 0)
    • method Update
    • method Update(NSImage as Variant)
    • method UpdateShow
  • 4 constants

Modifiers

Constant Value Description
kModifierFlagCommand 1048576 The command key is pressed.
Use with BitwiseAnd(Modifiers, kModifierFlagCommand) <> 0 to check if the flag is set in key events.
kModifierFlagControl 262144 The control key is pressed.
Use with BitwiseAnd(Modifiers, kModifierFlagControl) <> 0 to check if the flag is set in key events.
kModifierFlagOption 524288 The option (alt) key is pressed.
Use with BitwiseAnd(Modifiers, kModifierFlagOption) <> 0 to check if the flag is set in key events.
kModifierFlagShift 131072 The shift key is pressed.
Use with BitwiseAnd(Modifiers, kModifierFlagShift) <> 0 to check if the flag is set in key events.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 22.5
    • Changed OverlayMBS to return true for worksWhenModal for NSWindow subclass, so you get mouse events if a dialog shows.
  • Version 19.5
    • Changed OverlayMBS class, so if you use draw event, we don't clear the area for you any more.
  • Version 19.2
    • Fixed MouseWheel event in OverlayMBS class to be called more often.
  • Version 19.1
  • Version 19.0
    • Fixed problem with drawing OverlayMBS in 64-bit on MacOS 10.14 Mojave.
  • Version 18.4
  • Version 18.3
    • Fixed Cocoa target for OverlayMBS to not use NSWindowStyleMaskNonactivatingPanel which causes a warning from AppKit.
  • Version 18.2
    • We filter events for OverlayMBS.MouseWheel which have a zero delta.
  • Version 17.4
    • Added KeyDown/KeyUP and GotFocus/LostFocus events to OverlayMBS class.

The items on this page are in the following plugins: MBS Overlay Plugin.


OSAScriptViewMBS   -   PacketSocketMBS


💬 Ask a question or report a problem
The biggest plugin in space...