discuss-gnustep
[Top][All Lists]
Advanced

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

Application Gui doesn't become visible


From: Clint Anderson
Subject: Application Gui doesn't become visible
Date: Thu, 1 Dec 2011 14:40:29 -0600

Hey guys, another noob question/problem here.

I'm working through the tutorial at
http://www.gnustep.it/nicola/Tutorials/FirstGUIApplication/index.html
trying to get a simple GUI application example working.  When I get
ready to test it, everything seems to compile correctly, with no
errors.  But when I run the app, the window never appears.  If I check
my task manager I can see it running in the background.  I have tried
using both the openapp command as well as just double clicking the
.exe file from Windows Explorer with the same results.  Here is the
code that I am using (from the linked example).  What am I doing
wrong?


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

@interface MyDelegate : NSObject
- (void) printHello: (id)sender;
- (void) applicationWillFinishLaunching: (NSNotification *)not;
@end

@implementation MyDelegate : NSObject
- (void) printHello: (id)sender
{
  printf ("Hello!\n");
}

- (void) applicationWillFinishLaunching: (NSNotification *)not
{
  NSMenu *menu;

  menu = AUTORELEASE ([NSMenu new]);

  [menu addItemWithTitle: @"Print Hello"
        action: @selector (printHello:)
        keyEquivalent: @""];

  [menu addItemWithTitle: @"Quit"
        action: @selector (terminate:)
        keyEquivalent: @"q"];

  [NSApp setMainMenu: menu];
}
@end

int main (int argc, const char **argv)
{
  [NSApplication sharedApplication];
  [NSApp setDelegate: [MyDelegate new]];

  return NSApplicationMain (argc, argv);
}



And the makefile

include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = MyFirstApp
MyFirstApp_OBJC_FILES = MyApp.m

# Uncomment the following if you have an icon
#MyFirstApp_APPLICATION_ICON = MyApp.png
#MyFirstApp_RESOURCE_FILES = MyApp.png

include $(GNUSTEP_MAKEFILES)/application.make



reply via email to

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