Games-Axmud

 view release on metacpan or  search on metacpan

share/docs/tutorial/ch14.mkd  view on Meta::CPAN


Each WRITEWIN writes text on a new line, by default. You can change this behaviour, temporarily, by adding an **"echo"** tag. The tag adds text to the beginning of the previous line, rather than starting a new one.

        WRITEWIN "Hello "
        WRITEWIN "world!", "echo"

It's possible (though rather unlikely) that the window's default behaviour might be something different, in which case you can force a newline by adding the **"nl"** tag.

        WRITEWIN "Hello "
        WRITEWIN "world!", "nl"

##<a name="14.8">14.8 Emptying the window</a>

There are two ways to empty the window. The first is to use the EMPTYWIN statement.

        WRITEWIN "Hello"
        PAUSE 3
        EMPTYWIN
        WRITEWIN "world!"

Many dialects of BASIC use a CLS statement to do the same thing. You can use either EMPTYWIN or CLS; their behaviour is identical.

The second, and perhaps more conveient, way is to add an **"empty"** tag. The tag empties the window before displaying the text.

        WRITEWIN "Hello world!", "empty"

##<a name="14.9">14.9 Changing the background colour</a>

Some tasks (such as the Status task and the Divert task) change the window's background colour to communicate something to the user. These windows only use two colours - a single background colour and a single text colour. When you change the backgro...

If this is the way you want your window to behave, you can use a PAINTWIN statement.

        PAINTWIN "red"

You can use bold colour tags like **"RED"**, but in this case you can't use RGB or xterm colour tags.

If you don't specify a colour at all, the window reverts back to the default background colour.

        PAINTWIN

##<a name="14.10">14.10 Flashing windows</a>

Another way to grab the user's attention is to set the window's so-called *urgency hint*. The way this is implemented varies from system to system, but often it causes something to flash in the taskbar at the bottom of the screen.

        FLASHWIN

The flashing usually stops after a few seconds, but you can use an UNFLASHWIN statement at any time.

##<a name="14.11">14.11 Changing the window's title</a>

You can change the window's title using a TITLEWIN statement.

        TITLEWIN "I'm in control now!"

To restore the window's original title - which will be something like **Script (test)** - just use an empty string.

        TITLEWIN ""

##<a name="14.12">14.12 Dialogue windows</a>

Besides task windows, Axbasic scripts can create their own dialogue (popup) windows using the **Popup$ ()** function. The window asks the user to make a choice, and the function returns that choice.

        ! Ask a question
        LET choice$ = POPUP$ ("question", "Are you ready?", "yes-no")
        ! Display "yes" or "no"
        PRINT choice$
        END

The **Popup$** always takes three arguments. For a full list of the arguments that can be used, see the function's help file.

        ;axbasichelp popup

---

[Previous](ch13.html) [Index](index.html) [Next](ch15.html)



( run in 0.834 second using v1.01-cache-2.11-cpan-364913b4093 )