Back Previous Next


Linguist graphics package - style

Syntax:

   style {name} {elements}

Keyword handler:

   net.eclecity.linguist.graphics.keyword.GraphicsKStyle.class

Runtime handler(s):

   net.eclecity.linguist.graphics.handler.GraphicsHStyle.class

Function:

Declares a style variable or an array of styles. The array size is fixed at time of compilation.

A style is used with a textpanel to define the font, color and other attributes of a section of text. It works like styles in word processors rather than like HTML markeup tags. The form of the style is goverend by the script, not by any inherent feature of the style itself. See add and set.

The markup rules for styles are as follows:

Styled text is marked up in a similar way as for HTML (though greatly simplified). A style tag is contained within angle braces, as in <Title>, where the style name is Title. The actions of this style then take effect until another style tag is encountered. To re-apply the default for the textpanel, use an empty tag, i.e. <>.

A special kind of tag is one starting with a colon. This defines a hot text element and causes a callback when the user clicks in it. The callback is passed the remainder of the contents of the tag as the target (see String values).

So here's an example of some marked-up text:

<Title>THE VIDEO<>

This is a clip from our new video.

<:Video>Back to menu<>

When this text is put into a textpanel all you will see is the text not between angle braces. If a style is created in the script, given the name Title (see set) and added to the textpanel, then the text will be shown according to the characteristics set for that style. To make the text Back to menu clickable, create another style with no name and define an event handler for it (see on). Here's what the script might look like:

	style TitleStyle
	style LinkStyle
	.
	.
	set the name of TitleStyle to "Title"
	set the font of TitleStyle to TitleFont
	add TitleStyle to TextPanel
	set the font of LinkStyle to LinkFont
	set the cursor of LinkStyle to HandCursor
	add LinkStyle to TextPanel
	on LinkStyle
	begin
		if the target is "Video" set VideoCompleted
		.
		.
	end

Example(s):

   style DefaultStyle
   style Styles 8


Back Previous Next