Re: Cocoa : Drag/ drop from a table view onto a NSTextfield
Re: Cocoa : Drag/ drop from a table view onto a NSTextfield
- Subject: Re: Cocoa : Drag/ drop from a table view onto a NSTextfield
- From: Marco Masser <email@hidden>
- Date: Sun, 13 Jul 2008 12:27:52 +0200
1. I have a text field and a table view in 2 different windows.
I drag and drop a row from the table view to the textfield.
Now, after drop, i would want to have a database transaction.
I would want to validate the text that i have dropped onto the text
field,
and save the text that i have dropped onto the text field in the
database.
Could you please let me know as to which method can i use to tell me
that
the drop has been completed? So that i can do my front end
validations on
the text that i have dropped.
Take a look at the Drag and Drop Programming Topics for Cocoa
Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragdestination.html#/
/apple_ref/doc/uid/20000977-BAJBJFBG
All the messages sent to the drag receiver are listed there. For your
database transaction, -concludeDragOperation: seems to be reasonable.
2. Suppose a text is already present in a text field. Now, since the
text
field is editable, i can drag and drop another row of the table view
onto
this text field.
Now, the new text would be superimposed on the old text in the text
field.
Is there a way, i can prevent this from happening?
The -prepareForDragOperation: and/or -performDragOperation: are the
methods you'd place the handling of that into. You need an IBOutlet to
your text field to store the string that is already entered and
somehow merge it with the string coming from the drag operation.
Marco
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden