Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics Overlay Window/Transparent Windows/Custom Window with RB window
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/Transparent Windows/Custom Window with RB window
This example is the version from Mon, 18th Mar 2012.
Project "Custom Window with RB window.rbp"
Class MainWindow Inherits Window
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
EventHandler Sub ValueChanged() if self.SetTransparencyMBS(me.value) then end if End EventHandler
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() Refresh End EventHandler
End Control
EventHandler Sub Open() dim m as picture // use MacProcId 1104 if you don't want a title bar call self.MakeTransparentMBS m=xmask p=xpicture pic=CGCreateImageMBS(p.BitmapMBS,m.BitmapMBS) width=p.width height=p.height '// Work around for 10.3 problems: 'if SetTransparencyMBS(1) then 'end if End EventHandler
EventHandler Sub Paint(g As Graphics) dim c as CGContextMBS if TargetCocoa then c = GetCurrentCGContextMBS else c=self.CGContextMBS end if c.ClearRect CGMakeRectMBS(0, 0, g.width, g.height) c.drawPicture pic, CGMakeRectMBS(0, 0, pic.width, pic.height) if CheckBox1.Value then c.setRGBFillColor 0,0,1,0.1 c.fillRect CGMakeRectMBS(0,0, pic.width/2, pic.height/2) c.setRGBFillColor 1,0,0,0.1 c.fillRect CGMakeRectMBS(0,pic.height/2, pic.width/2, pic.height) c.setRGBFillColor 0,1,0,0.1 c.fillRect CGMakeRectMBS(pic.width/2,pic.height/2, pic.width, pic.height) end if Exception g.DrawPicture p,0,0 End EventHandler
Property Protected p As picture
Property pic As cgimageMBS
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 App Inherits Application
End Class
ExternalFile xmask
End ExternalFile
ExternalFile Xpicture
End ExternalFile
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo Plugins