simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
718 stars 50 forks source link

Immutable Progressbar Value #100

Closed Synth9283 closed 4 years ago

Synth9283 commented 4 years ago

Greetings, I have lately started using the NiGui library. However, I have recently encountered a problem where I am not able to change the progressbar.value as displayed here on line 26 inside a for loop with an onButtonClick event

0xACE commented 4 years ago

This report is not helpful?

Which os are you on?

Please provide a minimal example showing the error.

The link you provided is working as expected.

Synth9283 commented 4 years ago

OS: Arch Linux Example:

import nigui

app.init()

var window = newWindow()

var container = newLayoutContainer(Layout_Vertical)
window.add(container)

# Adds a button
var loadButton = newButton("Load")
container.add(loadButton)

# Add a Progress Bar control:
var progressBar = newProgressBar()
container.add(progressBar)

# When load button is clicked
loadButton.onClick = proc(event: ClickEvent) =
    for i in 0..100:
        progressBar.value += float(0.01)

window.show()
app.run()

I wish to increment and progressBar as shown from above. However, I am not able to due to an error response of progressBar.value being immutable

SolitudeSF commented 4 years ago

value is a getter procedure, not a field. progressBar.value = progressBar.value + 0.01

Synth9283 commented 4 years ago

It works! Thank you very much! I am very sorry about this