• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
SelectText:self
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SelectText:self


  • Subject: SelectText:self
  • From: Sebastian Probst Eide <email@hidden>
  • Date: Sun, 29 Jan 2006 19:28:54 +0100

Hi
I am new to programming with Objective-C and Cocoa and tried to create a simple test application using what I had learned about strings from a NSString documentation PDF I had read.


The application is a really simple one. The interface consists of two NSTextFields and a NSTextView (txtInput, txtFinne and txtOutput) and a button (btnKlikk). When the user clicks the button the application uses an NSScanner to get the part of txtInput up to where it finds txtFinne. The output is then sent to txtOutput.

When the button is hit repeatedly the new information is added at the bottom of the txtOutput textfield so I tried to do a selectText before inserting the new text to get rid of the old contents before adding the new, but I just get the following error and can't think of a solution:

[Session started at 2006-01-29 19:24:01 +0100.]
2006-01-29 19:24:10.005 NSString test[11565] Knappen ble klikket...
2006-01-29 19:24:10.007 NSString test[11565] *** -[NSTextView selectText:]: selector not recognized [self = 0x358460]
2006-01-29 19:24:10.100 NSString test[11565] Exception raised during posting of notification. Ignored. exception: *** -[NSTextView selectText:]: selector not recognized [self = 0x358460]




#import "SPECommunicator.h"

@implementation SPECommunicator

- (IBAction)btnKlikk:(id)sender
{
NSLog(@"%@", @"Knappen ble klikket...");

//Henter det som skal søkes gjennom
test = [txtInput stringValue];

//henter det som skal søkes etter
hva = [txtFinne stringValue];

//setter scanneren til å skanne gjennom teksten som har kommet inn
theScanner = [NSScanner scannerWithString:test];

[txtOutput selectText:self];

//scanner teksten inn i variabelen resultat
[theScanner scanUpToString:hva intoString: &resultat];

//kjører ut resultatet
[txtOutput insertText:[@"Her er originalteksten:\n" stringByAppendingFormat:@"'%@'\n\nScannet frem til '%@:'\n'%@'\n\n", test, hva, resultat]];
}


@end



What might be wrong?

Best regards
Sebastian Probst Eide


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Running COCOA application during startup
  • Next by Date: Re: -[NSAttributedString initWithPasteboard:...] vs. Dictionary
  • Previous by thread: Re: Trouble refreshing iCal
  • Next by thread: Core Data: updating a key dependent on a to-many relationship?
  • Index(es):
    • Date
    • Thread