programmitically creating nstextfield
programmitically creating nstextfield
- Subject: programmitically creating nstextfield
- From: mark <email@hidden>
- Date: Thu, 15 Apr 2010 16:24:48 +1200
Would someone please tell me why this text field will not show. It is
driving me spastic.
The window and text field are valid. And there are no errors.
The window shows but the text field does not.
relativeToWindow is valid.
NSRect w=[relativeToWindow frame];
NSRect r={{NSMaxX(w)-96,
NSMaxY(w)-ToolbarHeightForWindow(relativeToWindow) -
titleBarHeight(relativeToWindow)-24},
{256, 64}};
window=[[NSWindow alloc] initWithContentRect:r styleMask:0
backing:NSBackingStoreRetained defer:NO];
//[window setBackgroundColor:[NSColor redColor]];
[window makeKeyAndOrderFront:self];
//[window setAlphaValue:0.3];
[relativeToWindow addChildWindow:window ordered:NSWindowAbove];
[window setLevel:NSFloatingWindowLevel];
f.origin.x=4;
f.origin.y=4;
f.size.width=128;
f.size.height=32;
textInfo=[[NSTextField alloc] initWithFrame:f];
[textInfo setSelectable:NO];
NSFont* font=[NSFont fontWithName:@"Times-Roman" size:12];
[textInfo setFont:font];
[textInfo setStringValue:@"hello world"];
[textInfo setBackgroundColor:[NSColor blueColor]];
[[window contentView] addSubview:textInfo];
_______________________________________________
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