# Toggle button background color (with "@ifset") + OSD (on screen display) message possible?

**URL:** https://resource.dopus.com/t/toggle-button-background-color-with-ifset-osd-on-screen-display-message-possible/52513
**Category:** Help & Support
**Created:** [August 28, 2024, 5:01am UTC](https://resource.dopus.com/t/toggle-button-background-color-with-ifset-osd-on-screen-display-message-possible/52513 "2024-08-28T05:01:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![r0n](https://resource.dopus.com/letter_avatar_proxy/v4/letter/r/51bf81/32.png) [@r0n](https://resource.dopus.com/u/r0n)
#### Post date: [August 28, 2024, 5:01am UTC](https://resource.dopus.com/t/toggle-button-background-color-with-ifset-osd-on-screen-display-message-possible/52513/1 "2024-08-28T05:01:02Z")

</div>

**1)**  
How do you toggle the background color of an button, currently I have something like this

```auto
@ifset:HIDEEXT=On
Set HIDEEXT=Off
@color:back = "none";
@ifset:HIDEEXT=Off
Set HIDEEXT=On
@color:back = "#FF0000";

```

When clicked, set button background to red, when clicked again set to back to default background.  
But this does not work (it doesn't toggle).

**2)**  
Is it possible to render an onscreen display message for preset duration, like those CRT televisions with the green overlay text. I think windows has an OSD api(?)  
If it's not possible, could it be considered in the future? (It would serve as an alternative for the messagebox)

---

<div class="post-metadata">

### Author: ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)
#### Post date: [August 29, 2024, 2:09pm UTC](https://resource.dopus.com/t/toggle-button-background-color-with-ifset-osd-on-screen-display-message-possible/52513/2 "2024-08-29T14:09:13Z")

</div>

Lines with @modifiers are all processed before any conditional branching happens, which is why the original approach wouldn't work.

You can do this:

```plaintext
@toggle:disable
@color:back=IsChecked("Set HIDEEXT=toggle") ? "#FF0000" : "none"
Set HIDEEXT=toggle

```

The `@toggle:disable` line stops the normal background color change from happening, so that your specified background isn't blended with another color.

The `@color:...` line uses the Evaluator to test if the toggle is on or off and set the color appropriately.

---

<div class="post-metadata">

### Author: ![r0n](https://resource.dopus.com/letter_avatar_proxy/v4/letter/r/51bf81/32.png) [@r0n](https://resource.dopus.com/u/r0n)
#### Post date: [August 29, 2024, 2:32pm UTC](https://resource.dopus.com/t/toggle-button-background-color-with-ifset-osd-on-screen-display-message-possible/52513/3 "2024-08-29T14:32:42Z")

</div>

This works!  
Thank you!
