NSTableView - anyone tried yet ?

The dtListbox has this feature. You can create a (complex) container and link it to a cell. Works fine.
But because I always try to use as less plugins as possible, it would be great to see it with declares. :slight_smile:

BTW no offence to JP with if AWESOME dtPlugins !! They are a time saver for sure.

Technically plugins are not that different from declares…

[quote=277279:@jean-paul devulder]you can use but it’s a hack, when you resize the controls need to make a loop for check all rows and all columns for resize

containercontrols, the result is very slow and give visual glitch, use only with minimum rows and columns :)[/quote]

I know, and it’s for sure something you need to find a fix/solution for. :wink: :wink: :wink: :wink: :wink:

Does that mean Xojo also uses a hack to do this for the iOSTableView? You can now add a container as a cell (which is awesome).

[quote=277268:@Christoph De Vocht]The dtListbox has this feature. You can create a (complex) container and link it to a cell. Works fine.
But because I always try to use as less plugins as possible, it would be great to see it with declares. :slight_smile:

BTW no offence to JP with if AWESOME dtPlugins !! They are a time saver for sure.[/quote]

First of all, I am not competing with any plugin so I will develop it actually for my own use and I am very happy with my current results.

I didn’t know that dtplugin listbox does support that at all. It’s good to know as the examples don’t show the real power. I would apprecaite if JP could make some nice listbox examples/demos to show what the listbox can really do and if it’s reliable. I would probably not have started with my own NSTaleView.

Anyway, using containers has limits and restrictions and I do not see this happen in my class. I have a different approach
with less controls are supported in the first run but cleaner. Once again, I have no ambitions to compete or push anyhting out.
What makes me a bit sad is the point that the community doesn have ambitions to work all together for the project or is satisfied with currently existing solutions.

[quote=277298:@Christoph De Vocht]I know, and it’s for sure something you need to find a fix/solution for. :wink: :wink: :wink: :wink: :wink:

Does that mean Xojo also uses a hack to do this for the iOSTableView? You can now add a container as a cell (which is awesome).[/quote]

I believe containers are special custom controls while on iOS it’s a kind of NSView. That’s different and easier to handle.
iOS doesn’t need to care for other platforms while the standard container is a control for win/lin/osx. It’s rather a window
then a (NS)view I think.

I don’t think Christoph wanted to compare plugins and declares. He merely mentioned his preference I believe.

[quote=277304:@Rob Egal]I believe containers are special custom controls while on iOS it’s a kind of NSView. That’s different and easier to handle.
iOS doesn’t need to care for other platforms while the standard container is a control for win/lin/osx. It’s rather a window
then a (NS)view I think.[/quote]
My guess has always been that ContainerControls are Janus-faced: while developing in the IDE there are NSWindows (this is the guess), while in the running application there are NSViews (this you can test).

[code] Const ObjCRuntimeLib As String = “libobjc.A.dylib”

Declare Function object_getClass Lib ObjCRuntimeLib (obj As Ptr) As Ptr
Declare Function class_getSuperclass Lib ObjCRuntimeLib (cls As Ptr) As Ptr
Declare Function class_getName Lib ObjCRuntimeLib (cls As Ptr) As CString

Dim p As Ptr = object_getClass(Ptr(Me.Handle)) // Me being a ContainerControl instance in a Window
Dim name As String = class_getName§ // XOJView

Dim pSuper As Ptr = class_getSuperclass§
Dim nameSuper As String = class_getName(pSuper) // NSView[/code]

Subclassing NSView within the Objective C Runtime, and overriding the - (void)drawRect:(NSRect)dirtyRect method is possible. Within drawRect one could use the values of the dirtyRect to position the container controls, which act as a replacement of cells.

[quote=277304:@Rob Egal]I believe containers are special custom controls while on iOS it’s a kind of NSView. That’s different and easier to handle.
iOS doesn’t need to care for other platforms while the standard container is a control for win/lin/osx. It’s rather a window
then a (NS)view I think.[/quote]

In iOS Container Control is a Canvas if I am not mistaken, whereas in OS X it is an embedded window.

That is alright, but plugins usually come with a superb service that declares don’t. It is especially critical when one wants to go 64 bit, and 32 bit declares require overhaul. With the plugins I use, it is just a matter of flipping a switch. I dread having to dive in the few declares I use. Not everybody is as fluent in the matter as you are.

I’m guessing this can be done with declares but it would be considered modifying-the-view-hierarchy. Are plugins capable of such a NSView switcheroo in a sanctioned manner? And if so how?

@Rob I’m really digging your Listbox. Do you have plans to support hierarchical and CellPaint, CellMouse? Are varying row heights possible with an NSTableView? Looking forward to the next update.

It is a XOJView, which is a subclass of NSView.

status report:

I have fixed a lot of things (check out the events too) and made a big jump but the class got more complex. There a couple of things which I dislike but I couldn’t find a better solution yet. The biggest challenge is the data model + customization. I need to implement a good way of getting values from each cell so that you can work like cell(x,y).
The most annoying thing is that the cells need to be laid out which is a nightmare if you use controls which auto adjust with the it’s size but it works now (only for textviews). Well, let’s see where it ends up…


https://www.dropbox.com/s/rdzlfe4gw21v8m8/NSTableView.zip?dl=1

Looks promising but the implementation is not easy. :slight_smile:

What do you exactely mean ?

The plugins you may use does all the job for you but in pure xojo you need more glue code and objc<>xojo conversion. I have made some changes already to reduce that and fixed some bugs I’ve spotted.
I am still hoping a versatile plugin creator may leave some suggestions here.

Doing this all in Xojo code illustrates exactly the point that it aint easy making

  • a native listbox
  • that handles adding rows just by adding text OR by a data source so you can handle really large dataset is not trivial
  • has customizable cells
  • and is x-platform

I don’t get your point, Norman. What do you want to say ?

Update:

  • added more options to customize controls
  • added the possibility to use a custom row selection style
  • added a function get the data of the objects like the listbox cell(row,column) method

I am pretty happy. :slight_smile: