Working with series of NSTextView, connected with a single NSLayoutManager. Very common configuration. Every time user hits Enter, new NSTextView created. In other words, every paragraph is in its own NSTextView instance.
But it's been days I'm struggling with this issue: if last NSTextView in chain is empty (say, user just hit Enter and moved cursor back somewhere in previous text view), then the cursor disappears when come back in this empty NSTextView. If I click by mouse, I have to click twice in the empty text view, so the cursor appears. If I move the cursor with arrow keys, then, again, I have to press an arrow key twice.
I've tried update cursor, but nothing happens. This issue is happens if text view is empty and the last one in series. Where should I find the answer? Searched this forum, Apple docs, googled it — nothing.
create first text view
let textContainer = NSTextContainer(containerSize: containerSize)
layoutManager.addTextContainer(textContainer)
let textView = NSTextView(frame: frame, textContainer: textContainer)
someView.addSubview(textView)
create second text view
let anotherTextContainer = NSTextContainer(containerSize: containerSize)
layoutManager.addTextContainer(anotherTextContainer)
let anotherTextView = NSTextView(frame: anotherFrame, textContainer: anotherTextContainer)
someView.addSubview(anotherTextView)
Now run, type something and hit Enter. Now, if you move the cursor up and then back down, it won't show up. You have to press down key again, then the cursor will show up. Same with mouse: you'll have to do left click for two times and only after that the cursor will show up in the second text view.
Here's the example: https://www.dropbox.com/s/47domcy0nuisncc/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202014-06-28%2013.37.58.png
Here's a sample project: https://www.dropbox.com/s/aw01oo0faajr4rn/Test.zip. I made it from scratch, when you hit Enter key, it places a second text view and you can see, that issue occurs even in a new clean projects.
It looks like a bug of Apple engineers. Found the same behavior in other apps.
Related
I've searched all the settings and Google but can find nothing. It seems such an obvious feature. If I use the arrow keys to scroll vertically through the code, I quickly end up with the cursor at the top or bottom of the screen whereas I really want to be doing my editing near the centre of the screen, which means I have to do two operations: scroll the code to where I want it and then move the cursor.
What I want is to hit a shortcut (e.g. the Scroll Lock key) and then when I press up- or down-arrow the cursor stays where it is (relative to the screen) and the code scrolls past it.
I've read that some tools allow you to set the number of "always visible" lines above and below the cursor which would do the job, but I can't find that in Rider either.
Am I missing something obvious, or is there an add-in or something I can customize to get what I want?
Found it! There are Move Up and Scroll and Move Down and Scroll actions in the keymap settings. Assign hotkeys to them (weren't assigned in my config) and it will work like you described it.
I have been playing with animations in PowerPoint, but this relatively simple thing seems to be beyond my range. I want on the first (title) slide, one name with his details to appear below, then disappear on clicking (or pressing "n") and then another name should appear in the same place (where the first name was) with his details. If this can be managed with animations, fine, otherwise I am open to use VBA macros also.
If this is too easy, I would like to add a symbol/picture (.bmp) for the first person to appear in the middle of the slide, which would disappear with that name, and then with the second name appearing, the second picture/symbol (.jpg) should appear in the middle of the slide. I will be glad if someone can show me how to do this. Thank you very much.
I don't think you'll need to use macros. I can't picture exactly what you want the presentation to look like, but this sounds quite easy. I'll give you an instruction list, as clear as I can make it.
Place the item(s) (the placeholders containing the name and details, as well as the pictures) you want to animate into your presentation, in the positions you want.
Select the item(s) you want to appear first, and choose a suitable entrance effect from the Add animation menu.
Bring up the animations pane from the animations ribbon, if you haven't already done so. If you wanted multiple items to appear at once, then set any extra items to with previous.
Do the same with an exit effect (on the same item(s)). They should be after the entrance animations on the animation pane. The first (from the exit animations) should be on click; the rest should be with previous.
Select the next item(s) you want to appear, and choose an entrance effect. Instead of on click, choose after previous.
Test to see if everything works the way you want it to.
I've done my best to make this as clear as possible, but if there was an inaccuracy, or something unclear anywhere, then please let me know.
I am able to set clickable links on NSTextField elements, using NSAttributedString. The text shows correctly (blue coloured, underlined) as soon as the view appears.
However, the cursor shows on hover is the editing (I-Beam) cursor, until first click (anywhere) on the NSTextField. Once it is clicked, when hovering over the "hyperlinked" part of the text, the hand point cursor is shown as expected.
I was able to subclass NSTextField and override resetCursorRects, however, this allows me changing the cursor for the entire NSTextField bound, where I want it to show only when hovering over the hyperlinked parts of the text (Or to use cursorRects, but that seems as an overkill, to iterate on the (already iterated on creation) entire text).
I also tried setting the NSCursor attribute of the attributed string, but that did not solve the issue.
This is not directly supported by NSTextField, I believe. It starts working when you click in the textfield because at that point the field editor for the textfield is created; the field editor is an NSTextView, and that does what you want it to do. So you basically have two choices. You can (1) do the easy thing and use NSTextView instead of NSTextField (is there any particular reason why you can't?), or (2) you can set up the right cursor rects yourself in resetCursorRects by looping through the rects for the character ranges that have the link attribute set, but this means setting up a layout manager and so forth – work that is all done for you if you use NSTextView. A third possibility is to make the textfield's field editor come up right away, before the user clicks – in other words, make the textfield be the first responder. But that only works if you have only one such textfield in your window, and if nothing else in the window ever wants to be the first responder, so it is not a very satisfactory fix, probably.
I am reworded the above question.
Let's say I am using 20 toolbox buttons and or labels or whatever on a VB window app form, and I have changed the default colors, size, and so on. Is there a way to view in code or design view all the properties and values that have been changed for any one tool (object) in a pop-up window.
In other words instead of having to go to properties and scroll, I push a hot key and magic! In one small pop-up window, I can see the changes for btnone, or lblTwo and or even better, make changes on the fly or go back to default values, or change to new values. Like an Xray format tool in brackets, or google.
I'm creating a view which provides some fields for the user to fill in - address, phone number etc.
I've seen apps that have populated fields with grey text like 'Fill in your name here' on the Name field, and when the user taps on it the text is gone, a keyboard appears and the view is zoomed in to the textfield(or whatever it is). Also, after filling up that field tapping the 'Next' button on the keyboard brings the user to the next field. I'm trying to do the same but I have no idea where to get sources on this. Pardon my poor googling skills ;p
Tried UITextView and UITextField but there isn't anything related to this on the Interface Builder. Figured it lies with the codes?
It'd be great if I can get some explanation or some links on how this works (: Thanks!
EDIT: okay I played around with the Interface Builder a lil more and realized I could set placeholder as the grey text.
It is in fact a UITextField.
You can get the greyed out text by setting its placeholder property.
I am not sure what you mean by zooming but usually they do use a scroll view or adjust the frame so that it isn't blocked by the keyboard.
The Next button is made available using a UIToolbar instance as the text field's inputAccessoryView. However the implementation is one's own and is not framework provided. You can look at this example to get started.