Skip to content

_background_supports_alpha should be added to WinForm ProgressBar #2430

@ikus060

Description

@ikus060

Describe the bug

As title explain, ProgressBar widget on Windows doesn't support alpha color and raise an exception when set to transparent. To avoid this, the widget class should declare _background_supports_alpha = False

Steps to reproduce

Simply create a Progress bar with TRANSPARENT background.

Expected behavior

Should not raise an exception.

Screenshots

No response

Environment

  • Operating System: Windows
  • Python version: 3.10
  • Software versions:
    • Briefcase: NA
    • Toga: 0.4.2
    • ...

Logs

    self._applicator.set_background_color(value)
  File "c:\Users\vmtest\Documents\minarca-agent\.venv\lib\site-packages\toga\style\applicator.py", line 51, in set_background_color
    self.widget._impl.set_background_color(color)
  File "c:\Users\vmtest\Documents\minarca-agent\.venv\lib\site-packages\toga_winforms\widgets\base.py", line 132, in set_background_color
    self.native.BackColor = win_color
System.ArgumentException: Control does not support transparent background colors.
   at System.Windows.Forms.Control.set_BackColor(Color value)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.good first issueIs this your first time contributing? This could be a good place to start!windowsThe issue relates to Microsoft Windows support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions