• 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: Add nscontrol to the Main Window using code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add nscontrol to the Main Window using code?


  • Subject: Re: Add nscontrol to the Main Window using code?
  • From: Georg Tuparev <email@hidden>
  • Date: Tue, 13 Feb 2007 12:52:58 +0100

You will save you a lot of headache if you create an offscreen window, and set there all kinds of controls you wold like to show dynamically. During the app execution you could copy whatever control you want and just size it appropriately!

Once I managed to do what you are trying, but it took me a day and many gray hairs!

enjoy

gt


On Feb 13, 2007, at 5:45 PM, Silicon wrote:

Hi all
I want to implement a function which can add nscontrol to main window using code, for example, I can customize the GUI by adding anything as I want, like NSSlider, NSTextField, NSImage.
But I come across a problem , when I add a nsslider to the main window using the following code:
NSView * contentView = [myWindow contentView];
NSControl * userControl;

userControl = [[NSSlider alloc] initWithFrame:NSMakeRect (20,20,18,20)];
[[userControl cell] setSliderType:NSCircularSlider];
[(NSSlider *) userControl setMaxValue: 10.0];
[(NSSlider *) userControl setMinValue: 0.0];
[contentView addSubview:userControl];


And then add a NSSlider to the main window using the interface builder, You can run the code and find that the appearance of the sliders are very different between the two methods.

Can someone tell me how should I do to implement the IB-style appearance? You should find my code-generated slider is very ugly.

Thanks for any help!
_______________________________________________

Georg Tuparev Tuparev Technologies Klipper 13 1186 VR Amstelveen The Netherlands www.tuparev.com _______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: Add nscontrol to the Main Window using code?
      • From: Uli Kusterer <email@hidden>
References: 
 >Add nscontrol to the Main Window using code? (From: Silicon <email@hidden>)

  • Prev by Date: Add nscontrol to the Main Window using code?
  • Next by Date: Re: NSTableView and Releasing window controllers
  • Previous by thread: Add nscontrol to the Main Window using code?
  • Next by thread: Re: Add nscontrol to the Main Window using code?
  • Index(es):
    • Date
    • Thread