Re: Need HELP - Dragging a view
Re: Need HELP - Dragging a view
- Subject: Re: Need HELP - Dragging a view
- From: Keith Wilson <email@hidden>
- Date: Fri, 3 Mar 2006 02:48:05 +1100
I'd like to do the second choice - I'd like to see the connections
"moving"
while dragging the subview.
Thanks.
In both options you can see the connections moving - use whichever
your user(s) like.
You need to make a decision about the structure of your mainView -
subviews. I assume the subviews are something like NSTextViews ?
Option 1: Have many NSTextViews that are subViews of the main view -
joined by connector lines.
Option 2: Compose into a textview in memory BUT draw directly onto
the main view using boxes and lines and text-in-a-box. Save an array
of all the objects that includes variables like objectId, name, date,
etc, and the position it was last drawn (a rectangle). When the user
clicks on the screen call a method called getClickedObject that spins
through the array doing PointInRect until it finds the
clickedObject. Then if you want the user to be able to edit-in-
place, overlay the selectedObject with a NSTextView - it's acting as
a fieldEditor. Connecting lines can also be handles in an array -
they are just long skinny rectangles - or you can use the
NSBezierPath methods to decide which line was clicked on. You will
notice that we now have an array of objects with a selectedObject and
you may like to think about how to use an NSArrayController to handle
it all - plus maybe a CoreData managedObjectModel. Each of the
objects in the array knows how and where to draw itself as well as
how to draw its connector lines.
Option 2 allows you lots of flexibility and avoids managing lots of
subviews - it's all held in array(s), it's under your control and and
it's fast.
If you have not already done so I suggest that you have a look at the
Appkit examples for BezierPath Lab and Sketch.
Keith
On 03/03/2006, at 1:40 AM, "" <email@hidden>
<email@hidden> wrote:
-------->
I'd like to do the second choice - I'd like to see the connections
"moving"
while dragging the subview.
Thanks.
------------------
Keith Wilson wrote:
Looks like I was wrong about Scott's solution leaving a white trail -
sorry Scott.
One more question for David:
Do you want the display of the original view and connections
unchanged while an object is moved and the new object position and
the new rubber-bands shown as a (semi-transparent ?) view on top of
the original view?
Or do you want to obliterate the original view and just see the
current view and the connections during the drag?
You can do lots of squizzy things with a mac - some take more coding
than others. But none of them should ever be s l o w.
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden