Re: L-shaped custom view in Cocoa?
Yes, I need to write virtual keyboard. 05-May-11 21:11, Kyle Sluder пишет: On Thu, May 5, 2011 at 10:59 AM, Shawn Bakhtiarshashan...@hotmail.com wrote: What? It does too work! Once the window is setup correctly. This is how a do all my transparent windows, and for any naysayers out there here is the code: http://www.inksystemsinc.com/images/lshaped_window_proof.tar.gz I have seen no indication from the OP that he is trying to draw a transparent window. All he's said is that he wants an L-shaped view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: L-shaped custom view in Cocoa?
What? It does too work! Once the window is setup correctly. This is how a do all my transparent windows, and for any naysayers out there here is the code: http://www.inksystemsinc.com/images/lshaped_window_proof.tar.gz It is obviously not as simple as the two sudo lines of code I put there, but I was trying not write the damn things for him, and set him on the write path instead, as I'm sure with the Transparent window samples available on the net and in the docs he can manage to figure out how to setup the window and view for this to work, and now instead of him figuring it out (learning to fish), I did it for him and it took me all but 5 minutes using code I already had written (you made me toss him fish instead, just to show it CAN be done) :) Filling a rect DOES NOT NUKE anything, you simply need to override the defaults which are optimized for rectangular non transparencies areas to make them faster. It's not that they can't its just faster not too, so that is the default. Date: Wed, 4 May 2011 18:02:56 -0700 Subject: Re: L-shaped custom view in Cocoa? From: kyle.slu...@gmail.com To: shashan...@hotmail.com CC: cocoa-dev@lists.apple.com On Wed, May 4, 2011 at 1:09 PM, Shawn Bakhtiar shashan...@hotmail.com wrote: Actually you only need one view. Subclass it, and over ride the draw method [[NSColor clearColor] set] NSFillRect(...) - the size you want to clear out. Don't do this. It doesn't do what you think it does. The window only has one backing store bitmap. All normal views are drawn into this bitmap in order. So filling a rect with clearColor actually nukes the background of the window. It'll draw as a black rectangle on your screen. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
On Thu, May 5, 2011 at 10:59 AM, Shawn Bakhtiar shashan...@hotmail.com wrote: What? It does too work! Once the window is setup correctly. This is how a do all my transparent windows, and for any naysayers out there here is the code: http://www.inksystemsinc.com/images/lshaped_window_proof.tar.gz I have seen no indication from the OP that he is trying to draw a transparent window. All he's said is that he wants an L-shaped view. Filling a rect DOES NOT NUKE anything, you simply need to override the defaults which are optimized for rectangular non transparencies areas to make them faster. It's not that they can't its just faster not too, so that is the default. Yes, filling a rect DOES nuke things. It overwrites the window backing store. If you have a transparent window, that's probably what you want. But a lot of people operate under the mistaken belief that each view is drawn into its own backing store, and then all the views' backing stores are composited together. Such a setup would make it safe for views in opaque windows to blithely clear their backing stores, but because this is not the case, filling with clearColor is probably not what you want. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
L-shaped custom view in Cocoa?
Hi All! I need to make custom view in the form of letter L. How to do it? Thank you in advance, Vyacheslav. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
On May 4, 2011, at 8:41 AM, Vyacheslav Karamov wrote: I need to make custom view in the form of letter L. How to do it? You don't need to. You may think you do, but you don't. And you can't. Just make a regular rectangular view and only draw in the parts you want to. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
All views are rectangular in shape. You can restrict drawing and responding to events to an L-shaped area, but the view itself will still be a rectangle. On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote: I need to make custom view in the form of letter L. How to do it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
Yes, I understand, I meant want to know how to restrict drawing and responding to events to L-shaped area. 04-May-11 17:38, Steve Christensen пишет: All views are rectangular in shape. You can restrict drawing and responding to events to an L-shaped area, but the view itself will still be a rectangle. On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote: I need to make custom view in the form of letter L. How to do it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
On May 4, 2011, at 10:21 AM, Vyacheslav Karamov wrote: Yes, I understand, I meant want to know how to restrict drawing and responding to events to L-shaped area. You are responsible for writing the drawing code and the code which responds to events. In your drawing code, just don't draw in the part which isn't in the L shape. If you prefer, you can clip the graphics context to enforce that. See the -[NSBezierPath addClip] method. For events which have location associated with them, you should check the location and just invoke super for any which fall outside of the L shape. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
You could either use a path or a pair of rectangles to clip drawing and test for events such as a mouseDown or tap. You'll need to calculate the dimensions based on the current size of the view. On May 4, 2011, at 8:21 AM, Vyacheslav Karamov wrote: Yes, I understand, I meant want to know how to restrict drawing and responding to events to L-shaped area. 04-May-11 17:38, Steve Christensen пишет: All views are rectangular in shape. You can restrict drawing and responding to events to an L-shaped area, but the view itself will still be a rectangle. On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote: I need to make custom view in the form of letter L. How to do it? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
On May 4, 2011, at 08:38, Ken Thomases wrote: For events which have location associated with them, you should check the location and just invoke super for any which fall outside of the L shape. There's also -[NSView hitTest] for customizing the behavior at a slightly higher lever than redirecting events. This might help an odd-shaped view be a better citizen when placed in a window with other views. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
You can create it from two rectangular views, perhaps rotating the one, depending on your needs. Regards, Bertil___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: L-shaped custom view in Cocoa?
On Wed, May 4, 2011 at 1:09 PM, Shawn Bakhtiar shashan...@hotmail.com wrote: Actually you only need one view. Subclass it, and over ride the draw method [[NSColor clearColor] set] NSFillRect(...) - the size you want to clear out. Don't do this. It doesn't do what you think it does. The window only has one backing store bitmap. All normal views are drawn into this bitmap in order. So filling a rect with clearColor actually nukes the background of the window. It'll draw as a black rectangle on your screen. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com