• 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
Re: How make a cocoa lib wich create a window ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How make a cocoa lib wich create a window ?


  • Subject: Re: How make a cocoa lib wich create a window ?
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 23 Sep 2008 23:46:34 -0500

On Sep 23, 2008, at 11:41 PM, rouanet brice wrote:

thanks, when I launch a simple app with this code it works :

#import <Cocoa/Cocoa.h>
#import "MyOgView.h"

int main(int argc, char *argv[])
{


//use TransformProcessType to transform non gui processs in gui process


//voir -[NSApplication runModalForWindow:].
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *window;
MyOgView *ogView;
ogView = [[MyOgView alloc] initWithFrame:NSMakeRect(0,100,500,375) ];
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,100,640,480)
styleMask:NSTitledWindowMask | NSResizableWindowMask
backing:NSBackingStoreBuffered
defer:TRUE];

Try allocating the windows and views after the application object exists. Windows register themselves in the application's window list.




const ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication);



SetFrontProcess(&psn);

    //add title to the window
    [window setTitle:@"toto gl"];


//attach glview on the window [[window contentView] addSubview:ogView]; //[[window contentView] addSubview:button];


[NSApplication sharedApplication]; [window makeKeyAndOrderFront: nil]; [pool release];

    [NSApp run];
    return 0;
}

But when I use this code in a dynamic library it not work, I can't see the window, have you got an idea ?

I'm not sure. What kind of program is loading the library? Also, is it being run from a GUI login session (as opposed to, for example, an ssh session or cron job)?


What else can you tell us about the situation?

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How make a cocoa lib wich create a window ? (From: "rouanet brice" <email@hidden>)
 >Re: How make a cocoa lib wich create a window ? (From: Ken Thomases <email@hidden>)
 >Re: How make a cocoa lib wich create a window ? (From: "rouanet brice" <email@hidden>)

  • Prev by Date: Re: Converting from Carbon Event Manager to NSTimer
  • Next by Date: Rendering big PDF into thumbnail bitmap - too blurry
  • Previous by thread: Re: How make a cocoa lib wich create a window ?
  • Next by thread: NsPredicateEditor
  • Index(es):
    • Date
    • Thread