Platforms to show: All Mac Windows Linux Cross-Platform
/MacCF/SystemConfiguration/Preferences Test
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/SystemConfiguration/Preferences Test
This example is the version from Sun, 17th Mar 2012.
Project "Preferences Test.xojo_binary_project"
Class ListWindow Inherits Window
Control List Inherits ListBox
ControlInstance List Inherits ListBox
EventHandler Sub ExpandRow(row As Integer)
dim co as CFObjectMBS
dim i as integer
i=val(me.Cell(row,1))
co=o(i)
AddRows co
End EventHandler
End Control
EventHandler Sub Open()
dim ca as CFArrayMBS
dim co as CFObjectMBS
dim i,c as integer
dim cs as CFStringMBS
s=new SystemConfigurationMBS
p=new SCPreferencesMBS
if p.Create(NewCFStringMBS("PrefTest"),nil) then
ca=p.KeyList
if ca<>nil then
c=ca.Count-1
for i=0 to c
co=ca.Item(i)
if co isa CFStringMBS then
cs=CFStringMBS(co)
if cs<>nil then
co=p.GetValue(cs)
o.Append co
List.Addfolder cs.str
List.Cell(List.LastIndex,1)=str(UBound(o))
end if
end if
next
end if
end if
End EventHandler
Sub AddRows(co as cfobjectMBS)
dim cs as CFStringMBS
dim cd as CFDictionaryMBS
dim ca as CFArrayMBS
dim cb as CFBooleanMBS
dim cn as CFNumberMBS
dim cdl as CFDictionaryListMBS
dim i,c as integer
dim key as CFObjectMBS
dim keystring as CFStringMBS
dim item as CFObjectMBS
if co isa CFStringMBS then
cs=CFStringMBS(co)
List.AddRow cs.str
Return
end if
if co isa CFNumberMBS then
cn=CFNumberMBS(co)
List.AddRow str(cn.doubleValue)
Return
end if
if co isa CFBooleanMBS then
cb=CFBooleanMBS(co)
List.AddRow str(cb.Value)
Return
end if
if co isa CFDictionaryMBS then
cd=CFDictionaryMBS(co)
cdl=cd.List
if cdl<>Nil then
c=cdl.Count-1
for i=0 to c
key=cdl.Key(i)
if key<>nil then
keystring=CFStringMBS(key)
if keystring<>Nil then
o.Append cdl.Value(i)
List.AddFolder keystring.str
List.Cell(List.LastIndex,1)=str(UBound(o))
end if
end if
next
end if
Return
end if
if co isa CFArrayMBS then
ca=CFArrayMBS(co)
c=ca.Count-1
for i=0 to c
item=ca.Item(i)
AddRows item
next
Return
end if
List.AddRow "unhandled item of type "+co.TypeDescription
// show in on console
CFShowMBS co
End Sub
Property Protected o(0) As cfobjectMBS
Property Protected p As scpreferencesMBS
Property Protected s As systemConfigurationMBS
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
The items on this page are in the following plugins: MBS MacCF Plugin.