RosettaCodeData/Task/GUI-component-interaction/FuncSug/gui-component-interaction.f...

27 lines
869 B
Plaintext

var numberInput := displayNewElementIn('', 'body', 'input', false)
numberInput.value := 0
var incButton := displayNewElementIn('Increment', 'body', 'button', false)
var rndButton := displayNewElementIn('Random', 'body', 'button', false)
parallel:
while true:
awaitDomeventBeep('change', numberInput)
if not (0+1*numberInput.value = 0+1*numberInput.value):
displayNewMessage('Invalid input !')
while true:
awaitClickBeep(incButton)
numberInput.value := 1*numberInput.value + 1
while true:
awaitClickBeep(rndButton)
var msg := displayNewMessage('Are you sure?<button id="yes">Yes</button><button id="no">No</button>')
parallel(select 1) ||
||=========
awaitClickBeep('#yes')
...--------
numberInput.value := randomIntBetween(0, 5000)
||=========
awaitClickBeep('#no')
...--------
displayNewMessage('No problem!')
removeElt(msg)