Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCloud/Save and restore State
Function:
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa 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: /MacCloud/Save and restore State
This example is the version from Sun, 17th Mar 2012.
Project "Save and restore State.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Activate() System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub Close() System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub Deactivate() System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub Open() System.DebugLog CurrentMethodName // register plugins here if SystemInformationMBS.isLion and TargetCocoa then // ok else MsgBox "Please run this example with Mac OS X 10.7 and Cocoa target." end if del = new MyNSApplicationDelegateMBS End EventHandler
Sub Constructor() System.DebugLog CurrentMethodName End Sub
Property del As MyNSApplicationDelegateMBS
Property lastrun As string
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyNSApplicationDelegateMBS Inherits NSApplicationDelegateMBS
EventHandler Sub applicationDidDecodeRestorableState(coder as NSCoderMBS) System.DebugLog CurrentMethodName dim s as string = coder.decodeString("lastrun") System.DebugLog "Got text: "+s app.lastrun = s window1.Listbox1.AddRow "Got State with Lastrun="+s Exception n as NSExceptionMBS System.DebugLog "Exception: "+n.message End EventHandler
EventHandler Sub applicationDidFinishLaunching(Notification as NSNotificationMBS) System.DebugLog CurrentMethodName End EventHandler
EventHandler Sub applicationWillEncodeRestorableState(coder as NSCoderMBS) System.DebugLog CurrentMethodName System.DebugLog "allowsKeyedCoding: "+str(coder.allowsKeyedCoding) dim d as new date dim s as string = d.LongTime coder.encodeString(s, "lastrun") window1.Listbox1.AddRow "Encoded state." Exception n as NSExceptionMBS System.DebugLog "Exception: "+n.message End EventHandler
EventHandler Sub applicationWillTerminate(Notification as NSNotificationMBS) System.DebugLog CurrentMethodName End EventHandler
End Class
End Project

Feedback, Comments & Corrections

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





Links
MBS Xojo Chart Plugins