Copy-friendly!



Click for Navigation    (Press  Home / Pos1-key to scroll back!):
Application | Coding (Style | Height | Table | Contents | MonitorObj)
Requirements (Hardware | Browser | include | call)
Appendix 1: Keyword Parameters | Appendix 2: Indirect Coding | Keywords, Text Metrics 


Status Bar:
Toolkit for Handling a Real-Time Process

You want to give your users perfect control over a real-time process? Then you need a toolkit to build a user interface appropriate to human needs. A combination of status bars is such a tool, as you will read in this article (and get its look-and-feel in a demo).

Imagine you have a real-time process involving a great number of parameters. You want to build an application with a user interface giving the users full insight into all its parameters and their interplay. Plus diverse input elements for effective controlling.

How would you present this user interface on screen? - Obviously, it should be a trade-off between:

In this article the tool  Statusbar()  and some auxiliary components will be introduced. By calling it with various  keyword parameters  (details: Appendix 1: Keyword Params) and  indirect coding  (details: see Appendix 2: Indirect Coding) the most amazing effects can be implemented, just by a few lines of code.

Application

To build a user interface for handling a real-time process, you should patch up your screen with one or any number of status bars, from the bottom up to the top. If there is screen space left between the last status bar and the top screen edge, it can be used for any text or as a work space.

By default, a status bar is a uniform 1-line space that can be filled up by any text you think relevant to the process. This, however, will be useful only in simple cases, involving just a few parameters. For a rather complex process, you will want to:

Coding

For arranging a status bar on screen, you should call  Statusbar()  - repeatedly, if you want to combine several status bars. The first one will be placed at the bottom screen edge, the following ones will automatically be located adjacent to the latest one. The exact formalism is:
Statusbar([options])
parametermeaning
options Optional parameter: String of options yielding flexible control over  Statusbar() . For general help on options coding see Appendix 1: Keyword Params
Currently the following options are available:
contents= or contents=@ HTML-code of contents to display in  SubDlg() 
Details + demo: section Coding - Contents
Value prefix  @ : Identifier of any  DIV  whose  innerHTML  is to be taken for buttons.  Details + example: section Appendix 2: Indirect Coding
height= Number of pixels the  Statusbar() occupies vertically. Can be any positive number (e.g. 20, 30, …) Default height: 22. Details + demo: section Coding - Height
style= JavaScript code of styles to apply in display of the status bar.
Details + demo: section Coding - Style
table= or table=@ HTML-code of table to display in  Statusbar() 
Details + demo: section Coding - Table
Value prefix  @ : Identifier of any  DIV  whose  innerHTML  is to be taken for title. Details + example: section Appendix 2: Indirect Coding

Coding

Coding - Style

By default, a  Statusbar  is presented similar to the browser's status bar (grey background, ridge border). If you want to have a more sophisticated layout, you can achieve that in two ways:

  1. Semi-permanent Style Change: For your  corporate identity  you might want to have a uniform default layout, every time a  Statusbar()  is launched in an application. Then you should change the Semi-permanent Style Sheet (look into this footnote).
  2. Temporary Style Change: If you feel, a  SubDlg  should give a different impression, then you should use the option  style=  to have a different layout for this launch only. (For details look into this footnote.)

If you have several status bars combined on screen, it will be user-friendly to have them in different colors, different font sizes, etc.

By the following button you can get a demo with two  Statusbar , each with different  styles. In it, you might be interested to spy on the source code:

Coding - Height

By default, a  Statusbar  is 22 pixels high. That's fine for an empty 1-line status bar, written in your system's default font. If you want to have a different font size, however, a tabular status bar, or any other contents - then you will need this option.

By the following button you can get a demo with two  Statusbar , each with different  height . In it, you might be interested to spy on the source code:

Coding - Table

By default, a  Statusbar  is one empty line with a ridge border. Usually, however, you will want to have a tabular status bar. That's a 1-row table with any number of headers. You can define it by this option:

table=[@]header1;

For the exact formalism see this footnote.

By the following button you can get a demo with two  Statusbar , one of them defined with a  table . In it, the last field is defined by HTML code ( <...> ). The field before the last one is defined by Indirect Coding (the identifier is preceded by  @ ). You might be interested to spy on the source code:

Coding - Contents

In most cases, you will define a status bar by option  table= , yielding a 1-row table. Only in extreme cases you will want to have a more complex table. Then you will need this option (probably along with Indirect Coding).

Remember, however, the first point in this footnote: If you have to display more variables than can be accommodated in a 1-row table, you should take this as an indication to split them up into several status bars!

This option was provided for extreme cases only. So it was not used in the demo.

Coding - MonitorObj

In the demo there is also an auxiliary tool  MonitorObj  used. Its function is to write a sequence of variables to a status bar. It can be used in two ways:

  1. MonitorObj(objMon,objDest,"header=variable ... "[,label])
  2. MonitorObj(objMon,objDest,"..."[,label])
objMon Object to monitor (i.e. to write several variables to the object identified by  objDest ). In this demo: the patch ( this ).
objDest Destination object (i.e. where to write the variables to). In this demo: status bars  status1  and  status2 
"header=variable ..." Pairs of  header=variable  (separated by a blank space). This sequence will be written in one line.
or "..." Sequence of variables to write. This sequence will be written with each variable separately (to field 1, 2, … of the destination object). It is assumed, the destination object was defined appropriately.
label Optional string - will be written at the top of the sequence (if written in one line), or to the very first field of the destination object.

Depending on the nature of your real-time process, you might need a different tool for writing variables.

Requirements

