Initiating programs

    What better way is there to define a programmer than by the way he or she initiates a program?  Probably plenty.  But an interesting one to study is the loading sequence.  Generally, while the program loads up, the user is given some sort of engaging graphical distraction such as a status bar.  There are many different ways to go about this.  Namely, I will discuss five of my favorites:

block.gif (826 bytes) The Twirl \ | / -
block.gif (826 bytes) The Dots .....
block.gif (826 bytes) The "DONE!" and ; usage
block.gif (826 bytes) The [ииииииииии] method
block.gif (826 bytes) Graphical status bar.

To download an example program which demonstrates these concepts, click here.

 

Control your dots

    With dots there are many ways to go.  Depending on your loading procedure you could just add dots using the PRINT "."; statement.  This might produce many dots scoring across the screen, known as the infinite dot effect.   I've seen install programs that do this.  But frankly, this looks messy, unorganized, and gives the impression that the programmer hasn't calculated how many operations he/she must do.  Also, it is not very informative.  The user knows something is happening because his/her screen is filling with dots faster than today's gas prices are soaring, but it does not say how much time or procedures are left.  This should be the primary purpose of any status bar: to tell the status.  The dots in this manner are useless.  On the other hand -- if you can get your dots under control they may act as a status bar. Ex: [иииииииии]  This inclusion of the brackets in this system allow the user to get a feel for how many dots are left to come, an end to the dot mania, a light at the end of the tunnel.  Thus, remember to control your dots.

 

The Twirl

    Ahh yes, the twirl -- I've seen bad boy in many different applications, including BBS's.  The problem with this little guy is the same as the dots: it gives no indication as to when the hypnotizing twirl will cease.  For those of you that have never seen this, it is quite simple.  Through every iteration of a procedure you simply print a single character in the exact same position on the screen.   That character cycles through four different characters:
\
|
-
/
When put on top of one another this produces the effect of a twirling or rotating line.   It looks better than the infinite dot effect, but again, only tells the user something is happening.  This is perhaps more useful for a search or sort algorithm that tells the user "busy", but actual time cannot be calculated.   However, for loading, I do not feel this procedure appropriate.

 

 

The DONE! Usage

    This, used alone, is the worst method for indicated loading status.  Why?  It can only tell the user two things: Not done, or done.  This doesn't even say "Busy" -- it is merely implied by the lack of activity on screen.  The user assumes the loading procedure takes far too much computing power to bother telling the user anything about it.  Now, there is a way to use DONE! without being completely useless.  After a twirl or dot load, the DONE! is a nice added feature.  Under no circumstances should one use this alone.   Pretend DONE! is lonely and will wither and fade without support.

 

The [ииииииииии]

    Now we're finally getting somewhere useful.   The idea here is that on the on start of loading, [ииииииииии] is outputted to the screen to show the user how much loading there is left to be completed.   As the procedure begins loading, the dots between the brackets change color, shape, or size to indicate a status bar.  This not only tells the user how much longer he / she will have to wait, but it gives a graphical impression of the procedure. 

    This method is simple to implement and looks fairly nice.  If you're trying to go for something quick, this is the way to go.

 

The Graphical Method

    This is by far my favorite method and contains the most potential for overall look and creativeness.  The basic idea is that somehow, the status of the loading procedure is represented through some sort of graphical method.   This can take form in something as simple as a red status bar.  However, done correctly, a gradient red status bar will look much better than an infinite dot effect for obvious reasons.  Now for some hints and tricks:

    One way of employing the graphical method leaves a lot of room for creativity.  Because of the way QB's GET & PUT routines work, you can quite easily make a progressive status bar.  Here's how

Whenever you get an image in QB into an array, the first element in that array (if the array is defined as an integer) is the width of the image times eight.   The second element is the height of the image.  For an example, let's examine the following snippet of code:

W = 10
H = 15
DIM IMAGE(W * H \ 2 + 3) AS INTEGER
GET (1,1) - (W, H), IMAGE(0)
PRINT IMAGE(0)
PRINT IMAGE(1)

This should produce the following output:

80
15

    By changing the second element in the array manually, we can change the height setting of the image.  Note that this does not affect the rest of the image.  All the data is still in the array, but QB will stop outputting image data after the height specified by the first element is reached.   Also note that the first element of the array can also be altered to change the width setting, but doing so will most likely not produce the desired effect.  This is because the image data is linear; that is if the image is 10 pixels wide, the 11th piece of pixel data will denote the location of the first pixel on the second line.  If the image width setting was changed to, say 8, then the 11th piece of pixel data would now be the third pixel on the second line.  Thus, changing the width produces some strange effects, which you may want to implement in your program for other uses (i.e. a distorted TV set effect -- try it to see what I mean).  However, for the use of a status bar, I would recommend sticking with the height for now.

Thus,

IMAGE(1) = 10

would tell QB that we only want to output 10 * 10 bytes of data to the screen, which (b/c the width is 10) would stop exactly on line 10.

 

There you have it!  If you have any questions / comments / suggestions please feel free to send an email.  Also try downloading this example program which demonstrates the ideas set forth in this article.

 

 

This page was generated by Microsoft FrontPage 98.
Е Copyright 2000 by Timothy D. Mowrer for Secret Weapon Software.