Watch App - Replace ... when text is too long - swift

I have a problem with the size of my text.
When my text is too long in a WKInterfaceLabel, no problem, I just add line or I pass line at 0 to increase automatically the number of lines.
But with WKInterfacePicker, impossible to increase the number of line and I have "..." at the end of my text.
Do you have solutions to display all my text or, at least, to delete this "..." and replace it by some letters more from my text. I work with Swift.
For the second solution, I prefer have "My text" than "My te..."

Sadly, this is not possible. Apple doesn't provide any sort of way on managing that.
A possible, but rather complicated solution would be making a costume picker with labels with multiple lines and using the newly implemented WKCrownSequencer as well as the WKCrownDelegate in watchOS 3 to detect the state of the digital crown. The default picker animations might be impossible or very difficult to reproduce, but it might fix your problem.

try this set in size width = size to fit width content

Related

Adding line counter to a text field

I want to add a line counter to a textfield for a sort of text editor. Looking around, I've seen that a lot of questions on this topic are either unanswered, or do not answer in a satisfactory manner. Something like this How to add prefix widget on every new line in textfield in flutter? asks fundamentally the same question I am, however the only answer there is to create a new widget for each line.
This is one method that could be used, where I add new textfields in a list and build them in a row with their respective line number. However, this means I cannot have those textfields function on more than one line, and I will need to add more textfields each time a user wants to add enough text to make it overflow. The biggest flaw I see with this, though, is that it makes it harder (if not impossible?) to easily select and edit text as you would expect from a text editor, such as using the built in systems for a textfield.
Now, for my solution I am using https://pub.dev/packages/extended_text_field as a way to gain some functionality that I don't really want to take the time to figure out how to do on my own (embedded onClick callbacks for text), so it would be ideal if I could continue to use that without having to fork or even have to figure out how to write my own version.
The primary issue I'm running into is not necessarily getting the number of lines, which can be found using some solutions from How can I add line numbers to TextField on Flutter?, but rather how and where to show those line numbers.
As above, it's not really ideal to pair some number alongside a textfield and create a new textfield for each expected line. What would be ideal, however, is something like , where each line number is prefixed to the line built by the text field. For example, like this: . Something like the solution proposed in Add a prefix to every line in a multiline Text Input in Flutter? would not work especially well, because the solution there is to literally add string values to the textfield, which would require systems to clean the text, in addition to causing an unexpected ability to actually change the numbers (or other line prefix) by the user.
So -- is there any way to implement a line prefix for each line in a textfield? Would it be possible to override an InputDecoration (which allows creating the individual line prefix, but nothing more) to create a line prefix for each line drawn by the textfield? If not, exactly what would be needed to create this? I am familiar with flutter, but I am not quite as familiar with the lower level API's.

Fillable Pdf multi-line, Allow rich text formatting in Acrobat Pro DC: but it ignores line spacing/leading set in More

