Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

abcdefg12345

macrumors 6502
Original poster
Jul 10, 2013
281
86
I'm working on an app with multiple textfields and some of them have to be editable but i also need a way to deselect textfields so i can type some numbers using key equivalent functions

is there a way i can have a button that when i click deselects the textfields so that key equivalent functions work

thats what i did but still can't type with key equivalent

Code:
- (IBAction)editoff:(id)sender
{
    [_Field1 setEditable: NO];
    [_Field1 setSelectable: NO];
    [_Field2 setEditable: NO];
    [_Field2 setSelectable: NO];
    [_Field3 setEditable: NO];
    [_Field3 setSelectable: NO];

}

- (IBAction)editon:(id)sender
{
    [_Field1 setEditable: YES];
    [_Field1 setSelectable: YES];
    [_Field2 setEditable: YES];
    [_Field2 setSelectable: YES];
    [_Field3 setEditable: YES];
    [_Field3 setSelectable: YES];
}

the textfields are becoming non editable but is still can't use buttons
 
Last edited:
Don't worry about it i found what i was looking for

.h
Code:
@property (assign) IBOutlet NSWindow *MainWindow;
- (IBAction)Deselectfields:(id)sender;

.m
Code:
- (IBAction)Deselectfields:(id)sender
{
    [_MainWindow endEditingFor: nil];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.