Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:38:43+00:00 2026-05-13T15:38:43+00:00

I am trying to setup an NSTableView programmatically (I really need to avoid using

  • 0

I am trying to setup an NSTableView programmatically (I really need to avoid using IB) and all the examples I find explain how to do this using the interface building. I have created a controller class that implements the methods tableView:objectValueForTableColumn:row: and numberOfRowsInTableView: but they never get called.
After I set up the table-view and scroll-view I called setDelegate: and setDataSource: with the controller class that implemented numberOfRowsInTableView:. Unfortunately when I run the code it never calls numberOfRowsInTableView: or tableView:objectValueForTableColumn:row:. Do I need to call something besides setDelegate: and setDataSource: to accomplish what I am trying to do?
I am writing this code in clozure-cl (a lisp environment that includes a cocoa-lisp bridge) and I believe most cocoa developers here are unlikely to be lisp enthusiasts so it seems that posting code my not be fruitful but if anyone could give me any suggestions or links to objective-c code that does this whole process without using the the IB that would be great.

EDIT:

Here is a bit of my lisp code I’ll try and add comments to make it more clear to non lisp cocoa developers.

(defmethod DISPLAY-TABLE-VIEW ((Self table-view))
(with-simple-restart (cancel-pop "Stop trying to pop up ~s" Self)
(in-main-thread ()
  (ccl::with-autorelease-pool
      ;let statements are just declarations of local variables in lisp
      ;this one just creates the window I want to put the table-view inside
      (let ((Window (make-instance 'popup-window
                      :lui-window Self
                      :with-content-rect (ns:make-ns-rect  (x self) (y self) (width Self) 500 )
                      :style-mask 3
                      :backing #$NSBackingStoreBuffered
                      :defer t)))
        (setf (native-window Self) Window)  ;; need to have this reference for the delegate to be in place
        (setf (native-view Self) (make-instance 'popup-window-view :lui-window Self ))              
        ;; setup delegate
        (setf (delegate Window) (make-instance 'popup-delegate :lui-window Self))
        (#/setDelegate: Window (delegate Window))
        ;    (#/setStyleMask: Window 1)
        ;here I create first a table-view then a scroll-view the an NSView and 
        ;finally a column
        (let ((table-view (#/alloc ns:ns-outline-view)))
          (let ((scroll-view (#/alloc ns:ns-scroll-view)))
            (let ((content-view (#/alloc ns:ns-view)))
              (let ((column (#/alloc ns:ns-table-column)))             
                (setf content-view (#/contentView Window))
                (ns:with-ns-rect (Frame 0 0 100 100)
                  ;here we initialize the table-view the scroll-view and column then
                  ;add the column
                  (#/init table-view)
                  (#/initWithFrame: scroll-view (#/frame (#/contentView Window)))
                  (#/initWithIdentifier: column (native-string "0"))
                  (#/addTableColumn: table-view column)
                  ;make an instance of my controller class which is an nsObject 
                  ;I also tried to make it an NSWindowController but that didn't help
                  (let ((package-view (make-instance 'table-view-controller)))
                    ;set the data source and the delegate

                    (#/setDataSource: table-view package-view)
                    (#/setDelegate: table-view package-view)))
                (#/setHasVerticalScroller: scroll-view #$YES)
                (#/setDocumentView: scroll-view table-view)
                (#/setAutoresizesSubviews:  (#/contentView Window) #$YES) 

                (#/addSubview: (#/contentView Window) scroll-view))))
          (#/reloadData: table-view))
        (#/setHasShadow: Window #$YES)
        ;display the window
        (#/makeKeyAndOrderFront: Window Window))))))

Here is a snipet from my numberOfRowsInTableView: method which is part of my controller table-view-controller (this call is a of NSObject).

(objc:defmethod (#/numberOfRowsInTableView: #>NSInteger) 
  ((self table-view-controller) (tab :id))
    (print "hello")
  ;;... then do other things but just seeing the print statement would be a great step
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:38:44+00:00Added an answer on May 13, 2026 at 3:38 pm
        (let ((table-view (#/alloc ns:ns-outline-view)))
                  (#/init table-view)
    

    Don’t ever send init to an instance of an NSView class. Always use initWithFrame:.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 298k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Take a look at EscapeCommFunction. EscapeCommFunction(hPort, SETRTS); The hardware handshaking… May 13, 2026 at 7:32 pm
  • Editorial Team
    Editorial Team added an answer the grails-app/utils/ directory is where items like Codecs go. I'm… May 13, 2026 at 7:32 pm
  • Editorial Team
    Editorial Team added an answer That's an infinite loop. No conditions, just loop forever. The… May 13, 2026 at 7:32 pm

Related Questions

I am trying to setup an SVN for the first time, I chose tortoiseSVN
I am trying to setup an automated build of my Windows CE application. However,
I am trying to create an intermediate model between two models that I'd like
I am learning linq to sql and I am trying to setup a lookup
I am trying to create a file in Windows XP that is only the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.