• 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
dynamically resizing NSTable's rows and the field editor at the same time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamically resizing NSTable's rows and the field editor at the same time


  • Subject: dynamically resizing NSTable's rows and the field editor at the same time
  • From: Joshua Nedrud <email@hidden>
  • Date: Fri, 15 Jun 2007 11:23:55 -0500

Hey guys and gals out there,
I am trying to create a program that displays guitar songs on a system with two displays, I have worked out most things on my own so far, however I am running into problems with displaying the song with chords. My approach to this is to create a NSTable that will contain a column where each row is a verse/chorus. I have successfully implemented this and even have each row size to the correct height to contain all text in the verse/chorus.
My problem comes in when I am attempting to dynamically resize the field editor as I edit a verse to a song. I have set the cell to wrap text, so as I write past the end of the line the text wraps and notifies the layoutManager for the field editor that the layout was invalidated, I catch this message in a delegate to the layout manager with:
- (void)layoutManagerDidInvalidateLayout:(NSLayoutManager *) aLayoutManager
In this function I compute the size needed to show the entire string wrapped to the width of the column the cell is in. I have confirmed that the height is correct using NSLog. Then I store this information into a data structure and then call:
[customTable noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:currentRowBeingEdited]];
this calls
- (float)tableView:(NSTableView *)tableView heightOfRow:(int)row
this then looks up the data structure written to previously as noted above and resizes the Table's row. This all works correctly, I am putting this here so you know what is working so far and the paths I have tried. (I know it works correctly as the rows below the current edited row will move up and down as I place text that wraps or delete a word that caused text wrapping)
What is not working is that when I have the field editor resize by calling:
[fieldEditor sizeToFit];
The actual editor resizes correctly, however the container for the editor does not resize, I am considering the blue outline that you see when you edit text the container. What happens is that the field editor simply moves up so that the line that is currently being edited shows in this small blue box. What I want to happen is the blue box resize to the size of the cell and then the field editor will show the entire verse/chorus being edited.
One more point of interest when you resize the applications window that has this customTable in it, the blue box resizes to the size of the cell and the field editor fits in just like I want. I have tried stepping through the various function calls to see which function is called where all the magic that I want done happens but I cannot find it. I have also used sampler to determine if I can find the function calls here, but again I have had no luck. I am sorry if this is too much information or not the information needed, this is my first post and I read a couple of articles on how to write a good question post, and tried to follow their helpful hints, but if you could also steer me to what information was needed and what stuff I can do away with in new posts that would be helpful. Thanks for all your help, I have spent countless hours trying to figure this out and searching the vast internet for answers, but I have not been able to find one yet.
Joshua
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: RE: Fetch request problem with core data relationship and NSTableView
  • Next by Date: Re: Fetch request problem with core data relationship and NSTableView
  • Previous by thread: HUD text edit app?
  • Next by thread: Foreign Characters
  • Index(es):
    • Date
    • Thread