using html in chart names

I uploaded Phalanx_bug_report.vmod to illustrate the problem. I’m assuming the tech support people can see it.

I’ve been using html in toolbar buttons with success for some months; for example for the overview map button:

Overview
Window

More examples of this can be found in the Streets of Stalingrad module (0.72)

But doing something similar in the name of chart is unstable.

Open Phalanx_bug_report.vmod and click on the CHART button. Use the right arrow to scroll among the charts, and the five labels will be correct, and seem to stay that way (cached?) until the module is closed. But if you again open the module and click CHART, but instead press the left arrow to scroll the charts, the labels are, to be generous, confused. If instead of left/right arrows you first select charts at random, the labels eventually settle into a different, but incorrect, display

Note the the correct chart or map is always displayed.

I discovered this issue on a different project, where the boldface text is used to differentiate among (for instance) Terrain Effects Charts. When working right, I find the interface pleasing.

Maybe html isn’t “approved” for these labels, but it’s so close to working that I don’t know if this should be a “bug” or a “feature request”

Brian may want to comment in more detail, but the fact that HTML works in things like toolbar buttons at all is purely by chance because Java Swing components happen to support a very old brain-dead HTML implementation.

So, at this stage, it is certainly not ‘Approved’ and very much use at own risk. There is very little we can do to improve or change the behavior of HTML in toolbar buttons and changes we make do not take HTML support into consideration.

Including HTML in tab names is even more dodgy and a quick test seems to point to a Java Swing issue handling the HTML in that circumstance.

To do this properly, we would need to add the option to ‘style’ the Name text in chart tabs.

Thanks for the quick reply. The tab name usage isn’t quite as useful as on toolbar buttons, where it allows two rows of text to accompany a typical 32x32 icon which saves space. So supporting “escaped” characters might be an option.

You are not alone… I happened into html in buttons exactly for two text rows; it is nice also to be able to vary colour, bold and font size.

Mark

I had a peek through and discovered that JTabbedPane (the Java Swing component that deals with those tabs) seems to have some kind of grotesque bug which is causing the behavior you’re seeing. Because otherwise HTML is “generally supported” in Swing components – albeit an “old” version of HTML, but enough to do basic bolding and stuff.

SO. I have made a workaround in the VASSAL code that “refreshes” the names on the tabs every time “anything happens”, and that seems to get around the problem.

If you want to try a test build, they should appear here: github.com/vassalengine/vassal/ … /677671615 (NOTE you will need to be logged into a GitHub account to be presented with download options for the test packages).

Brian

I created a GitHub account and downloaded. That does seem to resolve the problem in terms of the tab displays going bonkers. The workaround sounds a little crude, especially if “anything happens” is global and not just while the particular object is being displayed. Should I assume that this will make it into 3.5.4, or only if a cleaner fix can be implemented?

I’ve not tried tweaking colors and fonts, but very much like the multi-line and boldface ability.

Thanks for looking at this! Someday I’ll get out of my low-level programming ( “C” is high-level from where I work ) and learn JAVA. There are some features I want to implement, especially in VASL

I think the color stuff will work as well – you may need something like … your text

Or else “color:#ffffff;” for RGB. I think the version of HTML supported by Java Swing only supports the 2-hexadecimal-digits-per-color format.

Finally by “anything happens” I only mean when something changes w/r/t the JTabbedPane object – in other words it refreshes the tab names for ALL of that pane’s tabs whenever ANY of the tabs changes. That’s notionally less efficient than what we should be able to do, but as a bug-workaround it certainly isn’t grotesquely inefficient – nothing anyone will ever notice.

Java – come join us, the water’s great! I did all my early professional work in C, moved to C++ in the mid-90’s, and opened my very first Java file a year ago :slight_smile:

Brian

If it’s only within the JTabbedPane object, then yes, no one will notice. A “clean” fix might even be more computationally expensive

I’ll test the water sometime; this old dog needs to learn new tricks one at a time – my first paid programming job was in 1966 :exclamation:

CODING ON VASSAL KEEPS YOU YOUNG!!!

1 Like

So that’s what the Ponce de Leon button is for!

I can assume that this fix will make it to 3.5.4 ? Is there a timeline for that? I don’t want to push something that will break

Thanks

While I’m thinking about it: having some limited html capability in the Notes Window would be nice, at least for the text in the scenario section (not the tab)

Thus spake crispy1critter:

So that’s what the Ponce de Leon button is for!

I can assume that this fix will make it to 3.5.4 ? Is there a timeline
for that? I don’t want to push something that will break

I merged the fix for this last night.

We aim to release 3.5.4 before the end of the month.


J.