How to implement good and efficient undo/redo functionality for a TextBox

The .NET System.ComponentModel namespace comes with an IEditableObject interface, you could also use INotifyPropertyChanging and INotifyPropertyChanged. MVC Pattern would also make it that your interface responds to changes in the model through events thus updating or restoring the value of your textbox. Effectively the Memento Pattern. Have you had a look into these? Here is … Read more

How can you add a UIGestureRecognizer to a UIBarButtonItem as in the common undo/redo UIPopoverController scheme on iPad apps?

Note: this no longer works as of iOS 11 In lieu of that mess with trying to find the UIBarButtonItem’s view in the toolbar’s subview list, you can also try this, once the item is added to the toolbar: [barButtonItem valueForKey:@”view”]; This uses the Key-Value Coding framework to access the UIBarButtonItem’s private _view variable, where … Read more

Using Vim’s persistent undo?

Put this in your .vimrc to create an undodir if it doesn’t exist and enable persistent undo. Tested on both Windows and Linux. ” Put plugins and dictionaries in this dir (also on Windows) let vimDir=”$HOME/.vim” if stridx(&runtimepath, expand(vimDir)) == -1 ” vimDir is not on runtimepath, add it let &runtimepath.=’,’.vimDir endif ” Keep undo … Read more

NSInvocation for Dummies?

According to Apple’s NSInvocation class reference: An NSInvocation is an Objective-C message rendered static, that is, it is an action turned into an object. And, in a little more detail: The concept of messages is central to the objective-c philosophy. Any time you call a method, or access a variable of some object, you are … Read more

How to configure IntelliJ (also Android Studio) redo shortcut to CTRL+Y instead of CTRL+SHIFT+Z?

Open Settings (press CTRL+ALT+S) Click Keymap on the left list. There is a combobox that contains keymaps. Select one of them (default means IntelliJ of course. We can’t change any of pre-defined keymap however we can copy, edit and then use the edited one. So) we should copy “default” to change only redo mapping. Give … Read more

tech