Re: programmitically creating nstextfield
Re: programmitically creating nstextfield
- Subject: Re: programmitically creating nstextfield
- From: Ron Fleckner <email@hidden>
- Date: Thu, 15 Apr 2010 14:48:52 +1000
On 15/04/2010, at 2:24 PM, mark wrote:
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}};
NSRect r = NSMakeRect(... );
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;
How is 'f' created? Is 'f' valid?
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];
_______________________________________________
Are the values of relativeToWindow sane?
Ron
_______________________________________________
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