Autosizing NSToolbarItems...

Discussion in 'Mac Programming' started by guitarmaster18, Feb 6, 2008.

  1. macrumors regular

    guitarmaster18

    Joined:
    Mar 27, 2007
    #1
    So, here's the situation. I have a NSToolbar, set up through the normal programmatic method. One item I have is set up through an NSView. The NSView contains a text field. How would I set autosizing rules for the text field?


    Thank You!
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    I guess it depends on how you want it to behave when resized, but I'd say to have its width adjust so that when the NSView expands the textfield expands along with it.
     
  3. thread starter macrumors regular

    guitarmaster18

    Joined:
    Mar 27, 2007
    #3
    Well, when resized, I want the text field to contract and expand in the toolbar based on the size of the window. Do you know if that is possible?

    Thanks!
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Have you tried playing with the view's autoresizing mask (in IB) and seeing if it works already? Safari does this with the "address and search" item, so it's possible.
     
  5. thread starter macrumors regular

    guitarmaster18

    Joined:
    Mar 27, 2007
    #5
    Yeah, I've tried the traditional method (IB) many times. It doesn't seem to make any difference in the way the Text Field is resized in the toolbar.

    Thank you,
    guitarmaster18
     
  6. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #6
    Well you'll probably have to set the view's frame manually when the window resizes. Even then it might not work.
     

Share This Page