This is my code:
import nigui
app.init()
var diceContainer = newLayoutContainer(Layout_Horizontal)
for i in 1..6:
var dieImage = newImage()
dieImage.loadFromFile("Dice" & $i & ".png")
var dieControl = newControl()
dieControl.onDraw = proc (event: DrawEvent) =
var control = event.control.canvas
control.drawImage(dieImage)
diceContainer.add(dieControl)
dieControl.widthMode = WidthMode_Fill
dieControl.heightMode = HeightMode_Fill
var window = newWindow()
window.add(diceContainer)
diceContainer.widthMode = WidthMode_Fill
diceContainer.heightMode = HeightMode_Fill
window.show()
app.run()
The result I get is: 6, 6, 6, 6, 6, 6 But I was expecting: 1, 2, 3, 4, 5, 6
What is wrong with my code? And is there a better way of writing this code?