List of articles   choose language


Object has several states with different styles



Agreements

tagattributecharacteristicstyle
new html-keywordslinealingpointdefault
values of new html-keywordssideromb
old html-keywordstdidlist
values of old html-keywordscircle
communication xmlsoundsyncpower
values of communication xmlnouser
keyboard and mouser commandenter

CLASS is STATE

Changes in document are finite automaton. It's more comfortable to set finite automaton as some matrix, instead of writing functions JavaScript, executing these change on screen. Let's consider how write finite automaton for change stile of objects depending of pressing of keyboard's keys and buttons of mouse by user.

Let, for example, there is a forum (let items are list elements <li></li>).

We do bookmarks and marks in a books, but how to make marks in forum? If you analyse phrases and sort them into 5 levels (important, for think, usual, foolish, harmfully), then it would be convenient, that "important" are red, "for think" are orange, "usual" are green, "foolish" are black, "harmfully" are grey (silver).

How to make such changes in a browser window and send to server? If you locate a set of radio-buttons near each phrase, it's not pleasant for a user.

I offer to click on phrases directly: click increase phrase state by one level, double click reduce phrase state by one level.

Transition Sheet

Let's define styles in a CSS-file for our phrases. These styles can have different colours, font sizes, etc.

li.r5 { color: red }
li.r4 { color: orange }
li.r3 { color: green }
li.r2 { color: black }
li.r1 { color: silver }

Single click by left mouse key call command enter, double click by left mouse key call command bksp. Transition sheet look so (also you can see comments here)

r1 enter r2
r2 enter r3
r3 enter r4
r4 enter r5
r5 enter r1 /* sequence is closed into a ring */

r5 bksp r4
r4 bksp r3
r3 bksp r2
r2 bksp r1
r1 bksp r5 /* sequence is closed into a ring */

If different tags use the same styles, then they will execute the same transformations.

Format

Table string consists of the following fields (columns)

Fields are separated from each other by blank (space). Each field can consist of several words, listed through a comma. Words of one field follow in any order.

Listing of states

Listing of several states through a comma is possible.

r1,r3 enter r2

Any state is designated by sign "comma".

, enter r2

Default states

Style, which is used by browser by default (when tag class is absent) for not inserted object, is named as default.

For example, transition from default-state looks so

default enter r2
and transition into default-state - so
r2 enter default

Blank field "new state" changes previous style into style default.

r1 enter

Listing of commands

Listing of several commands through a comma is possible.

r1 enter,bksp r2

Packing

Let's write down all transition tables in a separate file, for example, "a.txt", and add following tag inside tag head

<link src="./a.txt" type="transition">

Enclosure

Let one tag () is inside another tag (), transition for object "" is specified in Transition Sheet, and user has call command (for example, click or double click) on enclosed object (). If transition for object "A"

Additional characteristic: colour move

Colours (and only colours) can move smoothly.

When it's necessary, that colour changed not by jump, but smoothly, during some interval of time, additional characteristic time is used, which defines how many seconds should be this change.

li.r5 {
 color: red;
 color-time: 1.5;
}

Form sends

Tags <li> may be inside tag form, and their attributes name must be specified (in example below - into value A). Click or double-click creates following XML-text (further we shall name such xml-tags as actions).

<obj name=A cmd=cmd_name os=old_class_name ns=new_class_name>
For example, click on a phrase of class "r1" creates text
<obj name=A cmd=enter os=r1 ns=r2>
Origin of designations: os = old style (state), ns = new style (state), cmd =
command.

Moment of sending

Form is sent immediately, without pressing button "submit" in one of two cases

Form is sent on pressing the button "submit" in other case.

Results of all operations, executed by mouse from a moment of last sending, are sent at once in all case.

For such purpose, that user know object state before sending a form by pressing button "submit", new objects states are displayed by a new style.

Occurrence of a new window

If style for a new state is not found in a css-file, than sense of click is other: it's a choice of some operation "operation_name". XML-text is sent immediately

<obj name=A cmd=cmd_name os=old_class_name ns=operation_name>
Immediate sending is necessary, for example, to add new cells into table in program for drawing a database scheme.

Commands

Use

Any command (or combination of commands) is written in field "command" in Transition Sheet. If there are several commands (or combination), then they are listed in this field through a comma.

r1 enter,bksp r2
A combination of commands is written by listing of commands through a hyphen.
r1 a-b,c-d r2
All commands are written down in lower case.

If a command is called on a not inserted object, then it's executed only by one this object. If a command is called on one of an inserted objects, then it's executed by all inserted objects (final style of each object depends of its initial style).

If style is not specified for final state in a css-file, then final state is interpreted as name of operation, and browser immediately send all actions, which have collected to this moment.

Keyboard's cursor is cancelled - exists only mouse cursor.

Systematics

Commands is diveded into reserved by a browser and invented by a user (for example he can invent commands cool, fine). Reserved command can be called both directly by keyboard or mouse, and from a menu, user commands can be called only from a menu.

Combination of reserved commands is possible to use.


Reserved commands
mouse's keyboard's
left key right key
enter, bksp, drag, drop, ins   enter, bksp, any letter

Mouse's commands:


Keyboard commands are simultaneous pressing of one or several following keys:


All combinations with function keys ctrl and alt (which are not a commands) are intended not for programmer of a document, but for management of a browser. Such division allows to create html-documents, which will able to work in future versions of a browser.

Predetermined results

Command enter, called for some objects, make the predetermined results.

<input type=submit>send form
ago into link

If user call bksp during loading a document, then loading will stop, and if during executing a module - executing a module will stop.

Keys space (which is not a command) make drag-and-drop of object under mouse cursor and sends two commands: first pressing - drag (then movement of cursor by keys-arrows), second pressing - drop, commands "drag" and "drop" is called for an appropriate objects after second pressing.

Agreement

Command h is usually used for call help for object under mouse cursor (h=help)



Menu for object

Creation

We use constructions <select><optgroup><option>, <input type=radio>, <input type=checkbox>.

We specify menu name in attribute id of tag <select>; and name of command, which should be applied to object, in attribute value .

<select id="menu_name">
<option value="cmd_to_r5"> important </option>
<option value="cmd_to_r4"> for think </option>
<option value="cmd_to_r3"> usual     </option>
<option value="cmd_to_r2"> foolish   </option>
<option value="cmd_to_r1"> harmfully </option>
</select>

Attribute src of tag option with value "site/~user/^service/path/filename" specifies an image, which should be used as a marker of elements of falling list.

Influence of css-files are distributed on a menu.

Instruction in a document

Object refers in attribute menu to its own menu, i.e.

<li menu="menu_name">    any text </li>

<body menu="menu_name2"> any text </body>

Packing

We write down all menu in a separate file, for example, "a.txt", and add following tag inside tag head

<link src="./a.htm" type="menu">

Call

When cursor between widgets, then key ctrl call popup menu (menu for object under mouse cursor). When cursor inside widgets, then this key call menu for widget.



Resume

Commands
enter, bksp


Attributes
tag attribute list of possible values
link type transition, menu
any menu id of input-select
<input type=select>
src site/~user/^service/path/filename


Characteristics
tag characteristic default value units of measurement
any time 0 sec


Styles
tag style
any default


XML commands
<obj name= cmd= os= ns= >



html60author



List of articles   choose language


Используются технологии uCoz