Re: Apps whitout nib
Re: Apps whitout nib
- Subject: Re: Apps whitout nib
- From: j o a r <email@hidden>
- Date: Tue, 17 Feb 2004 12:05:08 +0100
A couple of things to try out:
* Why do you set the "defer" parameter to "1" when it's really a BOOL?
* Try to set "defer" to NO
* Why do you set the button to be the content view of the window? Try
not to do that (you can still set it to completely fill the content
view of the window).
* Try to use regular "makeKeyAndOrderFront:" instead of immediately use
"runModal...", at least while troubleshooting.
* You need to run the run loop at some point, else things will not work
as they should. Read the documentation and the list archives!
j o a r
On 2004-02-17, at 01.08, Wezzy wrote:
>
HI, i'm playing with building apps without usign IB. This small code
>
seems to work but it shows a very strange windows, it is perfectly
>
rectangular (no rounded corners) and the NSButton instance inside
>
appears trasparent. Well i can read the string "Button" but this is
>
the only thing that i see. All around i see the metal background :-(
>
Where is(are) my error(s) ?
>
>
Thanks for your time.
>
Wezzy
>
>
>
import <Cocoa/Cocoa.h>
>
>
int main()
>
{
>
NSWindow * win;
>
NSApplication * app;
>
NSRect contentRect;
>
NSButton * bt;
>
NSAutoreleasePool * pool;
>
>
pool = [[NSAutoreleasePool alloc] init];
>
contentRect = NSMakeRect(0,0,330,330);
>
>
win = [[NSWindow alloc] initWithContentRect:contentRect
>
styleMask:(NSTexturedBackgroundWindowMask | NSTitledWindowMask |
>
NSClosableWindowMask | NSMiniaturizableWindowMask)
>
backing:NSBackingStoreNonretained defer:1];
>
>
bt = [[NSButton alloc] initWithFrame:contentRect];
>
[win setTitle:@"Test Window"];
>
[win setContentView:bt];
>
[win setDelegate:bt];
>
//[win makeKeyAndOrderFront:nil];
>
>
app = [NSApplication sharedApplication];
>
[app runModalForWindow:win];
>
>
[app release];
>
[pool release];
>
}
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.