Plot your data into an offscreen buffer and then then draw the
resulting image in your custom view (NSGraphicsContext +
NSBitmapImageRep or CGContext + CGImage). OR do as you suggested.
For example:
- (void)drawRect:rect x:x y:y
{
[self setX:x y:y];
[self setNeedsDisplayInRect:rect];
}
On 6/27/06, Daniel J Farrell < email@hidden> wrote:
Hi Atze,
Thanks for that.
From reading the documentation on -display I see it calls -drawRect.
I'm not so clear on how to pass in the data (see below)? You suggest
that I add an instance variable to the custom view class.
Do you think this will work:
Add a new instance variable to the custom view class:
NSPointArray data;
Then add an method such as -setData: to fill this with NSPoint
values.
Then change the -drawRect: method to always draw the data that is in
it's data instance.
How do I get the data into the -setData: method in the first place?
You see, I would like my programme to every now again send some data
for plotting to the custom view class once it has finished a
particular chunk of computation. I don't require a GUI because I'm
just number crunching. The way I work at the moment is to just go
into the code change the path to the initial data and recompile (the
programme is fairly small and only takes seconds to build). It's the
computation on this initial data (as it becomes more refined) that I
to set to the setData: method for plotting, every few seconds.
Regards,
Daniel.
On 27 Jun 2006, at 12:33, Alexander Spohr wrote:
>
> Am 27.06.2006 um 12:10 schrieb Daniel J Farrell:
>
>> Hi folks,
>>
>> I have a CustomView that does some NSBezierPath drawing from an
>> array of data point that I pass it: I'm plotting some scientific
>> data.
>>
>> At the moment the only way I can get a custom view to draw is my
>> placing the data inside the -drawRect: method. So my question is:
>> How can I make a method that will plot my data on the custom view
>> every time I call the method e.g. something like -
>> drawRect:WithXData:YData: ?
>
> you won't.
> set the data in some ivars, then call -display
> or let your CustomView drag the data in -drawRect:
>
> evething else would be working against the appkit.
>
> atze
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden