Re: allow user to drag controls to make their own interface?
Re: allow user to drag controls to make their own interface?
- Subject: Re: allow user to drag controls to make their own interface?
- From: "M. Uli Kusterer" <email@hidden>
- Date: Thu, 15 Apr 2004 19:59:49 +0200
At 13:06 Uhr -0400 15.04.2004, John Nowak wrote:
Ideally, it would be -great-... beyond great perhaps... if it
would work just like interface builder does, even down to the
intelligent alignment, align menu options, etc.
If you find something that does that, please post your findings to
the list. I'd have use for something like it as well.
Any advice would be appreciated, either conceptually or regarding
details of implementation.
You will probably want to create a NIB file with templates for all
the views the user can drag. You can drag a "Custom View" from the
Interface Builder palette into the "Instances" area of your NIB
file's window to get a plain NSView without a window around it. Then
you can put a control in there.
The advantage of that is that you can create complex combinations of
NSView subclasses which will, to your users, look like they are a
single control. If you set a Custom Class for the containing NSView,
you could probably implement resize handles etc. as well, and
intercept clicks in the subviews while you're in "editing mode".
Whatever you do, you can create a controller class that has an
outlet connected to that view and make it the owner, and write some
code to use NSBundle's NSNibLoading or whatever to load the NIB and
have the outlet automatically filled out.
You can then use NSView methods (see NSView.h) to get an NSImage
from the view's image, which you can pass to the drag and drop API,
and you can use -copy and -addSubview to add such a view to your
window once it's been dropped there.
Another approach would be to use a borderless window for doing the
drag and drop part, which would let you exercise more control over
positioning (like having it snap to a grid). Check out my
UKDockableWindow (on my web site) for an example of using windows as
drag images.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.