I am trying to make a tooltip with bold text. I figured NSAttributedString can be used make a string bold. However tooltip only accepts string type. Is there a way to make tooltip with bold font.
Here a sample of what I am trying to achieve(from Xcode):
Related
I'm trying to add an autocomplete feature in my project and I'd like the possible autocomplete data to be a greyed out, unselectable and without affecting the user typing.
If I could get the placeholder to be always visible that could work.
I tried setting the value prop of TextField to an JSX.Element but it only accepts primitive types. Fortunately I am using monospace fonts.
What are my options?
A div that is always visible and on-top?
2 text field next to each other with no padding or margin?
Somehow make the placeholder always visible?
Forced example (ignore the cursor)
I am trying to get selected text's size(pixel) and font weight(pt) with AutoHotkey like HTML attributes. How do I do?
I have done some search on google and have found this:
Function: GetTextSize - Calculate text dimension
But every text have its own font-type and how this code works correctly for other font types?
I want to change from proportional to tabulated digits in menu items? It's possible?
Menu without tabulated digits
You need to use the monospaced font like this:
label.font = UIFont.monospacedDigitSystemFont(ofSize: 17, weight: UIFontWeightRegular)
Obviously you can specify whatever font size and weight you want (or get them from the current font descriptor).
You can set the attributedTitle property of a NSMenuItem and provide whatever custom alignment or formatting you want through an NSAttributedString
Good examples of how to do string alignment in an attributed string can be seen here:
Attributed Text Center Alignment
Here is an answer that shows how to add tab stops to an attributed string:
How do I add tab stops to an NSAttributedString
You can even create an attributed string from RTF or HTML:
Creating an NSAttributedString from HTML (or RTF)
I am creating an OSX app with NSTextView inside NSScrollView. Using the FormatMenuItem I can modify the text in that NSTextView to Bold, italic etc. But when I get the values using (NSTextViewOutlet.String) I cannot get the modified string, that is the string contain bold and italic characters.
By using below code solve my problem.and i use NSTextField instead of NSTextView.
let str = txt_outlet.attributedStringValue
i have a tableview. in cell i am displaying some string data from xml.
in that string some italic tags and some normal tags r there.
but when i try to display the entire string it is displayed in normal text and not getting italic text.
i tried by taking 2 labels one with italic text and another with normal text and appending these 2 labels but i am getting entire string as italic.
how can we apply 2 styles in a label
Thanks in advance
Currently, the UILabel control does not support "rich text." You cannot have some text italic and some normal in the same UILabel.
Three20 has a label that supports this, however:
http://api.three20.info/interface_t_t_styled_text_label.php