code for drawing an NSTextField to a panel window ...
code for drawing an NSTextField to a panel window ...
- Subject: code for drawing an NSTextField to a panel window ...
- From: vinai <email@hidden>
- Date: Wed, 11 Mar 2009 09:11:36 -0700 (PDT)
Hi All,
I am relatively new to Cocoa, though I've done a bit of programming in generic C on Linux and UNIX systems.
I have been trying to create a panel with pop-up buttons and text fields. I know IB will do this for you, but I'd really like to get a handle on what goes on behind the scenes, so I've been attempting to create some of these elements by hand, with little success...
I've created the main panel window and set its title. However, I can't seem to draw anything to the View in that panel's window. I have:
rawButtonRect.origin.x = contentRect.origin.x + 45.0;
rawButtonRect.origin.y = contentRect.origin.y + 135.0;
rawButtonRect.size.width = 180.0;
rawButtonRect.size.height = 45.0;
[rawTextField initWithFrame: rawButtonRect];
[rawTextField setEditable: YES];
[rawTextField setBezeled: YES];
[rawTextField setBezelStyle: NSTextFieldSquareBezel];
[rawTextField setBackgroundColor: [NSColor blackColor]];
[rawTextField setTextColor: [NSColor whiteColor]];
[mainPanelView setSubviews: [NSArray arrayWithObjects: rawTextField, nil]];
[self setContentView: mainPanelView];
where rawButtonRect is an NSRect, contectRect defines the panel window I am trying to draw to, and rawTextField is of * NSTextField type. mainPanelView is the view for the mainPanel window, and rawTextField is just one of the subviews I am trying to add to the that view. However, the window remains plain, and I am at a loss as to what I missed ...
Would appreciate any pointers ...
thanks much
vinai
_______________________________________________
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