36 lines
680 B
Plaintext
36 lines
680 B
Plaintext
import Nanoquery.Util.Windows
|
|
|
|
// define the necessary objects
|
|
$w = new("Window")
|
|
$b = new("Button")
|
|
$l = new("Label")
|
|
|
|
$b.setParent($w)
|
|
$l.setParent($w)
|
|
|
|
// define the amount of clicks
|
|
$clicks = 0
|
|
|
|
// a function to update the label
|
|
def updateLabel($caller, $event)
|
|
global $clicks
|
|
global $l
|
|
|
|
$clicks = $clicks+1
|
|
$l.setText(str($clicks))
|
|
|
|
global $clicks = $clicks
|
|
end
|
|
|
|
// prepare the components to be displayed
|
|
$w.setSize(200,200)
|
|
$b.setText("click me")
|
|
$b.setPosition(0,100)
|
|
$l.setText("There have been no clicks yet")
|
|
|
|
// set the button's event handler to the function updateLabel
|
|
$b.setHandler($updateLabel)
|
|
|
|
// show the window
|
|
$w.show()
|