NiGui
NiGui copied to clipboard
Changing Colour of Button results in `cannot dispatch; dispatcher is nil`
button_switchMode.onClick = proc(event: ClickEvent) = bMode = if bMode == ENCODE:
button_switchMode.canvas.areaColor = rgb(255, 0, 0)
button_switchMode.text = $DECODE
DECODE
else:
button_switchMode.canvas.areaColor = rgb(0, 255, 0)
button_switchMode.text = $ENCODE
ENCODE
When this onClick event gets triggered, my app is getting the following error.
Error: unhandled exception: cannot dispatch; dispatcher is nil
When trying to research this issue, there were hints pointing at it being a problem with incorrect method implementations or at least related to objects.
Currently buttons don't support a custom background color or custom drawing through a canvas. As far as I know there is no easy way to implement this.
Currently buttons don't support a custom background color or custom drawing through a canvas. As far as I know there is no easy way to implement this.
What about this?
https://github.com/simonkrauter/NiGui/blob/03f7db26317fdc84a0f7b2ff92d7d8a50cb045a2/examples/example_30_custom_button.nim#L12
Oh right. What I said above only applies for a native button. You can use your own button based on the type Button. Then your code is responsible for drawing the widget.