|
|
|
|
|
|
|
|
|
|
Resources, forms and controls (continued)
The user interface is mostly resources Most of an application's user interface will be built using resources. The "Hello World" application's user interface consisted of two forms. Each form contained some text and a control or two. The main form used a menu resource. Only the "hello again" message was explicitly drawn; the rest of it all was resources.
Since forms are the basis for almost all the user interface, let's finish this month with a detailed look at the main form resource.
The form resource in detail A form has various attributes, such as its position (if smaller than full-screen), its height, width, and so on. As mentioned before, it can contain control resources within it, and may use certain other resources like a string resource as the help text, and a menu resource.
Looking again at Figure B (which we've redisplayed below), we see the main form as built in Constructor. This corresponds to the lines between "FORM ID MainForm" and "END" in Listing 1 (see http://www.component-net.com/pp-extras/mainform.html).
FIGURE B
The main form built in Constructor. Click picture for a larger image.
The attributes of the form are shown in the left pane. Each element may be edited by clicking on the value and typing in a new value. These are the elements in the form's data structure itself; the control resources will be tacked on following this data. We don't need to worry about the actual structure layout. That's all handled by Constructor.
The left and top origin define the screen coordinate where the top-left corner of the form is placed. The physical screen is 160 pixels across and 160 pixels tall. The origin coordinates range from zero to 159. (0,0) is the top left of the screen.
The width and height define the size of the form in pixels. A full-screen form is 160 by 160. The main form of Hello World uses the full screen.
Most controls have a "usable" attribute. If it is not usable, it will not be drawn when the rest of the form is displayed. Since forms aren't drawn until you explicitly switch to the form, they will always be marked "usable."
"Modal" indicates whether the form's event handler should deal with pen events outside the form. A modal form will ignore any pen-taps outside itself. Modal forms also have a border - it's drawn by the form displayer during the FrmDrawForm call. You might want to refer back to April's Programming Power column to review the form-open events.
"Save Behind" tells Palm OS to save the portion of the screen which will be obscured by this form when it draws the form. When the form is closed, Palm OS will automatically restore that part of the screen. I've had odd results with this at times; sometimes things underneath the form show through when the form is first drawn. When that happens, typically setting "save behind" will fix it, even though "save behind" should cause things the other way around. It should leave garbage when the form is closed rather than mess it up when it's first drawn.
[ Prev | Next ]
|
|
|
|
|
|
|
|
|
|
|
|
|