Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Colour of Button results in cannot dispatch; dispatcher is nil #152

Open
theAkito opened this issue Jul 31, 2022 · 3 comments
Open
Labels

Comments

@theAkito
Copy link

  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.

@simonkrauter
Copy link
Owner

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.

@theAkito
Copy link
Author

theAkito commented Aug 1, 2022

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?

canvas.areaColor = rgb(55, 55, 55)

@simonkrauter
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants