I have a NSTextField and I want to set its content if I klick on a button and than set the cursor on this textfield at the end of the text so if someone klicks the button he
Ok I found it out now :)
- (IBAction)focusInputField:(id)sender {
[textField selectText:self];
[[textField currentEditor] setSelectedRange:NSMakeRange([[textField stringValue] length], 0)];
}
and in RubyCocoa it is:
def select_input_field
@input.selectText self
range = OSX::NSRange.new(@input.stringValue.length, 0)
@input.currentEditor.setSelectedRange range
end