discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView-RightClick


From: Steve Van Voorst
Subject: NSTextView-RightClick
Date: Wed, 5 Sep 2012 16:29:37 +0000 (GMT)

I'm seeing this console output when I do a right click on an NSTextView:

2012-09-05 11:19:05.459 txtView[4085] Language: AmericanEnglish
2012-09-05 11:19:05.460 txtView[4085] Service to start: /usr/lib/GNUstep/Services/GSspell.service
2012-09-05 11:19:05.460 txtView[4085] Port: GNUAmericanEnglishSpellChecker
2012-09-05 11:19:05.461 txtView[4085] Set proxy

 I also have an editor with its own log window being ported from Mac and this output keeps showing up in the log every time I right click in the editor, which is an NSTextView.  To demonstrate, you may run this code.  It only happens when using openapp ./xxxx.app.  If I double click on the executable in the xxxx.app folder to launch the app, I don't see the output.  Is this a feature?  It is harmless, but annoying to see in my private log window.

// ----- NSTextView demo ----- //

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

@interface MyDelegate : NSObject
 {
  NSWindow *window;
 }
 -(void) createMenu;
 -(void) createWindow;
@end

@implementation MyDelegate : NSObject
 -(void) dealloc
 {
  [window release];
  [super dealloc];
 }

 -(void) createMenu
 {
  NSMenu *menu = [[NSMenu new]autorelease];
  [menu addItemWithTitle: @"Quit"  
        action: @selector (terminate:)  
        keyEquivalent: @"q"];
  [NSApp setMainMenu: menu];
 }

 -(void) createWindow
 {
  // ***** window ***** //
  #define _wndW  300
  #define _wndH  250

  window = [[NSWindow alloc] initWithContentRect: NSMakeRect( 0, 0, _wndW, _wndH )
       styleMask: NSTitledWindowMask | NSMiniaturizableWindowMask | NSClosableWindowMask
       backing: NSBackingStoreBuffered
       defer: NO];
  [window center];
  [window setTitle: @"NSTextView_demo"];

 // ****** NSTextView with Scroll ****** //
  NSScrollView *scrlView = [[NSScrollView alloc] initWithFrame:NSMakeRect( 50, 80, 180, 120 )];
  [[window contentView] addSubview:scrlView];
  [scrlView setHasVerticalScroller: YES];
  NSTextView *txtView = [[NSTextView alloc] initWithFrame:NSMakeRect( 0, 0, 164, 118 )];
  [scrlView setDocumentView: txtView];
  [txtView setFont:[NSFont fontWithName:@"FreeSans" size:18]];
  [txtView insertText:@"Right click here."];
  [scrlView release];
  [txtView release];

  // ***** Quit btn ***** //
  NSButton *quitBtn = [[NSButton alloc]initWithFrame:NSMakeRect( _wndW - 130, 30, 95, 30 )];
  [quitBtn setBezelStyle:NSRoundedBezelStyle ];
  [quitBtn setTitle: @"Quit" ];
  [quitBtn setAction:@selector(terminate:)];
  [[window contentView] addSubview: quitBtn];
  [quitBtn release];
 }

 -(void) applicationWillFinishLaunching: (NSNotification *)not
 {
  [self createMenu];
  [self createWindow];
 }

 -(void) applicationDidFinishLaunching: (NSNotification *)not;
 {
  [window makeKeyAndOrderFront: nil];
 }
@end

 int main ()
 {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
  [NSApplication sharedApplication];
  [NSApp setDelegate: [MyDelegate new]];
  [NSApp run];
  [pool drain];
  return 0;
 }  

// ----- End ------------ //

Steve Van Voorst
reply via email to

[Prev in Thread] Current Thread [Next in Thread]