Table Of Contents

Previous topic

std.graphics.Graphics

Next topic

std.graphics.InputBinding

This Page

std.graphics.GUI

Constructor

class std.graphics.GUI(name, me, onready)
Arguments:
  • name
  • me
  • onready

Methods

bind(type, cb)
Arguments:
  • type
  • cb

Bind a listener for events from this GUI.

call()

Call a method in the GUI context. This is just a convenience wrapper around eval which will build the string to eval automatically from the method arguments.

Example: var x = 7; var st = ‘hello “Bob”’; gui.call(‘myfunc’, x, st); is equivalent to gui.guiEval( “myfunc(7, ‘hello “Bob”’);” );

focus()

Shows the GUI window.

guiEval(js)
Arguments:
  • js

Evaluate the Javascript string inside the GUI context.

hide()

Hides the GUI window.

onException(cb)
Arguments:
  • cb

Bind a listener for exception events. Listener should have the form fn(message, file, linenum).

set(varname, value)
Arguments:
  • varname
  • value

Set the value of a variable in the GUI context. This is just a convenience wrapper around eval which will build the string to eval automatically from the arguments.

Example: gui.set(‘myvar’, 17) is equivalent to gui.eval(‘var myvar = 17;’);

show()

Shows the GUI window.

url()

Get the current URL. Should only be used on browsers, not regular GUIs, since the GUI URL won’t be meaningful.

variable(name)
param string name:
 the name of the variable
returns:a placeholder object which gets converted to
the variable name when passed to GUI.call or GUI.set.
rtype:object

Create an object which can be used to specify a variable name to GUI.call and GUI.set. Since strings are converted to string literals, it isn’t possible to specify variable names in these calls without this method.