As we know, if Nstextfield gets the focus, we can simply drag a file or a folder from finder then drop in the textfield, the textfield will be filled with the path you dragged. but now I must disable this function to only allow the path of certain file types be dragged into the textfield, for example, the file suffix is .pdf. how should I do? at first, I want to find out whether this function is due to the drag and drop function in the textfield. so I add some code: unregisterdraggedtypes in the subclass from Nstextfield. but it still works on the function of drag and drop from finder. How can I disable it? any help will be appreciated!