Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/CF Preferences Test
Function:
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/CF Preferences Test
This example is the version from Sun, 17th Mar 2012.
Project "CF Preferences Test.rbp"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() read End EventHandler
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() write End EventHandler
End Control
Control EditField2 Inherits TextField
ControlInstance EditField2 Inherits TextField
End Control
Sub read() dim c as CFPreferencesMBS dim o as CFObjectMBS dim s as CFStringMBS c=new CFPreferencesMBS o=c.CopyAppValue(NewCFStringMBS("test"),c.kCFPreferencesCurrentApplication) if o isa CFStringMBS then s=CFStringMBS(o) if s<>Nil then EditField1.text=s.str else MsgBox "A value was returned, but it's not a string!?" end if else MsgBox "nil was returned -> No value found." end if End Sub
Sub write() dim c as CFPreferencesMBS dim o as CFObjectMBS dim s as CFStringMBS c=new CFPreferencesMBS c.SetAppValue NewCFStringMBS("test"),NewCFStringMBS(EditField2.text),c.kCFPreferencesCurrentApplication if c.AppSynchronize(c.kCFPreferencesCurrentApplication) then MsgBox "Saved data." else MsgBox "Failed to save data." end if End Sub
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
End Project

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo Plugins