Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics Overlay Window/Overlay Window/Overlay Rectangle Mac
Function:
Required plugins for this example: MBS MacCG Plugin, MBS Picture Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreGraphics Overlay Window/Overlay Window/Overlay Rectangle Mac
This example is the version from Sun, 17th Mar 2012.
Project "Overlay Rectangle Mac.rbp"
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() start End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
Sub start() o=new overlayWindow If o.create(screen(0).left,screen(0).top, screen(0).Width,screen(0).Height)=0 then o.IgnoreClicks=False o.InstallEventHandler o.show o.redraw end if End Sub
Property Protected o As overlayWindow
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class overlaywindow Inherits OverlayWindowMBS
EventHandler Function MouseDown(x as double, y as double, ModifierKeys as integer, MouseButton as integer, ClickCount as integer) As boolean px=x py=y rx=x ry=y redraw Return true End EventHandler
EventHandler Function MouseDragged(x as double, y as double, ModifierKeys as integer, MouseDeltaX as double, MouseDeltaY as double, MouseButton as integer) As boolean rx=x ry=y redraw Return true End EventHandler
EventHandler Function MouseUp(x as double, y as double, ModifierKeys as integer, MouseButton as integer, ClickCount as integer) As boolean dim xx,yy,ww,hh as integer rx=x ry=y ClearWindow xx=px yy=py ww=rx-px hh=ry-py if ww<0 then xx=rx ww=-ww end if if hh<0 then yy=ry hh=-hh end if DelayMBS 0.1 // time for the system to update screen Window1.Canvas1.Backdrop=ScreenshotRectMBS(xx,yy,ww,hh) close End EventHandler
EventHandler Sub WindowShown() Redraw End EventHandler
Sub ClearWindow() dim c as CGContextMBS dim r as CGRectMBS c=me.Context r=CGMakeRectMBS(0,0,Width,Height) c.ClearRect r c.Flush Flush End Sub
Sub redraw() dim c as CGContextMBS dim r as CGRectMBS dim x,y as Integer c=me.Context r=CGMakeRectMBS(0,0,Width,Height) c.ClearRect r c.SetGrayFillColor 0.1,0.1 c.FillRect r r.Left=px r.top=height-py r.Width=rx-px r.Height=-(ry-py) c.SetGrayFillColor 0.5,0.5 c.FillRect r c.Flush End Sub
Property Protected px As integer
Property Protected py As integer
Property Protected rx As integer
Property Protected ry As integer
End Class
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo blog