How can I implement labels without the overhead of an NSTextField?
How can I implement labels without the overhead of an NSTextField?
- Subject: How can I implement labels without the overhead of an NSTextField?
- From: email@hidden
- Date: Sun, 12 Dec 2004 09:23:29 +0000
Summary:
I put an NSImageView inside an NSScrollView. It scrolls smoothly. I put a large number (300) of labels inside an NSScrollView. It scrolls slowly. Why is this happening, and what can I do to change it?
Details:
I have an application that needs to display a large number of labels on screen at once. These labels must be scrolled, so I decided to use an NSScrollView. I first tested the NSScrollView out with an image, out of curiousity. It worked fine; the scrolling was smooth and responsive. Then I tested it out with a large number of labels. The scrolling slowed down considerably. This suprised me, as I thought a large number of labels would scroll as fast as an image. After all, I could display an image with the text of the 300 labels, and it would look exactly the same to the user. Then I discovered that labels in Cocoa are actually non-editable NSTextViews. Could this be the cause of the problem? Either way, how would I go about speeding up the scrolling?
Making each label into an NSImageView wouldn't work. I tried putting 300 NSImageViews onto the window in place of 300 labels, and it was even slower. I suspect that generating a new transparent image (containing the text of each label) to cover the entire window, upon each movement of the scrollbar, would be just as slow. Perhaps I would be able to override the NSTextField (or NSImageView) class to create a "lite" version that incurred less overhead? Any pointers on how to do this would be appreciated, as I am new to both Cocoa and Object Oriented Programming.
One last thing - the 300 labels are scattered about the screen, and are not in orderly rows and columns.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden