• 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
Re: Dynamically Updating Column Titles in NSTableView with Mouse Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically Updating Column Titles in NSTableView with Mouse Events


  • Subject: Re: Dynamically Updating Column Titles in NSTableView with Mouse Events
  • From: Jeff Gilbert <email@hidden>
  • Date: Mon, 19 Jul 2010 21:20:47 -0500

Hi Peter,

On Jul 19, 2010, at 8:54 PM, Peter Zegelin wrote:

> I am trying to dynamically update the titles of my table columns to show the current row that the mouse is over. I am using an NSTrackingArea to get the mouseEnter, mouseMove and mouseExit events and then calling the following method ( in my delegate ) to update the column titles. Unfortunately the column titles never change, though the printf statement shows that the method is being called correctly:
>
> - (void)setColumnTitlesForMouseAt:(int)row{
>
> 	if(row == rowForColumnTitles)		// just to prevent unnecessary updating
> 		return;
>
> 	rowForColumnTitles = row;
>
> 	printf("\n x: ",row);
>
> 	NSTableColumn*	column;
> 	int					i;
>
> 	for(i = 1; i <= 16; ++i){
> 		column = [[itsTableView tableColumns] objectAtIndex:i];
> 		[[column headerCell] setStringValue:[NSString stringWithFormat:@"X",rowForColumnTitles]];
> 	}
>
> 	//[itsTableView displayIfNeeded];
> 	//[itsTableView setNeedsDisplay: YES];
> }


I do something similar and found the following works for me:

// update column headers
...

// force the table to redraw the headers
[[table headerView] setNeedsDisplay:YES];

Good luck,
Jeff Gilbert
_______________________________________________

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: Dynamically Updating Column Titles in NSTableView with Mouse Events
      • From: Peter Zegelin <email@hidden>
References: 
 >Dynamically Updating Column Titles in NSTableView with Mouse Events (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Re: Dynamically Updating Column Titles in NSTableView with Mouse Events
  • Next by Date: Using XSLT functions with NSXMLDocument
  • Previous by thread: Re: Dynamically Updating Column Titles in NSTableView with Mouse Events
  • Next by thread: Re: Dynamically Updating Column Titles in NSTableView with Mouse Events
  • Index(es):
    • Date
    • Thread