Platforms to show: All Mac Windows Linux Cross-Platform

/Cocoa/Addressbook/Addressbook Picker
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Cocoa/Addressbook/Addressbook Picker
This example is the version from Mon, 7th Feb 2010.
Notes: Last modified: Mon, 7th Feb 2010
Class MainWindow
Inherits Window
// Controls
ControlInstance
Sub Action() Handles Event
p.Visible=me.Value
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim ca as ABRecordArrayMBS
dim ap as ABPersonMBS
dim s as string

ca=p.SelectedRecords

if ca=nil then
MsgBox "Please select a person first!"
else
ap=ABPersonMBS(ca.Item(0))

s=ap.vCardRepresentation
s=Replaceall(s,chr(10),"")
MsgBox s

end if

End Sub
End ControlInstance

// Properties
Dim a As abaddressbookMBS
Dim p As abpickerMBS

// Event implementations
Sub Close()
if p<>nil then
p.Visible=false
p.RemoveEvents
end if
End Sub
Sub Open()
if TargetMachO then
me.AcceptMacDataDrop "vCrd"

a=new ABAddressbookMBS

p=new MyPicker

if p.Available=false then
MsgBox "This demo requires Mac OS X 10.3!"
quit
Return
end if

p.Create
p.InstallEvents self
p.Width=500
p.Height=300
p.Visible=true
p.AddProperty a.kABEmailProperty
p.AddProperty a.kABAddressProperty
p.AddProperty a.kABPhoneProperty

CheckBox1.Value=p.Visible

else
MsgBox "This example needs a MachO target."
end if

End Sub
Sub DropObject(obj As DragItem)
do
if obj.MacDataAvailable("vCrd") then
MsgBox obj.MacData("vCrd")
end if

loop until not obj.NextItem
End Sub
End Class

Class App
Inherits Application
End Class

Class MyPicker
Inherits ABPickerMBS
// Event implementations
Sub ValueSelectionChanged()
MainWindow.List.InsertRow 0,"Value Selection Changed"
End Sub
Sub NameSelectionChanged()
MainWindow.List.InsertRow 0,"Name Selection Changed"
End Sub
Sub GroupSelectionChanged()
MainWindow.List.InsertRow 0,"Group Selection Changed"
End Sub
Sub NameDoubleClicked()
MainWindow.List.InsertRow 0,"Name Double Clicked"
End Sub
Sub GroupDoubleClicked()
MainWindow.List.InsertRow 0,"Group Double Clicked"
End Sub
End Class


See also:




Links
MBS Realbasic tutorial videos - Pfarrgemeinde St. Arnulf Nickenich