Hello,
I am totally new in Objective-C and trying to learn this language:
I would like to split the following code into 2 parts:
MySaveMenuController.h > contains code to open OpenPanel
MySaveMenuController.m > contains code to open OpenPanel
and
DisplayTextField.h > contains code to open textField with tvarFilename after opening OpenPanel
DisplayTextField.m > contains code to open textField with tvarFilename after opening OpenPanel
How i can do this?
Thank you
MySaveMenuController.h
MySaveMenuController.m
I am totally new in Objective-C and trying to learn this language:
I would like to split the following code into 2 parts:
MySaveMenuController.h > contains code to open OpenPanel
MySaveMenuController.m > contains code to open OpenPanel
and
DisplayTextField.h > contains code to open textField with tvarFilename after opening OpenPanel
DisplayTextField.m > contains code to open textField with tvarFilename after opening OpenPanel
How i can do this?
Thank you
MySaveMenuController.h
PHP:
// MySaveMenuController.h
// Example
#import <Cocoa/Cocoa.h>
@interface MySaveMenuController : NSObject {
IBOutlet NSTextField *textField;
}
- (IBAction)doOpen:(id)pId;
@end
MySaveMenuController.m
PHP:
// MySaveMenuController.m
// Example
#import "MySaveMenuController.h"
@implementation MySaveMenuController
- (IBAction)doOpen:(id)pId; {
NSLog(@"doOpen");
NSOpenPanel *tvarNSOpenPanelObj = [NSOpenPanel openPanel];
NSInteger tvarNSInteger = [tvarNSOpenPanelObj runModalForTypes:nil];
if(tvarNSInteger == NSOKButton){
NSLog(@"doOpen we have an OK button");
} else if(tvarNSInteger == NSCancelButton) {
NSLog(@"doOpen we have a Cancel button");
} else {
NSLog(@"doOpen tvarInt not equal 1 or zero = %3d",tvarNSInteger);
} // end if
NSString * tvarDirectory = [tvarNSOpenPanelObj directory];
NSLog(@"doOpen directory = %@",tvarDirectory);
NSString * tvarFilename = [tvarNSOpenPanelObj filename];
NSLog(@"doOpen filename = %@",tvarFilename);
[textField setStringValue:tvarFilename]; // this should be splitted in to the new file:
} // end doOpen
@end