Platforms to show: All Mac Windows Linux Cross-Platform

/Cocoa/Addressbook/Addressbook Pick one address
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /Cocoa/Addressbook/Addressbook Pick one address
This example is the version from Thu, 31th Dec 2008.
Notes: Last modified: Thu, 31th Dec 2008
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
ControlInstance
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

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.kABAddressProperty
p.AllowSingleValueSelection=true

CheckBox1.Value=p.Visible

else
MsgBox "This example needs a MachO target."
end if
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"

dim c as integer
dim s(-1) as Dictionary
dim t as string
dim a as ABAddressBookMBS=MainWindow.a

s=me.SelectedDictionaries

c=UBound(s)
if c>=0 then
// pick first
dim d as Dictionary=s(0)

t=t+d.Lookup(a.kABAddressStreetKey,"")+EndOfLine
t=t+d.Lookup(a.kABAddressZIPKey,"")+" "
t=t+d.Lookup(a.kABAddressCityKey,"")+EndOfLine
t=t+d.Lookup(a.kABAddressCountryKey,"")+EndOfLine
end if

MainWindow.EditField1.text=t

End Sub
Sub GroupDoubleClicked()
MainWindow.List.InsertRow 0,"Group Double Clicked"
End Sub
End Class


See also:




Links
MBS Filemaker Plugins - Förderverein St. Arnulf Nickenich