• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie question


  • Subject: Newbie question
  • From: James Mooney <email@hidden>
  • Date: Thu, 13 Mar 2003 11:35:13 -0500

Greetings,

I recently went through the book Cocoa and Objective C and had a question on one of the examples.

If anyone is familiar with the book, great. There is an example which deals with events. Chapter 8 Dotview
The app has three items in a window. A slider, a colorwell, and an NSView box. When you click in the NSView box a circle is drawn in the box at the point where the mouse event occurred. The slider makes the circle radius bigger and small. The colorwell changes the color of the circle drawn.

There is one class call Dotview that handles everything in the window. When I first went through the tutorial, the slider and the colorwell would not work. After several hours of checking and rechecking, I found something that was causing my problem. This is the basis for my question.

In this example, you are not supposed to instantiate the class Dotview. When you do, the problem above occurs. When you delete the instatiaion in the interface builder, everything works fine. The slider changes the size of the shape and the colorwell works fine. It wasn't until I downloaded the complete project from the publishers website that I saw there was no little Dotview icon. I immediately saw what I was doing wrong. However, I do not understand how instantiating in the interface builder effects the operation of my project. All examples I have seen so far told you to instantiate the class and then write the classes to the project. In this case.....you are only supposed to do the later. The Dotview.h and .m files were created.

What does instantiating a class do when you tell it to be done in the interface builder? Whether you do it or not, the slider and the colorwell gets drawn. If I instantiate the Dotview class, the communication of the slider and the NSView do not work, not instantiating and they talk to each other? There is no change in the code in the .m or .h files so I assume there is some plist or xml doc the app uses where info is added or subtracted when you instruct a class to be instantiated. Anyone know the reason why? What is going on?

Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • (no subject)
      • From: Ulrik Sverdrup <email@hidden>
    • Re: Newbie question
      • From: Don Arbow <email@hidden>
  • Prev by Date: Get fontinfo from PDF
  • Next by Date: NSObject performSelectorOnMainThread:
  • Previous by thread: Get fontinfo from PDF
  • Next by thread: Re: Newbie question
  • Index(es):
    • Date
    • Thread