What are you interested in?:

Click the item you want to know more about!

Requirements - Hardware

In order to make full use of  Statusbar , you should be sure of the following hardware at your users':

Requirements - Browser

The Custom Inputs are applicable under IE browsers only.
Will all your users have an IE browser?

Requirements - include

Anywhere in your HTML-file, before the first call of a Custom Input, you should have the following code line:

<SCRIPT SRC="Input.js"></SCRIPT>

Of course, you should make sure that the JavaScript-File  Input.js  really is in the current working directory on your server. If not, you might have to alter the path, e.g. <SCRIPT SRC="../JS/Input.js"></SCRIPT>

If you want to combine Statusbar()  with any of the other software components described in the other articles of these archives, you should declare them one after the other. E.g.:

<SCRIPT SRC="OnlineComm.js"></SCRIPT> <SCRIPT SRC="Input.js"></SCRIPT>

Requirements - call

Statusbar()  should be called within <SCRIPT>-brackets, e.g.
<SCRIPT>Statusbar( … )</SCRIPT>
If you want to have several related calls, they may be combined within a common bracket and must be separated by a semicolon - e.g.
<SCRIPT>Statusbar( … );
    :
Statusbar( … );
    :
Statusbar( … )</SCRIPT>
If you have more than one application in your HTML-file, they all share a common namespace. I.e. all identifiers must be unique over all the applications.

Appendix 1: Keyword Params

Statusbar()  is based on a software technology that is different to standard programming languages (such as  JavaScript ).

In standard programming languages you can control a function only by  positional parameters . That is, the significance of a parameter is given by its position in the parameter list: the first parameter, the second parameter, etc.

To the human programmer, that's fine as long as there are not more than some 6-10 parameters. Beyond that, it's but too easy to overlook a parameter. Consequently, all the following parameters would be interpreted incorrectly.

That's going to be a problem especially when you have a significant parameter at, say, position 29 - whereas the parameters of position 21 to 28 are not significant. So, to the human mind the most obvious thing would be to leave them out. Alas, then your significant parameter of position 29 would be interpreted as if it were at position 21. Not exactly what you want!

Therefore, the options of  Statusbar()  (and all the other software components presented in these archives) use a software technology called  keyword parameters  (Exact formalism: see this footnote.)

Appendix 2: Indirect Coding

Statusbar()  is very powerful. For title, contents and buttons it can display anything from plain text up to the most complicated HTML constructions. This is more, in fact, than what can be coded simply as a linear string (holding the HTML code of the construction).

Therefore the concept of  Indirect Coding  was introduced:

By  Indirect Coding  you can even achieve some special effects. For an example look into this footnote.

Footnote:
Semi-permanent Style Change


Footnote:
Temporary Style Change

Code the parameter value in the usual JavaScript notation - without the prefix  style. , separated by  ;  if you want to change several styles. Example:
style=«backgroundColor='yellow'; fontSize='80%'»

Footnote:
Keyword Parameters - Formalism

  1. Keyword parameters may be coded in any order.
  2. The significance of a parameter is given by its prefix (the "keyword").
  3. Insignificant parameters can simply be left out.
  4. Keywords are case-sensitive. They must be coded exactly as given in the documentation.
  5. Keyword parameters ("options") can be simple  keyword  or pairs of  keyword  and  value , separated by  = .
  6. Individual keyword parameters must be separated by at least one blank space, if the preceding  value  is not bracketed.
  7. In some cases, a keyword parameter might have a few positional parameters. (Their order is significant!)
  8. A parameter value may be coded with or without brackets. If it comprises a blank space, however, it must be bracketed in  '' ,  ""  or  «» .
  9. The outermost brackets of an option string must be those standard to JavaScript ( ''  or  "" ).
  10. If the symbols  «  and  »  are not on your keyboard, you can enter them by:
    • Press the  ALT -key, and
    • on the numeric keypad type "174" (for  « ) or "175" (for  » ).
    EDeciding on how to nest  "" ,  ''  and  «»  brackets, to code a single apostrophe, or to factor out an expression, can be quite a hairy matter sometimes.
  11. The closing apostrophe of the last keyword parameter (be it  ' ,  "  or  » ) may be omitted.
    (Not recommended, however: If the option string is expanded some time later, it is too easy to overlook that!)

Footnote:
Using Indirect Coding to Protect Contents

In some applications you will want to display some contents, but make sure that the users cannot copy them to clipboard. Thus protecting them from being further processed.

You can do that simply by Indirect Coding of a nested <DIV> which is disabled for selection:

<DIV ID="noselect" STYLE="display:none">
<DIV onselectstart="return false"> … (contents to protect) … </DIV>
</DIV>
:
SubDlg('@noselect');
ENote however that this is no definitive protection against abuse of your contents. It just pushes the price for downloading so high that some would-be code pirates might feel discouraged.(See my article Protect your Contents - …, in particular section Preventing (Physical) Downloading

Footnote:
Option  table=  - Formalism

-------------------------------------------------------------------------------------------------------------------------
Article by Gunter Gerdenitsch, international IT-specialist with focus on Communication. IT service providers - looking for a freelancer for peaks in your workload, want to get your ideas across? Then you should visit http://www.ITspecial.org or mail to gg@ITspecial.org
-------------------------------------------------------------------------------------------------------------------------

This article is free to be re-printed, if complete with this resource box. It can be included in a web site if the URL mentioned above is linked to www.ITspecial.org.

Keywords: real-time, status bar, 1-line, 1-row, tabular, keyword params, indirect coding
Word count: 2816
File size
(incl. demos):
40kB