Monday, May 12, 2014

CPWindow, the root of all View Hierarchies

CPWindow is the "root" of all View Hierarchies.  What this means to you is that when you create a CPWindow object or a CPPanel object, which is a child of CPWindow and also the root of all CPViews by inheritance, you do not need to worry about adding the window or the panel to another view in order for the window or panel to display on the screen.

In the Photo Album Tutorial, they jump right into using these objects without really playing with them, and I think that is a mistake.  It is not until you play with them that you really appreciate what you can do with them.

Before we begin playing, we should note a  few important details.  CPPanels are CPWindows. According to the Cappuccino API Documentation, there are some important differences between the CPPanel and it's superclass, CPWindow:


  1. The CPPanel can never be the main window.  It can become a "Key" window, which means it can become the target of keyboard and other input actions, but it should be used in cases when an auxiliary function is being performed.
  2. Because CPPanels cannot be the main window, they can be prevented from becoming the target of keyboard inputs.  This can be useful for situations where the program designer insists that certain information be provided or certain actions happen prior to the auxiliary window becoming functional.  The implication of course is that a CPWindow object that is not a CPPanel cannot be blocked from inputs without being hidden from view or obstructed by another element.
We will play with CPWindows and CPPanels in the following blog articles in order to gain a full functional concept of what they are and how to work with them.  In at least one example, we will create a CPButton object, but at this time, we will not cover the CPButton functionality, we will explore controls in a different string of articles.





No comments:

Post a Comment