It shows what the text actually reads when using rich text.
Why did you opt to make this a property rather than a getter method? Surely the latter would make more sense?
textLabel:GetTextContent()
textLabel:GetRenderedText()
etc.
That way, you don’t run into the same name collision issue.
While your proposed solution would probably eliminate any issues, as it is not likely anyone has an instance named GetTextContent
; you’d be removing the ability to listen to ContextText
changes using :GetPropertyChangedSignal
.
This will be invaluable to bind effects to text, and its not something I want to miss out on.
Does this involve using any of the Grapheme properties still?
I’m really curious about this use and would like to learn more due to using a Typewriter visual.
I don’t understand… can’t you just check the length of the source string?
It’s not that simple due to rich text. The Text
property of text GUIs will include characters that aren’t actually part of the text displayed to the user and only serves the purpose of formatting the text the user sees.
Perfect. Thank you Roblox. I had Content in text labels in older games, and ContextText sounds like an actual property.
most things are good as long as there is a switch to turn it off, at least in my opinion. what i mean is
can there be a switch to turn it off
It’s a single property that only gets updated (presumably) whenever you change .Text
, adding some option to disable this property would likely be more wasteful than just leaving this property always on.
This seems pretty useful considering I use typewriter effects a lot.
This is going to really speed up developing times, thank you very much roblox.
You could use :GetPropertyChangedSignal
on the Text
property which should be pretty much the same (unless you add an empty tag for some reason).
Nonetheless I still prefer having it as a property
RenderedText
was (unsurprisingly) considered as one of the options.
The reason that we didn’t go with that one is that it has a strong implication that the property only works when the text is actually being rendered to the screen. Which is not the case, you can read the ContentText
property and use its value even for an Instance that isn’t parented to the hierarchy.
Perhaps then a better solution would be to introduce extra specificity? ContentText
as-is is still relatively vague. What about a name such as RichTextContent
?
Including RichText specifically in the naming is also undesirable in some ways, because while RichText is currently the only way for the Text property and the actual processed text to mismatch, there may be other ways for that to happen at some point in the future, and it would be nice for this property to also interact well with those.
Though obviously including a reference to RichText in the naming would make it more clear for the time being, so it’s a tradeoff.
If I’m not wrong, this read-only value is a string? If so, why not call it “TextContents” or “ContentsOfText” or something that is a bit more specific. I can see how coming up with a name for this was difficult, because It took me a good while trying to think of a good name for it.
In general my thoughts were:
- TextVolume
- TextDetails
- TextCapacity
- TextSum (More for something like numbers so I didn’t quite know how I felt about this one)
Anyways that’s all the name ideas I had. Hopefully that helps generate a new name for it, because I feel like “ContentText” is just something that is way to generic and that’s definitely a name that tons of people (myself included) probably used at some point.
Maybe make some sort of engine warning to the user who attempts to use a Child that is named “ContentText” directly through the .
navigation instead of :WaitForChild()
and :FindFirstChild()
?
Anyways good update. (I think?)
What do you mean by this? It’s just the text?
What they mean is, if someone uses something like RichText to achieve like line breaks and stuff like n/
,
it would be like Hello world
(2 spaces inbetween Hello World
while not using RichText, it would only have 1 space. It’s to show the accurate string over the normal Text property. I feel it’s a bit redundant as well, but I think this is what they mean.
If the RichText is on, It would return you the string with all the rich text tags removed. When the RichText is off it will be equivalent to Text.
What about something like RawContentText, CurrentDisplayedText, or CurrentContentText? Something more specific that would be less likely to cause things to break.