Web 2.0 WebButton menu item captions not visually refreshing

Xojo 2021R2.1/Win , tested on Firefox, Chrome, Edge.

Suppose there’s a WebButton with a menu that’s being initialized in the Opening event:

me.Menu.AddMenuItem(“initial”)

Then, at runtime, a method changes the Value of that menu:

Button1.Menu.MenuItemAt(0).Value = “updated”

What happens is that the Value is logically refreshed (the MenuSelected event gets the updated value), but not visually! The button keeps showing the initial menu item value!

  • I’ve added calls to UpdateBrowser immediatelly afterwards, no joy.
  • I’ve tried removing the menu item and re-inserting it, happens logically but there is no visual refresh.
  • And by the way, insertion of additional menu items after the Opening event doesn’t appear to be working either.

Why is this gravely important? It’s impossible to localize the app!

Am I doing something wrong?
Looks like a bug, could there be a JS black magic quick-fix/workaround?

Thanks!

You can force an update by calling the control’s UpdateBrowser method.

Tried that already (first bullet point). Doesn’t lead to a UI refresh in this case.

Open a bug report with sample code, explanation, steps to reproduce.
Post its number back here after and let’s track the solution.

Created case 66478

<https://xojo.com/issue/66478>

1 Like

Ok, try this after changing the menu

Button1.Enabled = Button1.Enabled
Button1.UpdateBrowser

Nope, doesn’t refresh. Tried it in Firefox, Chrome, Edge.

Just in case, also tried:

Button1.Enabled = false
Button1.Visible = false
Button1.Enabled = UpdateBrowser
Button1.Enabled = true
Button1.Visible = true
Button1.Enabled = UpdateBrowser

Doesn’t work either.

From what I can see, this case has been marked as “fixed”, but it was not included in the 2021R3 release. The issue persists.

In the meantime, I’ve found a cumbersome workaround to localize, using Localized Constants and Session.LanguageCode set by a URL option at page load, but that doesn’t mean it doesn’t need fixing anymore. In this case, language change = webapp reload, and that complicates things unnecessarily in some scenarios.

So, what does “This case has been fixed and is waiting verification from our testing staff” effectively mean? That it’s going to be included in the next release, or that it can remain in that state for an indefinite amount of time?

Whenever an engineer checks in a fix for a bug report, they have to weigh whether or not the fix is safe for the current cycle. The more complicated the fix is and the closer we are to release make it less likely that it would be included in the current release cycle.

So unless a case was fixed as part of a feature branch, it should appear in the next prerelease cycle.

Does 2021r3.1 include this fix? From what I see, the problem still persists. Anyone have a work around?

It looks like that fix didn’t make r3 or r3.1, I guess we need to wait for 2022r1

Asking the same question.

I’ve had luck modifying contextual menus – however it appears from the compiler that WebControl.PresentContextualMenu has been removed. Still listed in the docs: https://documentation.xojo.com/api/user_interface/web/webcontrol.html#webcontrol-presentcontextualmenu