nsundomanager

Will NSUndoManager undo changes happening in the background?

纵然是瞬间 提交于 2019-12-06 03:37:53
I've got an edit view controller which I'm using an NSUndoManager for which is the one set for my persistence store (core data project). One of the features of my app is synchronisation with an external server. What I want to know is, if I am editing something in my view, and at the same time the app is syncing itself with the server, if I change my mind and decide to undo any changes in my current edit, would it also undo all of the changes made during the sync if they were made whilst the undo grouping had started, or would it only undo changes I'd made myself? Depends on your implementation

NSUndoManager: redo not working

孤街浪徒 提交于 2019-12-06 01:47:22
问题 I am making a simple application that uses a NSSlider, which can be put to it's max or min value with two buttons.The undo manager shall track all changes and allow to undo/redo all changes made using these two buttons. Here is the interface: #import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate> { @private NSUndoManager* undoManager; } @property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet NSSlider *slider; - (IBAction)putToMax:(id)sender; -

iOS - UITextView + NSUndoManager

北城余情 提交于 2019-12-05 18:35:25
问题 I'm trying to integrate the undo/redo features in a UITextView (I'm building a LateX editor) with no luck and to be honest I'm really confused about this argument. I don't understand the steps involved in those two operations, I mean I need two methods one to remove the last inserted text one to restore the text removed One doubt is where I get the last inserted text? in other words where I have to register for the undo? in textViewDidChange I can get the whole text in

can't get wxHaskell to work from ghci on Mac

人走茶凉 提交于 2019-12-05 08:14:07
I'm trying to run an example using EnableGUI function . % ghci -framework Carbon Main.hs *Main> enableGUI >> main This is what I get instead of a working program: 2013-01-14 00:21:03.021 ghc[13403:1303] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-945.11/Misc.subproj/NSUndoManager.m:328 2013-01-14 00:21:03.022 ghc[13403:1303] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2013-01-14 00:21:03.024 ghc[13403:1303] ( 0 CoreFoundation 0x00007fff8c8ea0a6 __exceptionPreprocess + 198 1 libobjc.A.dylib

Implementing NSUndoManager

旧城冷巷雨未停 提交于 2019-12-04 16:03:26
问题 I'm having a hard time implementing the NSUndoManager, I tried reading the apple documentation on it, but I cant figure it out. This is what I have tried so far. I have created an app that draws lines by connecting two points in an array, I implemented an undo method by removing the last object, but cant figure out how to implement the redo, I stumbled upon NSUndoManager and started reading its documentation, but I dont know how to apply it to my issue. Heres the code that I have at the

NSUndoManager: redo not working

北城余情 提交于 2019-12-04 07:22:00
I am making a simple application that uses a NSSlider, which can be put to it's max or min value with two buttons.The undo manager shall track all changes and allow to undo/redo all changes made using these two buttons. Here is the interface: #import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate> { @private NSUndoManager* undoManager; } @property (assign) IBOutlet NSWindow *window; @property (weak) IBOutlet NSSlider *slider; - (IBAction)putToMax:(id)sender; - (IBAction)putToMin:(id)sender; - (void) setSliderValue: (float) value; @end Implementation: #import

NSUndoManager, Core Data and selective undo/redo

做~自己de王妃 提交于 2019-12-04 05:47:53
I'm working on a core data application that has a rather large hierarchy of managed objects similar to a tree. When a base object is created, it creates a few child objects which in turn create their own child objects and so on. Each of these child objects may gather information using NSURLConnections. Now, I'd like to support undo/redo with the undoManager in the managedObjectContext. The problem is, if a user creates a base object, then tries to undo that action, the base object is not removed. Instead, one or more of the child objects may be removed. Obviously this type of action is

iOS - UITextView + NSUndoManager

好久不见. 提交于 2019-12-04 03:06:39
I'm trying to integrate the undo/redo features in a UITextView (I'm building a LateX editor) with no luck and to be honest I'm really confused about this argument. I don't understand the steps involved in those two operations, I mean I need two methods one to remove the last inserted text one to restore the text removed One doubt is where I get the last inserted text? in other words where I have to register for the undo? in textViewDidChange I can get the whole text in textViewShouldChangeTextInRange I can get the last char inserted I know that what I wrote wasn't the best explanation ever,

NSUndoManager casting NSUndoManagerProxy crash in Swift code

只愿长相守 提交于 2019-12-03 21:19:51
问题 In our application we're using the following code: let lInvocationTarget = lUndoManager.prepare(withInvocationTarget: self) let _ = (lInvocationTarget as! MyObjectType).myMethod(_: self.opacity, undoManager: lUndoManager) This compiles without warnings and runs fine under macOS 10.12 Sierra. However it crashes at runtime on 10.9 - 10.11 (Mavericks till El Capitan). The crash report notices: Could not cast value of type 'NSUndoManagerProxy' (0x7fff76d6d9e8) to 'MyObjectType' (0x108b82218).

How can I replace text in UITextView with NSUndoManager support?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 12:31:44
问题 I want to be able to replace some text in an UITextView programatically, so I wrote this method as an UITextView category: - (void) replaceCharactersInRange:(NSRange)range withString:(NSString *)newText{ self.scrollEnabled = NO; NSMutableString *textStorage = [self.text mutableCopy]; [textStorage replaceCharactersInRange:range withString:newText]; //replace text but undo manager is not working well [[self.undoManager prepareWithInvocationTarget:self] replaceCharactersInRange:NSMakeRange(range