• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Repositioning the Field Editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Repositioning the Field Editor


  • Subject: Repositioning the Field Editor
  • From: "K. Darcy Otto" <email@hidden>
  • Date: Mon, 27 Apr 2009 19:19:20 -0700

I have a field editor which I need to reposition in my tableView – specifically, I need to move it a few pixels to the right. The following post:

http://www.cocoabuilder.com/archive/message/cocoa/2009/3/16/232513

makes two suggestions: (i) implement the move in -viewWillDraw in the field editor subclass, and (ii) reposition the field editor after calling super in -editColumn:row:withEvent:select: in the tableView subclass. Neither of these seem to make any difference to where the field editor is drawn. Here is my code with respect to (i), contained in the field editor subclass:

-(void)viewWillDraw
{
	NSRect frame = [self frame];
	NSLog(@"Old: %f",frame.origin.x);
	frame.origin.x += 50.0;
	[self setFrame:frame];
	frame = [self frame];
	NSLog(@"New: %f",frame.origin.x);

	[super viewWillDraw];
}

Now, I can confirm this method is being called, and by means of the NSLog statements, the frame is being changed prior to the call to super. Unfortunately, the field editor is drawn where is usually is drawn, with no shift in place.

With respect to (ii), contained in the tableView subclass:

-(void)editColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:(BOOL)flag
{
[super editColumn:columnIndex row:rowIndex withEvent:theEvent select:flag];
NSText *fieldEditor = [[self window] fieldEditor:YES forObject:self];
NSRect fieldEditorFrame = [fieldEditor frame];
fieldEditorFrame.origin.x += 50.0;
[fieldEditor setFrame:fieldEditorFrame];
}


Here, it turns out that even though fieldEditor points to the custom field editor object, fieldEditorFrame turns out to be empty. And again, the field editor is drawn where it is usually drawn, with no shift in place.

Any help would be greatly appreciated._______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Repositioning the Field Editor
      • From: "K. Darcy Otto" <email@hidden>
  • Prev by Date: Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
  • Next by Date: Re: Problem with 'launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:'???
  • Previous by thread: Re: URL Parsing
  • Next by thread: Re: Repositioning the Field Editor
  • Index(es):
    • Date
    • Thread