I'm on Win10, using Acrobat Pro DC 2021.011... to edit and Reader DC (same version) to test.
From experience and from reading forums etc, forms in these apps are maddening... but I have not been able to find any discussion (or solutions) to the following behavior...
The form I'm building for other employees' use has a large edit text box set to Multi-line and Allow Rich Text Formatting. It is set to a default font, Calibri and size 50pt. For most situations this will work for them; provides 2-3 lines for a short product description. But occasionally they want a smaller font and more lines... They know how to get the ctrl+e properties bar. But in my testing of this alternative situation they'll need sometimes, I'm finding it's impossible to get the smaller font size and more lines to work. Here's my process.
tab into text box. Ctrl+E for properties bar.
before typing I set the font size to 24
then I type in my 4 lines of text
then I tab to my next form field...
and kaboom... the field I just filled...it's line height is so large it's pushed some of the content invisible. I assume this is coming from the field's default font size, 50
And if I try to adjust the line height, by selecting all the text and then choosing in More...>Form Field Text Properties>Paragraph>Line Spacing
If I set it to Single and click Close/click into another field I get the very large leading (presumably for 50pt font (same as pic above after point 5)
If I choose Exactly and set to point size slightly larger, click Close/out of field, I get another ridiculous result where the 2/3 line have the height I set, but the space between the 1 & 2 second line is way too much and the space between the last line and 3rd line is way too small...
before tabbing or clicking out of field to another field
Good lord.. what is that! 3 different leading values in the same field; just after applying 1 value to all lines, all text in the field...
It makes no sense... it doesn't look like it regards your input at all, and just comes up with it's own random leading... I've fiddled with Space before/after and combinations of Line Height and nothing comes close to what we need... At this point I'm convinced the Acrobat tools for a stylizing text in a multi-line, allow formatting text field are useless. I'd be better off with my employees they can't format anything, ever. Just type one line and hit Tab or Enter...
What is going on! I'm trying to make a simple fillable form for other employees to use, but this kind of behavior makes that impossible (It's enough of a stretch to teach them to use the ctrl+E and do some styling of their text but this is bonkers and completely unteachable... there's not rhyme or pattern to teach!)
Hope someone can help or has seen this behavior too.

How to render a "View More" link if text in a widget is too long to fit in a specified nr of lines

I am working on an app with a chat feature that shows messages in a ListView. The size of each "message" depends on the amount of text in that particular message.
I would like to put a limit on the number of lines, say 10 lines max. If a particular message happens to take up more than the limit, the text should be truncated near the end of the 10th line and a "FlatButton" with the text 'more...' be provided, which allows the user to open up that message to see all the text. For messages that fit, this button will not be shown.
The part I am struggling with is being able to truncate the text at the right point.
Currently I am thinking that guessing the number of lines a message might take up based on the number of characters and the font size would be the best approach, with the limitation that sometimes it might be off by a couple of lines. That is probably acceptable in this application.
As a bonus I also would like to render the "more..." button "inline" at the end of the text, but that is probably a separate question.
Did you try the maxLines property of Text widget? This in combination with overflow should solve your problem.
Reference
maxLine property
overflow property

How to insert keyboard key graphic representations into your document?

I'm working on a document describing keyboard shortcuts in GNOME and want to make text better looking than: ALT + TAB. A common way seems to be like in this thread where the buttons appear to be within the text:
https://unix.stackexchange.com/q/465681
Is this possible in LibreOffice in a proper way, or is it just inserting images inline? That doesn't seem like it would work every well with changing font size, etc. later, so I was hoping for a better solution.
You could insert real push buttons that don't do anything by following steps 1 thru 6 outlined at https://help.libreoffice.org/Common/Inserting_and_Editing_Buttons. But that approach, as well as inserting inline images, would be awkward because you'd have to worry at least about sizing, anchoring, and wrapping of surrounding text.
The approach you appear to be trying to avoid seems much more palatable, so long as you're not looking to exactly duplicate to Stack Exchange look.
As an example to demonstrate that it's workable, I did the following by applying the same Character formatting settings to each key word. This involved changing font family and size, setting light gray highlighting, adding a gray border, and changing left and right border padding from 0.02 to 0.06...
To make things easy, the settings could all be done with a single button press by creating a macro that could be applied to selected text. And since the result is just formatted text, there are no sizing, anchoring, or text wrapping issues to worry about.
One other option, as an alternative to significant text formatting, is to acquire and use a keyboard font, such as that discussed at How is the Keyboard font automatically styled as keyboard-like keys for the letters in Alt, Shift, Ctrl, Esc, and Backspace?. That would only require changing to that font to type in key representations.

text-align-last css property Swift Equivalent

What is the swift Equivalent for 'text-align-last' css property?
I prefer a codeless solution.
Here is what i have done and what i get:
The last line (sometimes the only one) is aligned to the left, which is inconvenient.
You need to change the label's text from Plain to Attributed, then you can paste any string and the alignment, as well as other attributes, will hold.
So basically any text style that can create on word processor application can be used here.
In the following example I've used pages (Mac application) to edit the text format as I liked and copied it to the label text box in Xcode.
Here is a picture of the simulator running the app:
While it is not possible to apply different aligns on a single label, if the last(and sometime only) line should be aligned to the right why not align the entire label to the right?
EDIT
If that doesn't fix you problem then I don't think it's possible to resolve without code.
In the case you do decide to write some code you could look into determining which is the last line of your string (maybe: How to get text from nth line of UILabel? ) and try to apply different formatting with AttributedString.
If that works then you can always subclass UILabel and override func layoutSubviews() to calculate this automatically for you. This way you won't have to think about it again!