Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Addressbook/List of People with images
Function:
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/List of People with images
This example is the version from Tue, 30th Jul 2012.
Project "List of People with images.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) As Boolean if Column=0 and row<me.ListCount then dim n as NSImageMBS = me.CellTag(row,Column) if n<>Nil then dim s as NSImageMBS = n.imageByScalingToSize(100,100) dim p as picture = s.CopyPictureWithMask g.DrawPicture p, (120.0-p.width)/2.0, (100.0-p.Height)/2.0 end if end if Exception ni as NilObjectException // ignore End EventHandler
End Control
EventHandler Sub Open() a = new ABAddressBookMBS dim people() as ABPersonMBS = a.people for each person as ABPersonMBS in people dim vn as string = person.valueForProperty(a.kABFirstNameProperty) dim nn as string = person.valueForProperty(a.kABLastNameProperty) dim name as string = vn+" "+nn if vn="" then if nn="" then // no name, maybe a company? name = person.valueForProperty(a.kABOrganizationProperty) else name = nn end if end if list.AddRow "" List.Cell(List.LastIndex,1)=name try list.celltag(List.LastIndex,0)=person.image catch x as NSExceptionMBS end try next End EventHandler
Property Protected a As ABAddressBookMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins