• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing order of views dynamically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing order of views dynamically


  • Subject: Re: Changing order of views dynamically
  • From: Sergey Shapovalov <email@hidden>
  • Date: Sun, 25 Mar 2007 15:52:19 +0400

Hello Ronny,

as a result of the discussion, I decided to totally re-design my custom control implementation. It was not an easy decision as the previous implementation already did work in almost full functionality. But in the end I decided that not waking up in the middle of the night due to "my control stops working with next Mac OS update from Apple" nightmare is worth of spending a couple more days on it. :)

Now my control has no sub-controls. It even has no sub-views. I perform all the drawing myself, by hand. Well, actually I have buttons in my control, but I just create them and tell them to draw their cells where I need. The code is like this:

	NSButton* btn = [[[NSButton alloc] init] autorelease];
	// ... (set button options) ...
	[[btn cell] drawWithFrame: myRectForButton inView: myControlView];

I don't actually include the buttons into my view hierarchy. The only thing I employ NSButton class for is drawing a button image. Of course I could use a grey rectangle or an arbitrary image instead, but I just like the way textured square buttons look in Cocoa.

I hope this trick is not illegal. At least it does work for me (even though my recent experience shows that this is not a criterion for legality). :)

I draw the sub-entities of my control myself in the order I want. I handle mouseDown, mouseUp and mouseDragged events at the level of my control, then check the coordinates (to which sub-entity they correspond) and handle respectively. More work to do than with real sub-controls, but this seems to be the only approach Apple guaranties to work in my case.

Best regards,
Sergey.

On Mar 25, 2007, at 11:00 AM, Ronny Reichmann wrote:

Hello Sergey,

after the dicussion of what can be assumed and what not, your problem isn't solved. Is I did understand it, your problem is dragging a little frame-knob around and you want the z-order in which they appear clearified. Your solution could be using a dragging-image and not trying to drag the whole view "live". For that reason you should read "Drag and Drop Programming Topics for Cocoa" from the documentation.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Changing order of views dynamically
      • From: Sherm Pendley <email@hidden>
References: 
 >Re: Changing order of views dynamically (From: Sergey Shapovalov <email@hidden>)
 >Re: Changing order of views dynamically (From: Ronny Reichmann <email@hidden>)

  • Prev by Date: Re: Progress Sheet on a NSDocument
  • Next by Date: Re: Progress Sheet on a NSDocument
  • Previous by thread: Re: Changing order of views dynamically
  • Next by thread: Re: Changing order of views dynamically
  • Index(es):
    • Date
    • Thread