Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/Addressbook/Properties of ABPerson
Required plugins for this example: MBS MacBase Plugin, MBS MacCocoa Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/Addressbook/Properties of ABPerson
This example is the version from Tue, 30th Jul 2012.
Project "Properties of ABPerson.xojo_binary_project"
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control EditField2 Inherits TextField
ControlInstance EditField2 Inherits TextField
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim p as new ABPersonMBS
if 1=p.addProperty(EditField1.text,val(EditField2.text)) then
MsgBox "Added property."
else
MsgBox "Failed to add property."
end if
update
End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
dim p as new ABPersonMBS
if 1=p.removeProperty(EditField1.text) then
MsgBox "Removed property."
else
MsgBox "Failed to remove property."
end if
update
End EventHandler
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
EventHandler Sub Open()
a=new abAddressbookMBS
update
End EventHandler
Sub update()
dim r as string
dim p as new ABPersonMBS
listBox1.deleteAllRows
dim d(-1) as string = p.properties
for each s as string in d
listBox1.addrow s
dim t as integer = p.typeOfProperty(s)
select case t
case ABAddressBookMBS.kABStringProperty
r="String"
case ABAddressBookMBS.kABIntegerProperty
r="Integer"
case ABAddressBookMBS.kABRealProperty
r="Real"
case ABAddressBookMBS.kABDateProperty
r="Date"
case ABAddressBookMBS.kABArrayProperty
r="Array"
case ABAddressBookMBS.kABDictionaryProperty
r="Dictionary"
case ABAddressBookMBS.kABDataProperty
r="Data"
case ABAddressBookMBS.kABMultiStringProperty
r="Multi-String"
case ABAddressBookMBS.kABMultiIntegerProperty
r="Multi-Integer"
case ABAddressBookMBS.kABMultiRealProperty
r="Multi-Real"
case ABAddressBookMBS.kABMultiDateProperty
r="Multi-Date"
case ABAddressBookMBS.kABMultiArrayProperty
r="Multi-Array"
case ABAddressBookMBS.kABMultiDictionaryProperty
r="Multi-Dictionary"
case ABAddressBookMBS.kABMultiDataProperty
r="Multi-Data"
else
r="?"
end select
listBox1.cell(listBox1.lastIndex,1)=r
next
End Sub
Property Protected a As abaddressbookMBS
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
EventHandler Sub Open()
if TargetMachO=false then
MsgBox "This example needs a MachO target running on Mac OS X."
quit
end if
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCocoa Plugin.