I have created two cocoa controls on my GUI. NSButton and NSTextField. When user clicks on the button, button handler will be executed. It will make button disable and NSTextField enable. On end editing, the string of text field will be shown as a button title.
button click
{
- Make button visible = false;
- Make text field visible = true;
- Text field allow selection = true;
- text field allow editing = true;
}
control text end editing
{
- text field allow selection = false;
- text field allow editing = false;
- Set button title as text field string;
- Set text field visible = false;
- Set button visible = true;
}
I have written above two functions to achieve the functionality. I am getting required functionality when user presses Tab key, as the view switches to next view. But, I want that, once user enters required text in the text field, he can press Enter or click outside of text field to end editing.
On end editing, text field should be closed and text written should be displayed as a title of button.
Please let know, how this functionality can be achieved. Any help would be appreciated.
Thanks in advance...