Wimp
eph.png

Download the Examples directory. Then click on !Eph. You should see this window

ephscr.png

appear and then disappear. The last line of !Eph.!Run is

 do lua <Obey$dir>.!RunImage "An ephemeral message" "10"
which tells the program to display "An ephemeral message" for 10 seconds. The RiscLua program in !Eph.!RunImage is

    local wimptask = require "wimp.task"
    local this = wimptask:spawn "Ephemeral"
    local message, delay = arg[1], tonumber (arg[2])
    local kill  , nullevent  = 0, 0
    _ENV = this
    init (this )
    handler[nullevent] = QUIT
    preclosedown = \ (self)
       self:send (self.post, kill)
       end     -- function
    post = alert (this, message)
    mask = (1<<1)|(7<<4)|(1<<8)|(7<<11)|(7<<17)
    time = now (100*(delay))
    run  (this, "poll_idle")
The first line loads the library from !rlua.lib.wimp.task into the variable wimptask .

The next line creates a wimp-task with the title "Ephemeral" and puts it into the variable this .

The third line sets message to the first command-line argument and delay to the number given by the second.

The fourth sets the variables kill and nullevent to 0, mostly for cosmetic purposes.

_ENV = this is interesting; it sets the current environment to the table this just created. What this means is that from now on global variables, i.e. any variables not previously defined as local, will be read from (and written to, were that to be in the program) the table this .

init (this) registers this with the task manager.

The next line sets the null-event handler to QUIT, but before the task quits it is to send a kill message to the task with handle post which is created at the next line: post = alert (this, message) . It is the task post not this that is opening the window on the screen, and the kill message that snuffs it out after this has closed down.

The next line sets the mask for what wimp events the task-manager is to send and the next sets the polling delay in centiseconds.

The final line lights the touch-paper.

Here is another mickey mouse program, !Justquit, in the Examples directory. Run it and you get a window with the text No coding needed. .

jq.png

This uses the toolbox. How to shut it down? Press the Menu button in the window and select Quit. The RiscLua program in !RunImage is

    local $ in riscos
    local toolbox = require "wimp.toolbox"
    local @ = toolbox:spawn "JustQuit"
    _ENV = @
    $[resdir] = "<JustQuit$Dir>"
    init (@, { }, { }) -- All wimp, all toolbox events signify.
    mask = 257         -- No null or kbd events wanted.
    run (@)
This is so short because lots of detail is hidden in the resourcefile !Justquit.res. Note the use of $ in line 6 to write a string into a buffer. The symbols !, ? and $ are borrowed from BASIC, which is why RiscLua has to extend the class of symbols allowed in variable-names.