Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 31, 2009, 04:37 PM   #1
dova
macrumors newbie
 
Join Date: Oct 2009
Splitting code into 2 parts in obj-C (newbee)

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
PHP Code:
//  MySaveMenuController.h
//  Example

#import <Cocoa/Cocoa.h>


@interface  MySaveMenuController NSObject {
    
IBOutlet NSTextField *textField;

- (
IBAction)doOpen:(id)pId;

@
end 
MySaveMenuController.m
PHP Code:
//  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 

Last edited by dova; Oct 31, 2009 at 04:46 PM.
dova is offline   0 Reply With Quote
Old Nov 1, 2009, 02:34 PM   #2
xStep
macrumors 68000
 
Join Date: Jan 2003
Location: Lost in Minneapolis
You may want to clarify what you are trying to do. I've read your post twice over two days and still don't understand your goal.
xStep is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Newbee Airport Express Setup : ( MetalGeek Mac mini 4 Dec 4, 2013 11:40 PM
Newbee; How to show lyrics on IPAD?? Yeswecanagain74 Mac Applications and Mac App Store 2 Aug 28, 2013 04:48 PM
C, Obj-C, C++, some questions argh silentownage001 Mac Programming 24 Feb 12, 2013 01:20 AM
What to learn aside Obj C Will0827 iPhone/iPad Programming 8 Sep 27, 2012 03:07 PM
Need help with indexing (Java or Obj-C) iVikD Mac Programming 5 Jul 5, 2012 05:43 PM

Forum Jump

All times are GMT -5. The time now is 01:57 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC