Objective-C | Truncate only last line of multi line label on OS X - objective-c

I have a Multi Line Label and I want it to truncate only the last line tail. In the Attribute Inspector I set the options like the screenshot:
But it truncates always the first line.
This topic is a duplicate of this:
How to make a Multi-line (2 lines) label truncate the last line (OS X)
But I have had to open another one, because I don't have enough reputation to comment other people's topic.
Thanks for the replies!

Change "Layout" to Wraps, which will change "Line Break" to Word Wrap, too. So long as "Truncates Last Visible Line" remains checked, you should get the result you want.
In other words, a Multi-Line Label just as it's dragged out from the Object library, tweaked by checking "Truncates Last Visible Line", does what you want.

Related

C Programming Format Adjustment

I am asking for some homework help. I am not asking for the answer,I just wanted to be pointed in the right direction.
I have a program in C which I am new to. I have to recreate a Unix tool using vi. Its job will be to read input and “neaten” it up. It reads in paragraphs of words and rearranges them such that they fit nicely onto a line of specified width, inserting line breaks as needed. A paragraph is separated from other paragraphs by one or more empty lines than changing the width with -w and changing to right alignment using -r.
Next would be to justify the text using -j so that every line with more than one word extends from the left to the right with max width. I need to apply integer division to calculate the total number of spaces that should have been seen by the time you finish a gap using Kevin Woods Si = i*S/G where S is the total number of spaces needed in the line, G is the number of gaps between words in the line and Si is the number of spaces that should have appeared by the end of the i'th gap. Lastly suppress line spacing from lines entered with more than a double line back into a double line.
The options should be cumulative—I can specify width, alignment, and skipping of blank lines together. The -r and -j flags should not be used together.
first step: metacode
main(arguments)
analyse arguments f.e. with getopt() for correctness and validity
read the original text
break the text into virtual paragraphs (identified by a double LineBreak)
for each paragraph
break it into lines of less than allowed (-w, default 80) characters
for each line that is not the last line of a paragraph
fill with spaces according to your algorithm and command line spezification
print out all lines
second step: coding
this is your task. Please come back, when you have code, that shows us, where you are stuck.

Creating a line in an excel chart which always shoots a red line through todays date in VBA

I have a chart which I would like to always run a line through today's date after I run a Macro I am working with. I would also like it to say Today right above the chart and above the red line. I would like to code this out in VBA but I don't really know where to begin. I have the chart Does this make sense? Thanks.
Read through this and combine with =TODAY().
Edit: The specific formula you'd be using for your column of vertical lines is
=IF('cell in same row containing date'=TODAY(),MAX('range of your data'),"")
This formula will return the max from your list of data if the date in your table is today's. If you follow the instructions for option 2 from the link and create another data series for vertical lines and put this formula in that column, you will have a vertical line that is always on today's date.
One more Edit: To address having "Today" above the line, add data labels to your "Today" series by right clicking on the series and going to "Add Data Labels." Right click on the Data Labels and go to "Format Data Labels." Go to "Number" and select Custom. Enter "Today";;; into the Format Code box and click add. Your Data Labels for your blanks should go away and your date line should have "Today" over it. Format it however you wish.
And if you want to make this part of a macro, record it and play around with the code you get until you find something that works. IMO, just having this as a part of your chart is easy enough.
Last edit I swear: If your line is too fat, right click on the series/line, go to "Format Series," change the fill to a gradient, set the rotation to 180*, and play around with the stop positions and transparencies to make the line appear thinner. That's all I've got, so if I've helped in any small way, mark this as useful.

How to make a Multi-line (2 lines) label truncate the last line (OS X)

I'm trying to make a multi-line label with 2 lines truncate the last line only. But it seems that, if I choose the Layout of that label as Truncates, my multi-line label becomes one-line.
Here's what I want (I manually typed "..." for demonstration purposes):
Here's what I have when I set my label as Truncates in IB (as you can see it still has 2 lines but acts as if it was only 1):
Is this supposed to happen? If not, how can I achieve the truncate style of the first image?
Thanks!
It looks as though you must have Uses Single Line Mode checked, which should be unchecked. Also, under Layout is the Control section, which can be set to specify which part of the label to truncate and whether to clip, wrap, and which portion to truncate (head, middle, tail).
[ 1 ]

