Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Addressbook/Addressbook Picker
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/Addressbook Picker
This example is the version from Tue, 10th Jun 2013.
Project "Addressbook Picker.rbp"
Filetype text
End FileTypes
Class MainWindow Inherits Window
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() p.Visible=me.Value End EventHandler
End Control
Control List Inherits ListBox
ControlInstance List Inherits ListBox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim ca() as ABRecordMBS = p.SelectedRecords if UBound(ca)<0 then MsgBox "Please select a person first!" else dim ap as ABPersonMBS = ABPersonMBS(ca(0)) dim s as string = ap.vCardRepresentation s=Replaceall(s,chr(10),"") MsgBox s end if End EventHandler
End Control
EventHandler Sub Close() if p<>nil then p.Visible=false p.RemoveEvents end if End EventHandler
EventHandler Sub DropObject(obj As DragItem, action As Integer) do if obj.MacDataAvailable("vCrd") then MsgBox obj.MacData("vCrd") end if loop until not obj.NextItem End EventHandler
EventHandler 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 EventHandler
Property a As abaddressbookMBS
Property p As abpickerMBS
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class MyPicker Inherits ABPickerMBS
EventHandler Sub GroupDoubleClicked() MainWindow.List.InsertRow 0,"Group Double Clicked" End EventHandler
EventHandler Sub GroupSelectionChanged() MainWindow.List.InsertRow 0,"Group Selection Changed" End EventHandler
EventHandler Sub NameDoubleClicked() MainWindow.List.InsertRow 0,"Name Double Clicked" End EventHandler
EventHandler Sub NameSelectionChanged() MainWindow.List.InsertRow 0,"Name Selection Changed" End EventHandler
EventHandler Sub ValueSelectionChanged() MainWindow.List.InsertRow 0,"Value Selection Changed" End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo blog