Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/Window Transformation2
Function:
Required plugins for this example: MBS MacCF Plugin, MBS MacOSX Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/Window Transformation2
This example is the version from Sun, 17th Mar 2012.
Project "Window Transformation2.rbp"
FileTypes
Filetype text
End FileTypes
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem WindowMenu = "Window"
MenuItem WindowShow = "Show"
MenuItem WindowHide = "Hide"
MenuItem WindowMove = "Move"
MenuItem WindowResize = "Resize"
MenuItem WindowGenie = "Genie"
End MenuBar
Class App Inherits Application
Const kActionHide = 2
Const kActionMove = 3
Const kActionResize = 4
Const kActionShow = 1
Const kEffectFade = 4
Const kEffectGenie = 5
Const kEffectSheet = 2
Const kEffectSlide = 3
Const kEffectZoom = 1
EventHandler Sub Open() if TargetCarbon then // ok else MsgBox "This example is for Mac OS X only." end if dim l,t,w,h as integer l=100 t=100 w=300 h=300 call TheWindow.TransitionWindowMBS(nil, kEffectSlide, kActionMove, l,t,w,h, false, 0.01) call TheWindow.TransitionWindowMBS(nil, kEffectFade, kActionShow, true, 2.0) End EventHandler
Function WindowGenie() As Boolean const duration=2.0 const async=false const parent=nil dim effect,action,l,t,w,h as integer if TheWindow.Visible=False then 'TheWindow.Left=500 'TheWindow.top=500 'TheWindow.Width=300 'TheWindow.Height=300 effect=kEffectFade action=kActionShow call TheWindow.TransitionWindowMBS(parent, effect, action, Async, duration) TheWindow.Show else l=-100 t=100 w=100 h=100 effect=kEffectGenie action=kActionHide call TheWindow.TransitionWindowMBS(parent, effect, action, l,t,w,h,Async, duration) TheWindow.hide end if Return True End Function
Function WindowHide() As Boolean const duration=2.0 const async=true const parent=nil const effect=kEffectFade const action=kActionHide call TheWindow.TransitionWindowMBS(parent, effect, action, Async, duration) End Function
Function WindowMove() As Boolean const duration=2.0 const async=false const parent=nil const effect=kEffectSlide const action=kActionMove dim l,t,w,h as integer if TheWindow.left=700 then l=50 t=500 w=300 h=300 else l=700 t=50 w=300 h=300 end if call TheWindow.TransitionWindowMBS(parent, effect, action, l,t,w,h,Async, duration) Return True End Function
Function WindowResize() As Boolean const duration=2.0 const async=false const parent=nil const effect=kEffectSlide const action=kActionMove dim l,t,w,h as integer if TheWindow.left=700 then l=50 t=500 w=200 h=200 else l=700 t=50 w=400 h=600 end if call TheWindow.TransitionWindowMBS(parent, effect, action, l,t,w,h,Async, duration) Return True End Function
Function WindowShow() As Boolean const duration=2.0 const async=true const parent=nil const effect=kEffectFade const action=kActionShow call TheWindow.TransitionWindowMBS(parent, effect, action, Async, duration) Return True End Function
End Class
Class TheWindow Inherits Window
EventHandler Sub Close() if w<>Nil then w.target=nil w=nil end if End EventHandler
EventHandler Sub Moved() me.Title=str(me.Left)+"/"+str(me.top) End EventHandler
EventHandler Sub Open() w=new MyCarbonWindowsEventsMBS w.Listen me End EventHandler
EventHandler Sub Resized() me.Title=str(me.Left)+"/"+str(me.top) End EventHandler
EventHandler Sub Resizing() me.Title=str(me.Left)+"/"+str(me.top) End EventHandler
Property Protected w As mycarbonWindowsEventsMBS
End Class
Class MyCarbonWindowsEventsMBS Inherits CarbonWindowsEventsMBS
EventHandler Sub WindowBoundsChanging(original as object, previous as object, current as object, flags as integer) TheWindow.Refresh End EventHandler
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