• 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: Newbie Question: Best view for list of strings? (Addendum: weird horizontal scrollbar/resize issues)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Question: Best view for list of strings? (Addendum: weird horizontal scrollbar/resize issues)


  • Subject: Re: Newbie Question: Best view for list of strings? (Addendum: weird horizontal scrollbar/resize issues)
  • From: James Farwell <email@hidden>
  • Date: Fri, 4 Apr 2003 19:21:00 -0800

Chris,

I'm still getting some pretty odd behavior with the horizontal scrollbar, do you think you could possibly send me the code/project for the test app you wrote so I can muck with it and compare it? Thanks!

- James

On Friday, April 4, 2003, at 11:32 AM, Chris Giordano wrote:

James,

On Friday, April 4, 2003, at 01:22 PM, James Farwell wrote:

Ok, cool, I'll check out tableViewColumnDidResize:. In terms of the loop problem, I'm doing something similar with tableViewSelectionIsChanging:, I wanted to make it so that selecting a row in one table selects the same row in the other table, but obviously, calling selectRow:byExtendingSelection: leads to another call of tableViewSelectionIsChanging: for the opposite table. My solution was to use a static boolean flag inside the function that the function sets on the first call and clears when the first call is finished, allowing further calls to the function to be able to tell if it is running already or not,. It's a little odd, I admit, but it seems to be working nicely, and its probably more thread-safe than temporarily removing the delegate? Here is a simplified version of the code:

<snip>

That thought passed through my mind very briefly, but it was a bit more complicated than I wanted to deal with at the time. You could probably do the same kind of thing with the resize handler, but I'd first look at all of the times its called and the various values it's called with (the column's width at the time it's called, the NSOldWidth in the notification's userInfo, and your max string width) since I was getting some unexpected results at times. Actually that method gets called before the nib is loaded, so there can be some odd side effects if you don't code things robustly enough, although you could also just make sure that the tableView's delegate isn't hooked up until after the nib is loaded.

As far as the other weird behavior I'm seeing with the nib fix, it does seem to work in a majority of cases, but try this: resize the window so the table is wider than the longest string and it no longer needs the horizontal scrollbar, and then bring it back to its original size. For me, the scrollbar reappears when the table becomes slightly smaller than the biggest string, but then never scales itself with the further reduction in width. It's almost as if the tableview is autoresizing the column again, but it is keeping my pad so that the end of the column is always #pad# units (pixels?) wider than the clipped view. Very odd, I wonder if it has something to do with me always keeping the column width and maxwidth the same? I'll try implementing your delegate method to see if that works. Thanks a bunch!

I tried to reproduce your results. The only time that it didn't work as expected was when I had the table autoresize the columns and have the column be resizable without using the tableViewColumnDidResize: method (which gave me the expected original results where the scrollbar disappeared when anything was resized). All other times the horizontal scrollbar seemed to accurately reflect the proportion of the total column displayed.

Uneducated guess: it has to do with the maxWidth. That's the only difference so far as I can tell.

Good luck.

chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Newbie Question: Best view for list of strings? (Addendum: weird horizontal scrollbar/resize issues) (From: Chris Giordano <email@hidden>)

  • Prev by Date: NSScanner stoopid question
  • Next by Date: Re: resizing cells with NSBrowser
  • Previous by thread: Re: Newbie Question: Best view for list of strings? (Addendum: weird horizontal scrollbar/resize issues)
  • Next by thread: Handling blank CD insert
  • Index(es):
    • Date
    • Thread