Example: /MacCocoa/Addressbook/List of People with images

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCocoa/Addressbook/List of People with images


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.xojo_binary_project"
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:

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


💬 Ask a question or report a problem