[Impromptu] NSTableview in Impromptu
Andreas Körner
andi at jaak.de
Thu Sep 24 11:54:44 GMT 2009
(This is the first part of the message but I send it later :)
Okay, I've gone crazy and tried to use a NSTablieview for the UI...
took me the half day for trying to get this working...
I just want to use a NSTableview. I've added it to a simple test nib
File, let the tag be zero and got the connection to it without
problems in Imupromptu.
Now is the Problem that the hole funny Cocoa Bindings Stuff seems to
work with Subclassing and writing your own controller which I can't do
in Impromptu.
So I googled 3 hours for a solution and did't find anything that
really helped.
so far I have:
(define *arrayController* (objc:make "NSArrayController" "init"))
(define *tableView* (objc:call *content-view* "viewWithTag:" 0))
(define *firstCol* (objc:call (objc:call *tableView* "tableColumns")
"objectAtIndex:" 0))
(objc:call *arrayController* "addObject:" (objc:list->nsdictionary
(list (cons "song" "Andi"))))
(objc:call *arrayController* "addObject:" (objc:list->nsdictionary
(list (cons "song" "Leon"))))
(objc:call *firstCol* "bind:toObject:withKeyPath:options:" "Value"
*arrayController* "arrangedObjects.song" 0)
Problems:
=============
* maybe the Dictionary is not KVO compilant?
binding to a simple text field raises this:
(objc:call *arrayController* "setSelectionIndex:" 0)
(define *textView* (objc:call *content-view* "viewWithTag:" 1))
(objc:call *textView* "bind:toObject:withKeyPath:options:"
"Value" *arrayController* "selected.song" 0)
:ERROR: [<NSArrayController 0x11c3b90>
addObserver:<NSObjectParameterBinder 0x11e8960>
forKeyPath:@"selected.song" options:0x0 context:0x11db450] was sent to
an object that is not KVC-compliant for the "selected" property.
Is there a alternative I can use?
* Also the Binding for the Column does raise an error
:ERROR: [<NSTableColumn 0x1714c9c0> valueForUndefinedKey:]: this
class is not key value coding-compliant for the key Value.
Ok, the Problem is more a Cocoa Problem but in "normal" Cocoa you
could solve this another way (I have not too much experience with
Cocoa, just a little)
but here I need to use a Dictionary and a NSArrayController, or are
there other solutions?
I did just want to write a simple horizontal mixer :(
PS:
the gui is initialized this way: (thanks to Oscillating Rhythms)
(define p "/Users/andi/Desktop/")
(objc:call "NSBundle"
"loadNibFile:externalNameTable:withZone:"
(string-append p "test.nib" ) 0 0)
(define *windows* (objc:nsarray->list (objc:call (objc:call
"NSApplication" "sharedApplication") "windows")))
(print *windows*)
(define *window* '())
(for-each (lambda (win)
(let ((title (objc:nsstring->string (objc:call win
"title"))))
(if (string? title)
(if (string=? "Fenster" title)
(set! *window* win)))))
*windows*)
(define *content-view* (objc:call *window* "contentView"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.moso.com.au/pipermail/impromptu/attachments/20090924/87090451/attachment-0001.htm
More information about the Impromptu
mailing list