Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Window Transformation
Function:
Required plugins for this example: MBS MacCF Plugin, MBS MacOSX Plugin, MBS Main Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Window Transformation
This example is the version from Sun, 17th Mar 2012.
Project "Window Transformation.rbp"
FileTypes
Filetype text
End FileTypes
Class MainWindow Inherits Window
Control GroupBox1 Inherits GroupBox
ControlInstance GroupBox1 Inherits GroupBox
End Control
Control iEffect Inherits RadioButton
ControlInstance iEffect(0) Inherits RadioButton
ControlInstance iEffect(1) Inherits RadioButton
ControlInstance iEffect(2) Inherits RadioButton
ControlInstance iEffect(3) Inherits RadioButton
ControlInstance iEffect(4) Inherits RadioButton
EventHandler Sub Action(index as Integer) dim aShow as Boolean dim aHide as Boolean dim aMove as Boolean dim aSize as Boolean effect=index+1 aShow=false aHide=false aMove=false aSize=false Select case index case 0 // Zoom aShow=true aHide=true case 1 // Sheet aShow=true aHide=true case 2 // Slide aMove=true aSize=true case 3 // Fade aShow=true aHide=true case 4 // Slide aShow=true aHide=true end Select iAction(0).Enabled=aShow iAction(1).Enabled=aHide iAction(2).Enabled=aMove iAction(3).Enabled=aSize End EventHandler
End Control
Control GroupBox2 Inherits GroupBox
ControlInstance GroupBox2 Inherits GroupBox
End Control
Control iAction Inherits RadioButton
ControlInstance iAction(0) Inherits RadioButton
ControlInstance iAction(1) Inherits RadioButton
ControlInstance iAction(2) Inherits RadioButton
ControlInstance iAction(3) Inherits RadioButton
EventHandler Sub Action(index as Integer) action=index+1 End EventHandler
End Control
Control GroupBox3 Inherits GroupBox
ControlInstance GroupBox3 Inherits GroupBox
End Control
Control CheckRectangle Inherits CheckBox
ControlInstance CheckRectangle Inherits CheckBox
EventHandler Sub Action() dim b as Boolean b=me.Value StaticText1.Enabled=b StaticText2.Enabled=b StaticText3.Enabled=b StaticText4.Enabled=b iTop.Enabled=B iLeft.Enabled=B iWidth.Enabled=B iHeight.Enabled=B End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control iLeft Inherits TextField
ControlInstance iLeft Inherits TextField
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control iTop Inherits TextField
ControlInstance iTop Inherits TextField
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control iWidth Inherits TextField
ControlInstance iWidth Inherits TextField
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control iHeight Inherits TextField
ControlInstance iHeight Inherits TextField
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control iDuration Inherits TextField
ControlInstance iDuration Inherits TextField
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control CheckAsync Inherits CheckBox
ControlInstance CheckAsync Inherits CheckBox
End Control
Control CheckParent Inherits CheckBox
ControlInstance CheckParent Inherits CheckBox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() run End EventHandler
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control result Inherits Label
ControlInstance result Inherits Label
End Control
EventHandler Sub Open() if TargetMacOS then // ok else MsgBox "This example requires Mac OS X!" end if TheWindow.left=self.left+self.Width+20 TheWindow.Show self.show iEffect(3).Value=true // fade iAction(1).Value=true // hide End EventHandler
Protected Sub run() dim e as integer dim async as Boolean dim l,t,w,h as integer dim duration as Double dim parent as Window duration=CDbl(iduration.text) async=CheckAsync.Value if checkParent.value then parent=self end if if CheckRectangle.Value then l=Val(iLeft.text) t=Val(iTop.text) w=Val(iWidth.text) h=Val(iHeight.text) e=TheWindow.TransitionWindowMBS(parent, effect, action, l, t, w, h, Async, duration) else e=TheWindow.TransitionWindowMBS(parent, effect, action, Async, duration) end if if e=0 then result.text="0 OK" elseif e=-50 then result.text="-50 Parameter error" else result.text=str(e) end if End Sub
Property Protected action As integer
Property Protected effect As integer
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() if TargetCarbon then // ok else MsgBox "This example is for Mac OS X only." end if End EventHandler
End Class
Class TheWindow Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control oLeft Inherits Label
ControlInstance oLeft Inherits Label
End Control
Control oTop Inherits Label
ControlInstance oTop Inherits Label
End Control
Control oWidth Inherits Label
ControlInstance oWidth Inherits Label
End Control
Control oHeight Inherits Label
ControlInstance oHeight Inherits Label
End Control
Control Separator1 Inherits Separator
ControlInstance Separator1 Inherits Separator
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control sLeft Inherits Label
ControlInstance sLeft Inherits Label
End Control
Control sTop Inherits Label
ControlInstance sTop Inherits Label
End Control
Control sWidth Inherits Label
ControlInstance sWidth Inherits Label
End Control
Control sHeight Inherits Label
ControlInstance sHeight Inherits Label
End Control
EventHandler Sub Close() if w<>Nil then w.target=nil w=nil end if End EventHandler
EventHandler Sub Moved() update End EventHandler
EventHandler Sub Open() w=new MyCarbonWindowsEventsMBS w.Listen me End EventHandler
EventHandler Sub Resized() update End EventHandler
EventHandler Sub Resizing() update End EventHandler
Protected Sub update() dim s as IntegerRectMBS oLeft.text=str(left) oHeight.text=str(Height) otop.text=str(top) oWidth.text=str(Width) s=me.WindowStructureRectMBS if s<>nil then sLeft.text=str(s.left) sHeight.text=str(s.Height) stop.text=str(s.top) sWidth.text=str(s.Width) else sLeft.text="?" sHeight.text="?" stop.text="?" sWidth.text="?" end if End Sub
Property Protected w As mycarbonWindowsEventsMBS
End Class
Class MyCarbonWindowsEventsMBS Inherits CarbonWindowsEventsMBS
EventHandler Sub WindowTransitionCompleted(TransitionAction as integer, TransactionEffect as integer) System.DebugLog "WindowTransitionCompleted" if TransactionEffect=4 then if TransitionAction=2 then TheWindow.Visible=False elseif TransitionAction=1 then TheWindow.Visible=true end if end if End EventHandler
EventHandler Sub WindowTransitionStarted(TransitionAction as integer, TransactionEffect as integer) System.DebugLog "WindowTransitionStarted" End EventHandler
Property target As thewindow
End Class
End Project

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins