So, what you want is something like the following (I guess).
If you get a mouse down event this might mean either click or drag, so we'll defer judgement to later. For now just remember that we've received a down event.
If we receive a mouse up event without any mouse move events in between, then this was a click, so do whatever clicking is supposed to do.
If we get a move event before any up event then that's a signal that the user started a drag, so remember that so that when the mouse up event comes we can do whatever drag does.
Am I close? If not then please describe your problem in more detail.