Exercises

  1. Explain the purpose of the assumeInside: flag in the addTrackingRect:owner:userData:assumeInside: method.

  2. Why do you think it is necessary to manually add a tracking rectangle to an NSView in order to have that NSView track the mouse? Why is it necessary to make the tracking view the first responder?

  3. Instead of being added to a separate display list, the annotations could have been integrated with the primary display list. Try to implement the program in this manner. What are the advantages and disadvantages of this approach?

  4. Modify the GraphPaper application so that the displayed formula changes color when you move the mouse over it.

  5. Further modify the GraphPaper application so that you can click the formula and drag it to other locations in the GraphView window.

  6. Investigate the NSFormatter class. Instead of specifying the string values “x:” and “y:” in the mouseMoved: event, create your own NSFormatter that prepends these labels to the floating-point value before it is displayed. Which approach is better — using an NSFormatter or creating the formatted display in the mouseMoved: event?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.174.145