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 4581532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:56:28+00:00 2026-05-21T20:56:28+00:00

Ok, I think the question I had here was long-winded and difficult to get

  • 0

Ok, I think the question I had here was long-winded and difficult to get through. I’ll simplify my question:

  • I have a class called InController.
  • InController has a method called nextPage that tells an int variable, inPageNumber, to add one onto itself and to call on another InController method called updateTable.
  • updateTable clears a table, inTable, of its current data and fills it with data relevant to the page number it retrieves from inPageNumber.
  • The table, inTable, is contained inside an NSBox with specific printing requirements.
  • I subclassed NSBox into a class called CustomViewPagination to meet these printing requirements, overriding its paginations methods. Basically, when a new printing page is required, it attempts to print the same area again, but calls on nextPage to fill the table with the data of the sequential page.

With me so far?

One of the pagination methods I overrided in CustomViewPagination, beginPageInRect, is automatically called for each printed page by default. Because of this, I placed a call to my InController method of nextPage, to change the inTable data for the current printing page.

My problem is when I call nextPage (which is a method in InController) from my CustomViewPagination class. It does nothing and when I debug it I find that all the variables required in the method are nil. However, they are the correct values when I call nextPage from inside InController.


File Extracts:

InController.h:

#import <Cocoa/Cocoa.h>
#import "CustomViewPagination.h"

@interface InController : NSObject {
    IBOutlet NSWindow *inPreview;
    IBOutlet CustomViewPagination *inSheet;
    NSArray *iSelectedIn;
    NSMutableArray *records;
    int inPageNumber;
}
@property (nonatomic, retain) NSArray *iSelectedIn;
@property (nonatomic, retain) NSMutableArray *records;

InController.m:

#import "InController.h"

@implementation InController

@synthesize iSelectedIn, records;

- (IBAction) inNextPage:(id)sender {
    inPageNumber = inPageNumber + 1;
    NSLog(@"inPageNumber called ok");
    [self updateIn];
}


- (IBAction)updateInvoice:(id)sender {
    //wipe all current records and refresh empty table
    [records removeAllObjects];
    [inPreviewTable reloadData];
    for (NSArray *s in [[iSelectedIn valueForKey:@"inJobList"] lastObject]) {
        NSString *jLT = [s valueForKey:@"inJT"];
        NSString *jLH = [s valueForKey:@"inJHo"];
        NSString *jLC = [s valueForKey:@"inJC"];
        // etc.
        // if CustomViewPagination called this, records is nil, so nothing
        // is cleared, and there's no *s for iSelectedIn as iSelectedIn
        // is found to be nil. If InController called this, it works fine.

CustomViewPagination.h:

#import <Cocoa/Cocoa.h>

@class InController;

@interface CustomViewPagination : NSBox {
    InController *inControllerInstance;
}

@end

CustomViewPagination.m:

#import "CustomViewPagination.h"
#import "InController.h"

@implementation CustomViewPagination

- (void) awakeFromNib {
    inControllerInstance = [[InController alloc] init];
}

- (void)beginPageInRect:(NSRect)aRect atPlacement:(NSPoint)location {
    int pageCounter = [[NSPrintOperation currentOperation] currentPage];
    if (pageCounter == 1) {
        // Don't respond to 1st page, do nothing.
    } else {
        [inControllerInstance inNextPage:self];
    }
    [super beginPageInRect:aRect atPlacement:location];
}

@end
  • 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-21T20:56:29+00:00Added an answer on May 21, 2026 at 8:56 pm

    You are using 2 IBOutlets in InController (inPreview & inSheet), but InController is created programmatically in CustomViewPagination's awakeFromNib.

    How are the Outlets connected? (Can’t be from within IB, as you are creating the InController instance programmatically). This would be an explanation why both are nil.

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

Sidebar

Related Questions

I had a long detailed question about how to get a specific calendar's event
As per another question I had asked earlier I think I may have found
Some of the answers to a question I had about redirect_to made me think
I think the question says it all. I have several monthly processes in stored
I have a pretty big chat app I'm working on, and had a question
I have been doing some functional programming and had a question. Perhaps I might
Looking at the related questions, I don't think this specific question has been asked,
I had a question before about implementing datepicker with jqgrid. I think that question
I posted a question about why my $.getJSON had stopped but I think the
Apologies for another question, I think I shall re-phrase my original question here as

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.