I have a large application with several thousand constants that have been used to internationalize the app. For many years I’ve been able to put #CONSTANT_NAME as the .text value for things like labels, and the default value for that constant would appear in the IDE. Today using Xojo 2013 R3 I discover that this appears to no longer work.
When I first load up a project, the constants appear in the windows as you would expect, as in this first screenshot.
As soon as I click on the content of ANY window, then ALL the constant values are removed from ALL windows, as in this second screenshot.
If I edit the value of the text for the label, and add a space to the end of the constant name, then the #CONSTANT_NAME shows up in the ide window. If I then remove the space, the correct default value for that label only shows back up.
I have more than 30 windows in this app, with thousands of places I’ve set up labels and other UI using constants in this fashion. PLEASE don’t tell me I have to reset EVERY one of them like this.
Interesting… My project is composed of lots of external items, as I re-use some components in other projects, and only wanted to write them once and keep them in sync. The windows I was testing this with are all stored externally to the project.
When I created a smaller project using one of my external windows and my external Strings module that is filled with thousands of string constants, I was able to duplicate the problem. One window, and my strings module.
But they were both still external.
So I pulled them internal so I could package up the sample to share in Feedback, but then discovered when opening the now-no-external-items project that many of my controls were using deprecated supers:
I selected all, and had the IDE fix them all for me (changing them all to use Label as their super). Now the problem has disappeared.
So, this begs another question: Why didn’t the IDE warn me about deprecated supers when the window was stored as an external project item? Is this a known issue?
[quote=34329:@Kimball Larsen]Interesting… My project is composed of lots of external items, as I re-use some components in other projects, and only wanted to write them once and keep them in sync. The windows I was testing this with are all stored externally to the project.
Interesting indeed. Your External items: are these stored as Binary or XML format?
What I’m seeing is that StaticTexts with Captions were converted to Labels properly. They show up fine in the IDE, and when I save the file (as XML/VCP) I can see the .Text value is saved in the project. However, at runtime, they show up as blank. This seems to be unrelated to the use of constants - just a regular “hello world” staticText is showing up blank at runtime when it’s been converted to a Label.
Fortunately, my code is all under SVN so I can back-out any changes. Regression testing using prior versions: (Test procedure : undo changes using SVN revert. Open the project file, use the IDE’s “Resolve Issue” feature to convert StaticTexts to Labels, and then hit Run to see if they show up) gives these results:
2013 R3 : Broken: Captions show in the IDE but are Empty at runtime.
2013 R2 : Works fine
So this really seems like a new bug in 2013 R3, which is unfortunate.
The good news - after using 2013 R2 to do the the StaticText->Label “resolve issue” conversion, I saved the file, and opened in 2013 R3, and most of them seem to be fine. So there is a workaround. (Some of my captions don’t look right, but these ones seem to be in Label subclasses - need to investigate this more).
Whether this fixes your original issue (with #CONSTANTs) I don’t know. May be 2 or 3 different bugs?
You might want to step back to 12r2.1, convert the deprecated controls and then try 13r3 again. I converted all of my old code in 12r2.1 and I’m not seeing the issues in 13r3 - and my dynamic constants have 5 and sometimes 6 languages attached.
Ok, I’m definitely seeing something weird with Label subclasses, too. They are blank at runtime even though they appear fine in the IDE. Regular staticTexts converted to Labels (using 2013 R2, then imported into 2013 R3) are fine, though. Weird. I’ll do more testing on this issue.
Peeking at the VCP format files : it seems that the issue is that sometimes these converted Labels have both a “Text” property and a “Caption” property - the Text property is non-blank, but the Caption is blank (or vice-versa).
It seems that there are two possible failure modes here:
the text caption shows up in the IDE but is blank at runtime
the text caption is blank in the IDE but visible at runtime.
I’m able to confirm that regular StaticTexts simply converted to Labels seem to work correctly in 13R3. I don’t have any subclassed labels, but it seems your trivial example exposes a reproducible bug.