Simultaneous paste and copy of selection text

Background
I want to be able to select some text, hit a keystroke that pastes what is on the clipboard over that selection, but at the same time copying that selection to the clipboard. I often find myself doing this operation when switching variables, etc from place to place.
Example
First sentence here, I need to switch it with the second sentence below. (ctrl-c)
...
Second sentence here, I am going to put this where the first one is.
///////
First sentence here, I need to switch it with the second sentence below.
...
First sentence here, I need to switch it with the second sentence below. (ctrl-"vc" after selecting second sentence, first sentence pasted, second sentence copied now)
///////
Second sentence here, I am going to put this where the first one is. (ctrl-v)
First sentence here, I need to switch it with the second sentence below.
My question
Does anyone know if any IDE/software supports such a paste/copy functionality? Has anyone ever run into this?
More specifically, does any one know how to set up a keyboard shortcut to do this in sublime text 2?
You can do it with a plugin. I threw this together rather quickly. I don't do anything special for multiple cursors (though it should take the content of multiple cursors as well as paste to all the proper locations).
import sublime
import sublime_plugin
class PasteAndCopyCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
current_content = []
cursors = view.sel()
for cursor in cursors:
current_content.append(view.substr(cursor))
for cursor in cursors:
view.replace(edit, cursor, sublime.get_clipboard())
sublime.set_clipboard("\n".join(current_content))
After you save the plugin, use paste_and_copy as the the command for your key binding or command palette entry.

How to paste text to end of every line? Sublime 2

I'm curious if there is a way to paste text to the end of every line in Sublime 2? And conversely, to the beginning of every line.
test line one
test line two
test line three
test line four
...
Say you have 100 lines of text in the editor, and you want to paste quotation marks to the beginning and end of each line.
Is there an easy way to do this or a plugin that anyone would know of? This would often save me a lot of time on various projects.
Thanks.
Yeah Regex is cool, but there are other alternative.
Select all the lines you want to prefix or suffix
Goto menu Selection -> Split into Lines (Cmd/Ctrl + Shift + L)
This allows you to edit multiple lines at once. Now you can add *Quotes (") or anything * at start and end of each lines.
Here's the workflow I use all the time, using the keyboard only
Ctrl/Cmd + A Select All
Ctrl/Cmd + Shift + L Split into Lines
' Surround every line with quotes
Note that this doesn't work if there are blank lines in the selection.
Select all the lines on which you want to add prefix or suffix. (But if you want to add prefix or suffix to only specific lines, you can use ctrl+Left mouse button to create multiple cursors.)
Push Ctrl+Shift+L.
Push Home key and add prefix.
Push End key and add suffix.
Note, disable wordwrap, otherwise it will not work properly if your lines are longer than sublime's width.
Let's say you have these lines of code:
test line one
test line two
test line three
test line four
Using Search and Replace Ctrl+H with Regex let's find this: ^ and replace it with ", we'll have this:
"test line one
"test line two
"test line three
"test line four
Now let's search this: $ and replace it with ", now we'll have this:
"test line one"
"test line two"
"test line three"
"test line four"
You can use the Search & Replace feature with this regex ^([\w\d\_\.\s\-]*)$ to find text and the replaced text is "$1".
Use column selection. Column selection is one of the unique features of Sublime2; it is used to give you multiple matched cursors (tutorial here). To get multiple cursors, do one of the following:
Mouse:
Hold down the shift (Windows/Linux) or option key (Mac) while selecting a region with the mouse.
Clicking middle mouse button (or scroll) will select as a column also.
Keyboard:
Select the desired region.
Type control+shift+L (Windows/Linux) or command+shift+L (Mac)
You now have multiple lines selected, so you could type a quotation mark at the beginning and end of each line. It would be better to take advantage of Sublime's capabilities, and just type ". When you do this, Sublime automatically quotes the selected text.
Type esc to exit multiple cursor mode.
Select all lines you want to add a suffix or prefix.(command+ A to select all the lines)
Press command+shift+L. This will put one cursor at the end of every line and all the selected lines would still be selected.
For adding suffix press command+right and for adding prefix command+left. This will deselect all the earlier selected text and there will only be cursors at the end or start of every line.
Add required text