Re: NSProgressIndicator and other controls in a cell in an NSTableView?
Re: NSProgressIndicator and other controls in a cell in an NSTableView?
- Subject: Re: NSProgressIndicator and other controls in a cell in an NSTableView?
- From: David Remahl <email@hidden>
- Date: Tue, 07 Aug 2001 18:03:28 +0200
on 01-08-07 17.50, l.m.orchard at email@hidden wrote:
>
Okay... moving along with my multi-threaded download manager, I'm
>
starting to play with NSTableView. So far I understand how to create a
>
class to act as data source to the table view.
>
>
So, I have a list in my app of all the download threads currently running.
>
Each element in the list can report things like the URL being downloaded
>
and the progress so far. I want these in the TableView, and I assume I
>
want to call reloadData: in intervals to reflect the download progress of
>
the threads. (At first I thought I'd have each download thread notify the
>
datasource when they changed, which would in turn notify the TableView,
>
but I figured making the table view reload the data every time a thread
>
progressed at all would be a bit heavy. Should I not worry about this?)
>
>
Anyway, the next question I have it... okay I can display 0-100% in the
>
table view in text, but can I somehow stick an NSProgressIndicator in
>
there instead? And maybe even have a small "Cancel" button in the next
>
column? Or is this just not a good idea at all?
Since NSProgressIndicator is a View and not a control, it doesn't have a
cell counterpart. If it had, you could use that to send to NSTableColumn's
setDataCell: and everything would be great (chances are you would then have
had to change only a very few lines from your string approach, and it would
work.)
Now, that isn't the case. You will have to make a NSCell subclass and make
that draw a progress view according to its own value.
/ david