[Drawkit] two views, different layers?

James Maxwell jbmaxwell at rubato-music.com
Tue Jul 29 10:42:32 PDT 2008


The technique of having my special layer only draw to certain views  
works perfectly, so thanks for that suggestion, Graham.
But once I got that set up and working, I started running into other  
snags...
Does anyone know if there's a built-in mechanism to set the active  
layer using the view? Since I have two object drawing layers which are  
intended to be exclusive to their own views, I'd like to be able to  
automatically set a given layer to "active" when mouse events are sent  
by a given view.
So, click view A --> activate layer A, click view B --> activate layer  
B.

This seems like it should be possible, but I can't find anywhere to do  
it.

J.


On 28-Jul-08, at 5:37 PM, Graham Cox wrote:

>
> On 29 Jul 2008, at 2:01 am, James Maxwell wrote:
>
>> Well, this is what I was wondering about yesterday - the idea of  
>> having one view draw only layers A, B, C, and another draw only  
>> layers A, B, D. That would be great. You mentioned the idea of  
>> tweaking drawRect a little to ask the view which layers to draw. Is  
>> that still your recommendation?
>
>
> I'm not really "recommending" anything. There are several possible  
> ways to implement what you need, so you'll need to figure out what's  
> best for your app. If you can avoid subclassing the layer that might  
> be a good idea (unless you are doing so for other reasons anyway),  
> but somewhere you'll have to subclass something, be it the layer or  
> the view or both. Possibly the view-only scheme could be simplest,  
> and least likely to get tripped up by something that DK expects to  
> be a certain way. In MVC terms this is probably cleanest too.
>
> You might have to try different ideas until the right solution  
> becomes obvious by natural selection ;-)
>
> cheers, Graham
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list