Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 14.4 ('NSTableView')
Instant purchase and download via GumRoad!

FEATURE

NSTabula Rasa

What to do when your new sports car arrives in parts

Issue: 14.4 (July/August 2016)
Author: Ulrich Bogun
Author Bio: Ulrich Bogun is the German developer evangelist for Xojo. After more than 20 years in design/prepress where he runs his own company, Xojo opened for him the world of programming three years ago. He likes to share results of his work on extending his free declare libraries for macOS, iOS, and RaspPi and maintains the (German) xojoblog.me site.
Article Description: >No description available
Article Length (in bytes): 18,058
Starting Page Number: >2
Article Number: 14404
Resource File(s):

Download Icon project-14404.zip Updated: 2016-07-04 14:35:14

Related Link(s): None

Excerpt of article text...

Xojo's listbox is an often recurring topic in the user forum. While it is one of the main controls for many projects, it is one of the few where Xojo had to leave the pure native path and build their own control (though based on native controls, of course).

Although the desktop listbox is highly customizable, it lacks many of the features included in OS X's NSTableView control, let alone iOSListbox. The usual suspects like the MonkeyBread Plugins or MacOSLib contain implementations of NSTableView, Apple's native listbox control. And I am very, very certain a more flexible solution for iOS is on its way too. Not really astonishingly, NSTableView is rarely used in Xojo projects. You'll soon see why.

The main reasons another listbox solution is being asked for are the limited customizability of Xojo's listbox's cells and the time it can take to fill a listbox's rows until it is displayed. The second issue may be overcome with an on-demand listbox (a listbox with separate scrollers that load and display only the visible portion of the data). The first problem of customizability—there really isn't a workaround.

NSTableView to the Rescue

This article describes the basic use of NSTableView on Mac OS X. iOS' UITableView is very similar in many aspects. You can use most of the information for a native iOS table too. I am using Monkeybread Plugins' NSTableControlMBS class in this example. It's a very close facsimile of Apple's implementation. You should be able to use this example almost exactly with MacOSLib (if this part should be fixed for 64-bit)—just remove the MBS extension from the class names. (Jean-Paul Devulder's dtPlugIns [which are now free] include native solutions too, but I haven't yet found time to see if they are compatible with this instruction.) And there's a tableview work-in-progress in my own small OSXLib library for Xojo too, in case you don't want to install plugins.

Considerations

...End of Excerpt. Please purchase the magazine to read the full article.