Multi-line button labels - basic4android

Is there an easy way to have two lines of button.text where you specify each line individually? Also, there seem to be large margins on the buttons so the text font needs to be quite small to fit. Is there a way to allow the text to use more of the button area?

The way I would do a two-line text implementation is:
Dim t1,t2 As String
t1="This is line one"
t2="This is line two"
...
MyButton.Text = t1 & CRLF & t2
The CRLF performs a Carriage Return and Line feed thus splitting the text up
I can't help with the padding issue though. Have you tried changing the font size?
MyButton.TextSize=9

Related

How to remove the empty lines in an html file

In the image below there are empty lines before the head, body and closing /html tags and within the body tag I want to remove. How?
put cursor at end of line with text
press Shift-ArrowRight as many times till cursor at pos 1 selecting all newlines till next text
Ctrl+Shift+L to select all similar parts
ArrowRight
Backspace as much times as needed
Esc to leave multi cursor
According to your screenshot, you can try to reduce the line height to reduce the gaps between two successive lines.
Open Settings
Type Line height in the search bar
Specify your desired line height
And done.
Also you could try reducing your font size which would automatically decrease the line height thus reducing gaps in between successive lines.
Use \n\n* in the Find Widget (Ctrl+H) with the regex option (.*) icon enabled, replace with \n. Replace All.
or better change this setting:
// List of tags, comma separated, that should have an extra newline before them. `null` defaults to `"head, body, /html"`.
`HTML > Format: Extra Liners`
In your settings.json:
"html.format.extraLiners": "" // just leave empty
Now when you format the html file those empty lines above head/body/\html should be removed (select all and Command Palette: Format Selection).

How to set width of text marks in vega-lite / altair (text wrapping and line break) for long text

I am trying to display text over time using altair (vega-lite), which works fine using a layered chart, where one is created using the alt.Chart().mark_text() function to display the text.
The text though is multiple phrases and should be wrapped (with line breaks). How can this be done?
(I do not want to use fixed line breaks, e.g. \n, at distinct positions since the text wrapping should work with zooming too)
Not exactly what you want, but you can specify a character on which to break to a new line. When zooming, the text stays the same size, so it should always fit the view.
For example making a new line for every word:
.mark_text(lineBreak=' ')

New line on UILabel messes with the word wrapping [duplicate]

Under certain circumstances, UILabel seems to bring an extra word to new line even when there is enough space for it, for example,
If one more word is appended,
Even if I force the width of the label to become something like below, it still moves the word consists of "c"s to the next line,
I've tried twisting the configuration of the UILabel, but seems it behaves the same unless I set the line breaking mode to character wrap, below is the configuration for the above cases,
And the constraints (in the first two cases, the trailing ),
Is there any reason for this particular behaviour and can I fix this? It looks weird in this way leaving that space emptied.
this is the default behavior since iOS 11, to fix orphaned words. No way to shut it off
to fix it
use the text as attributed text
or
use UItextview and turn of the scroll, edit option
or
use the custom label here
Get each line of text in a UILabel
You should set the line break to character wrap, because the letters after the space will be recognized as a word.
Hey I know this is late but I just figured out that you can cheat the system by adding a bunch of spaces at the end of the text.
If text of UILable may be changed, then it's still possible to use quick-dirty hack with "\n" - new line symbol.
Text "Aaaaaaaaaaaaaa bbb cccccccccc\ndddddd" will force UILabel to display:
Aaaaaaaaaaaaaa bbb cccccccccc
ddddddd
In Interface Builder new line can be inputted with Ctrl + Enter
If u use wordWrap, it tries to keep words in full form, as a result of this, it goes to next line. If you use character wrap, it will break on characters, and push the chars onto next line.
For Example:-
My name is ABCXXXX and I (have space here)
love myself.
Solution:-
Use NSMutableAttributedText and write love\n. It will make the "love" be in the space myself in the next line.

Hide certain characters in a text field in Flutter

I have a text field which I need to style for example with bold or italics parts.
I tried overridding the TextEditingController's buildTextSpan and formatting the text using annotation ranges with custom styles but the edge cases were too much and I really couldn't get it to work.
So, thought about using a formatter where before every change in format I'll add a custom character, like this:
This text is |bBOLD and this is |iITALICS. Would get me this:
This text is BOLD and this is ITALICS. So I override the buildTextSpan to build the TextSpan from a parse function where I split the text by the special characters and check the initial letter of each text for formatting info.
This works well except for the fact that when I press the right arrow to go the next character after the "This text is ", the cursor will stay fixed as it thinks there are two characters but being only for formatting, they aren't there on the render.
Is there any way I could tell the textfield to ignore certain characters when selecting, moving selection or typing?
I think this would work!
static const kCharToBEIgnored = 0x2C;
// Here 0x2C means ',' comma
// For complete list visit https://api.flutter.dev/flutter/charcode/charcode-library.html
String get text {
return String.fromCharCodes(
_value.text.codeUnits.where((ch) => ch != kCharToBEIgnored),
);
}

How to adjust spacing between paragraphs in iText7

In iText7 I need to create 5 lines of text at the top of a document that are centered to the page. The easiest way I found to do this is:
doc.add(new Paragraph("text of line 1").SetTextAlignment(TextAlignment.CENTER));
doc.add(new Paragraph("text of line 2").SetTextAlignment(TextAlignment.CENTER));
etc.
However there is a larger amount of space between each of the lines than I want. Within a paragraph you can set line leading, but how do I set leading between paragraphs in a document? Or am I doing this the complete wrong way to begin with?
Paragraph has 2 methods for handling what is known as the leading.
Paragraph o1 = new Paragraph("");
o1.setMultipliedLeading(1.0f);
Multiplied leading is when you specify a factor of how big the leading will be compared to the height of the font.
You can also set it document wise:
document.setProperty(Property.LEADING, new Leading(Leading.MULTIPLIED, 1.2f));
In my case with iText7, I used SetMarginTop(0f) and SetMarginBottom(0f) to make it.