06-15-2011, 02:42 PM,
(This post was last modified: 06-29-2011, 01:41 PM by penguin.)
|
|||||
|
|||||
Getting Started3:Top-level Applet Specifications
Global Attributes
This Curl Cue describes how to set common properties for the entire applet. This includes global attributes such as backgrounds, borders, and margins. For common styles that are used many times throughout the applet, we can specify a grouping of stylistic changes using a text procedure. Specifying Applet Styles One of the first decisions to make when designing your Curl applet is what document style to use. In Curl, the document style refers to the top level layout structure of the applet. There are 3 predefined document styles available: DefaultDocument - This is the default view where the applet is enclosed with scrollbars. This style is most commonly used. PlainDocument - This style gives you a page without scrollbars. TocDocument - This style gives you a scrolling page with a table of contents on the left side of the page. The entries in the table of contents are nested according to the heading level of the content. Tip: Which document style should you use? •If you want your applet to scroll like an HTML page, use DefaultDocument. •If you're building an application that should completely control the content of a browser window (such as in a game), use PlainDocument. •If you are writing online documentation where navigation provided by the table of contents is valuable, you'll find the TocDocument style is the best choice. To specify the style of the document, use document-style. Document and Plain Styles Let's compare the first two styles. Select each button to compare DefaultDocument and PlainDocument. [DefaultDocument] [PlainDocument] In the case of PlainDocument, nothing is added to the document except what your applet adds explicitly. This style only allows one item in the document: the first result returned by your applet at the top level becomes the entire contents of the document. In the case of DefaultDocument, Curl places the contents of the document inside a ScrollBox. Values returned at the top level of the applet are added one after another. If enough content is added to make scrolling necessary, scrollbars are automatically enabled. Since DefaultDocument is the default behavior, nothing needs to be added to the code. However, for PlainDocument you need to specify the style by calling the document-style procedure at the top of the applet code. For example: Code: {curl 5.0 applet} Table of Contents Style The TocDocument style constructs a user interface consisting of a navigation panel at the left and a larger panel at the right for the body of the document. The navigation panel is a tree-structured table of contents that contains collapsible sections. When the TocDocument style is used, every time you use the {heading level = n ...} text procedure, an entry is created. For example: Code: {heading House} If the heading level is greater than the level currently in effect, the table of contents entry will be indented beneath the previous entry. For example: In most cases, you will use DefaultDocument. Since it is the default, you do not need to specify the document-style. For more information regarding text formats, please refer to the following section in the Curl Documentation:Curl Developer's Guide > File Systems and Networking > Interacting with the Browser > Presenting Applets > The Applet's Document Specifying Document Properties The document style provides hooks and allows authors to control the processing of a document. For example, the TocDocument places the loaded object side by side with a table of contents computed from various levels of headings in the document. In most cases, you will want other styles carried through your entire application. These include specifications for color, font, and style preferences. You can use set-document-properties to specify generic options, such as one might set on any container, so that the value will be inherited by the contents. (e.g., color, font-size). Although set-document-properties is technically not a text format, you use it in documents to modify the general appearance of the document. To use it, place it at the top of the applet and attach options to it. Some relevant options include: margin, background, border-width, and border-color. Code: {curl 5.0 applet} Notice that the heading overrides the font size that is specified in set-document-properties. Similarly, the font-style = "italic" adds to the property list for the paragraph For more information regarding document properties, see the following section in the Curl Documentation:Curl Developer's Guide > Text Formatting > Defining Text Procedures |
|||||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Getting Started3:Top-level Applet Specifications - by kino - 06-15-2011, 02:42 PM
|
Possibly Related Threads... | |||||
Thread | Author | Replies | Views | Last Post | |
Getting Started1:Creating a Simple Applet: Hello World | kino | 2 | 6,323 |
08-15-2016, 03:50 PM Last Post: dyoshida |
|
Serving Content1:Launching a Curl Applet | kino | 0 | 5,371 |
06-15-2011, 05:12 PM Last Post: kino |
Users browsing this thread:
1 Guest(s)
1 Guest(s)