cocoa - NSTextField keep caret position on up_key_pressed -


in nstextfield: when up_key pressed cursor position goes begin of text in nstextfield. need keep cursor position. doesn't go begin.

i try use code:

-(void)keyup:(nsevent *)theevent {     [[mytextfield currenteditor] movetoendofline:nil]; }     

but via code can see cursor position goes begin end goes end.

is idea?

i found solution:

- (bool)control:(nscontrol *)control textview:(nstextview *)textview docommandbyselector:(sel)command {     if( [nsstringfromselector(command) isequaltostring:@"moveup:"] )     {         return yes;     }      return no; } 

Comments