Is there a simple way to create a selectable NSRect in Cocoa? In need a rectangle that can be selected and stays selected after a mouse click.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Though not as immediate as you would like, you may be interested in the management of tracking rectangles and tracking areas performed by
NSViewclass.This mechanism allows you to define specific areas of your custom view. Then, an event is generated whenever the cursor enters or leaves the area, or a mouse button is pressed in this area (
-mouseEntered:,-mouseExited:,-mouseDown:,-mouseUp:,-mouseDragged:, … ofNSResponderclass). This up to you to define what you want your application do in response to these events (set the rectangle as selected and display it accordingly).