# WebTabPanel Captions Cannot Be Set If Background Color Is Set

**URL:** <https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924>\
**Category:** Web\
**Created:** [January 15, 2025, 4:58pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924 "2025-01-15T16:58:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Mills](https://forum.xojo.com/user_avatar/forum.xojo.com/matthew_mills/32/18453_2.png) [@Matthew\_Mills](https://forum.xojo.com/u/Matthew_Mills)\
**Post date:** [January 15, 2025, 4:58pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/1 "2025-01-15T16:58:13Z")

</div>

Well this is interesting, to say the least. Settle in with a cup of coffee.

I have been working on a web-based interface off-and-on for a couple of months. I am using Release 2024r2.1. Since my pages are somewhat standardized, once my first one was complete, I duplicated it for my next page and removed/added as necessary. This worked fine - until it didn’t.

This page will be used at my client’s location in Poland, where some speak English and other Polish. I localized by creating a database table with the English and Polish phrases for every label, message, and tab panel caption. It is all switchable when the user logs in.

I also set the web page colors based on the browser dark mode setting. I do this with the following statement (pardon the hard-coding, but this is a bit of a get it out NOW job suddenly):

```auto
' Background color
if (not Color.IsDarkMode) then
  self.Style.BackgroundColor = Color.RGB(App.Red, app.Green, app.Blue)
else
  me.Style.BackgroundColor = Color.RGB(8,83,117)
end

```

The first four web pages work great. The color sets and the WebTabPanel captions are set to the value looked up based upon the language.

Suddenly, the next page didn’t work. The background color changes, the labels all set, but the WebTabPanel captions stay at Tab0, Tab1; etc.

It took a while, but I narrowed the cause down to the Me.Style.BackgroundColor setting. I created an entirely new, blank app. One web page, one WebTabPanel, and one statement to set a caption and then set the background color. The caption does not change. Remove the background color set and the caption works. The code is:

```auto
Me.Style.BackgroundColor = Color.RGB(8,83,117)
TabPanel1.CaptionAt(0) = "TEST"

```

I upgraded to Release 2024r4.1 and ran the same test program. No difference.

So why did this work before, but in the SAME PROJECT no longer works? I know I am a bit crazy, but this is beyond that. I really need both the background color and the localization, so I cannot just punt one of them. I would like someone to confirm this issue before I submit a support ticket, just to be sure it is not something on my computer.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [January 15, 2025, 5:15pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/2 "2025-01-15T17:15:18Z")

</div>

> [@Matthew\_Mills](#):
>
> The code is:

Where do you have the code?

Added your code to the webpage opening event, then to the TabPanel opening event and I see no problems:

 ![image](https://forum.xojo.com/uploads/default/original/3X/d/8/d82a20abc0d2e95335ccad77476f13c099e309a3.png)

 ![image](https://forum.xojo.com/uploads/default/original/3X/8/4/848ef97d2bdce1f61fc70b5522b5953e664d6073.png)

I guess I’m missing something.

---

<div class="post-metadata">

**Author:** ![Matthew\_Mills](https://forum.xojo.com/user_avatar/forum.xojo.com/matthew_mills/32/18453_2.png) [@Matthew\_Mills](https://forum.xojo.com/u/Matthew_Mills)\
**Post date:** [January 15, 2025, 5:27pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/3 "2025-01-15T17:27:37Z")

</div>

I have it in the Shown event handler.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [January 15, 2025, 5:34pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/4 "2025-01-15T17:34:37Z")

</div>

Shown event for tabpanel, works:

 ![image](https://forum.xojo.com/uploads/default/original/3X/7/0/70dd6223cce2f824029a6867af9569d8bc1da81d.png)

Shown event for webpage, doesn’t work (looks like it runs before the TabPanel is completely created I saw a brief change on Tab 0):

 ![image](https://forum.xojo.com/uploads/default/original/3X/2/8/282e3729724e5467abd1dd243c2f845010b7c1e0.png)

Edit: or maybe the flash I saw is just color change. At least you can add a bug report for this with a very simple project.

---

<div class="post-metadata">

**Author:** ![Matthew\_Mills](https://forum.xojo.com/user_avatar/forum.xojo.com/matthew_mills/32/18453_2.png) [@Matthew\_Mills](https://forum.xojo.com/u/Matthew_Mills)\
**Post date:** [January 15, 2025, 5:35pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/5 "2025-01-15T17:35:26Z")

</div>

Thank you! I will try that.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [January 15, 2025, 5:39pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/6 "2025-01-15T17:39:47Z")

</div>

Having the color change in webpage shown event and having the Tab Caption change in TabPanel opening event = works.

Having the color change in webpage shown event and having the Tab Caption change in TabPanel shown event = doesn’t work.

Just information that you may add to your case.

---

<div class="post-metadata">

**Author:** ![Matthew\_Mills](https://forum.xojo.com/user_avatar/forum.xojo.com/matthew_mills/32/18453_2.png) [@Matthew\_Mills](https://forum.xojo.com/u/Matthew_Mills)\
**Post date:** [January 15, 2025, 6:24pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/7 "2025-01-15T18:24:17Z")

</div>

That worked great. The documentation recommends against setting controls in the Opening event, but does use the words “most cases.” Seems I found an edge case. Lucky me.

Thanks again.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [January 15, 2025, 7:03pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/8 "2025-01-15T19:03:11Z")

</div>

> [@Matthew\_Mills](#):
>
> The documentation recommends against setting controls in the Opening event, but does use the words “most cases.”

I think the documentation needs update.  
That was true for Web1, now with Web2 the recommendation is to use Opening event to avoid flicker/extra call to the server (if I remember correctly this was mentioned by Xojo staff).

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [January 15, 2025, 7:27pm UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/9 "2025-01-15T19:27:10Z")

</div>

Created an Issue:  
[#78249 - WebTabPanel Captions Cannot Be Set If Background Color Is Set (Shown event)](https://tracker.xojo.com/xojoinc/xojo/-/issues/78249)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [January 16, 2025, 8:58am UTC](https://forum.xojo.com/t/webtabpanel-captions-cannot-be-set-if-background-color-is-set/83924/10 "2025-01-16T08:58:47Z")

</div>

Thanks for opening the issue!
