Xojo and NSCollectionView

I’m new here and have been playing around with Xojo for the last few days
I would like to use it only for macOS Prototyping. For full productions it doesn’t seem appropriate to me.

Because I need NSCollectionView and unfortunately this is not standard in Xojo (why by the way? NSTableView and NSCollectionView are essential controls used in any macOS application) Therefore, I installed the so called MBS plugins.
The implementation of NSCollectionView is not complete in MBS but certainly useful.

Unfortunately I cannot use it with sections. Also, I could not find an MBS example of this, although these functions are available in MBS.

In short, I need a working example of NSCollectionView with sections. If I can get this to work, I will consider purchasing a license.

Thank you for the interest in our plugins.

NSCollectionViewMBS and NSCollectionViewControlMBS are quite new and we recently worked on section support.

For 21.3 there are a few new things coming and we may get an updated example for it.

here is some sample code from one of our development projects. Not yet fully finished, but you may get the idea with implementing three events:

Function numberOfSections() Handles numberOfSections as Integer
  return sections.Ubound+1
End Function

Function referenceSizeForHeaderInSection(layout as NSCollectionViewLayoutMBS, section as Integer) Handles referenceSizeForHeaderInSection as NSSizeMBS
  return new NSSizeMBS(500, 40)
End Function

Function viewForSupplementaryElement(kind as String, indexPath as NSIndexPathMBS) Handles viewForSupplementaryElement as NSViewMBS
  System.debuglog CurrentMethodName + " kind=" + kind + " indexPath.section=" + indexPath.section.ToString + " indexPath.item=" + indexPath.item.ToString
  
  if kind = NSCollectionViewFlowLayoutMBS.ElementKindSectionHeader then
    
    dim section as Dictionary = sections(indexPath.section)
    dim title as string = section.Value("title")
    dim itemCount as integer = section.Value("itemcount")
    
    dim headerView As NSCollectionViewSectionHeaderViewMBS = collectionView.makeSupplementaryViewOfKind(kind,indexPath)
    
    dim sectionHeader as new CollectionViewSectionHeader(headerView, "Section: " + title,itemCount)
    
    section.Value("header") = sectionHeader
    
    Return headerView
  end
  
  Exception n As NSExceptionMBS
    System.DebugLog n.message
End Function

Return number of sections, a default height for them and then generate a NSCollectionViewSectionHeaderViewMBS object.

My personal guess is because it is so platform specific, and Xojo gravitates mostly toward things that can be cross-platform. One exception being the initial mobile support was targeted to iOS only, but as they get closer to also supporting Android builds much of the iOS stuff has morphed to Mobile.

For some platform specific stuff you can use declares inside #pragma blocks to limit the compiler to implement only on a specific platform. But NSCollectionView requires more than what a Declare can get you, hence support in some third party extensions like MBS.