Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/IKImageBrowser/IKImageBrowser Control


Required plugins for this example: MBS AVFoundation Plugin, MBS MacCocoa Plugin, MBS MacBase Plugin, MBS MacOSX Plugin, MBS Main Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS MacControls Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/IKImageBrowser/IKImageBrowser Control

This example is the version from Thu, 9th Apr 2014.

Project "IKImageBrowser Control.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
End Control
Control IKImageBrowserViewControlMBS1 Inherits IKImageBrowserViewControlMBS
ControlInstance IKImageBrowserViewControlMBS1 Inherits IKImageBrowserViewControlMBS
EventHandler Sub Open() self.Imagebrowser = me.View // horizontal scrolling 'me.Scrollview.hasVerticalScroller = false 'me.Scrollview.hasHorizontalScroller = true 'Imagebrowser.contentResizingMask = Imagebrowser.NSViewWidthSizable // setup properties Imagebrowser.allowsReordering = true Imagebrowser.allowsMultipleSelection = true Imagebrowser.allowsEmptySelection = true Imagebrowser.animates = true Imagebrowser.zoomValue = 0.43 Imagebrowser.autoresizesSubviews = true Imagebrowser.cellsStyleMask = Imagebrowser.IKCellsStyleShadowed + Imagebrowser.IKCellsStyleTitled Imagebrowser.isHidden = false dim folder as FolderItem = SpecialFolder.Desktop.Child("test") if not folder.Exists then MsgBox "please put folder named test on desktop with images." end if dim files() as FolderItem = readfolder(folder) setfiles files Imagebrowser.reloadData End EventHandler
EventHandler Function itemAtIndex(index as integer) As IKImageBrowserItemMBS if items(index) = nil then // we auto generate here an ID for each new item we create static counter as integer counter = counter + 1 dim uid as string = str(counter) dim path as string = files(index).UnixpathMBS dim version as integer = 1 dim title as string = files(index).DisplayName items(index) = IKImageBrowserItemMBS.ItemWithPath(uid, path, version, title) end if Return items(index) End EventHandler
EventHandler Function numberOfItems() As integer Return UBound(files)+1 End EventHandler
EventHandler Sub removeItemsAtIndexes(indexes as NSIndexSetMBS) break End EventHandler
EventHandler Sub selectionDidChange() dim s as string dim indexset as NSIndexSetMBS = me.view.selectionIndexes s = indexset.Operator_Convert s = s + " ("+str(indexset.count)+")" window1.list.AddRow "selection changed to "+s End EventHandler
End Control
Function readfolder(folder as FolderItem) As FolderItem() dim files() as FolderItem dim c as integer = folder.Count for i as integer = 1 to c dim item as FolderItem = folder.TrueItem(i) if item <> nil and item.Visible then if item.Directory then dim items() as FolderItem = readfolder(item) for each it as FolderItem in items files.Append it next else files.Append item end if end if next Return files End Function
Sub setFiles(files() as FolderItem) self.files = files redim items(-1) redim items(UBound(files)) End Sub
Property Imagebrowser As IKImageBrowserViewMBS
Property files() As FolderItem
Property items() As IKImageBrowserItemMBS
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 MacFrameworks Plugin.


The biggest plugin in space...