Recognizing different methods of code selection

Is there a way for me to recognize a snippet of code which the user has selected by clicking and dragging? Or are carets the only option?

Please sign in to leave a comment.