Application - The Application Object
Just like Delphi and Freepascal, all smart apps have an application object. This is the very first object that is created when you execute your code in a browser (the second being the driver instance) and it is in charge of managing forms, moving between forms (typically using a sliding effect like iPhone apps), setting up the display and keeping things properly sized.
Unlike Delphi, where the desktop is ever present via the operative system, TApplication is in charge of setting up a display. This display class (TW3Display) is a normal, visual control that inherits from TW3Customcontrol and is set to automatically fill the entire visible area of the browser.
TW3Display in turn contains an instance of TW3DisplayView which is the container that actually house your form instances:
It is important to understand that both TW3Display and TW3DisplayView inherit from TW3Customcontrol. As such you are free to insert your own controls into these as you see fit. TW3Display is set to organize controls in a top-down manner automatically. By adding a TW3HeaderControl (the typical iPhone header) directly into Application.Display your header control will remain still while the forms slide in and out.
You can change the way TW3Display organizes its child elements by altering the ArrangeType and Auto-Arrange properties. Currently the following organization modes are supported:
· | dvaSizeToView: fit to browser size |
· | dvaVStack: stack child controls vertically |
· | dvaHStack: stack child controls horizontally |
One crucial point to make about the application object, is that you must manually add the form instances to the code. When you create a new project, a unit with the project name is automatically created for you. This unit contains your application object which is unique for each program. The method ApplicationStarting() is where you create instances of your forms and add them to the application object.
|
|