Are there 'sizers' in Cocoa?

  • Hi everyone,

    By sizers I am referring to the sizers that wx widgets use. You create
    a sizer, put UI widgets in it and it will lay them out for you.
    Rather, space them out for you. I don't know of anything like that in
    the Cocoa frameworks but I'm hoping that my knowledge is limited in
    this case. It doesn't have to come from Apple, I don't care.

    I am wondering because the code I'm porting uses wxWidgets and it
    would help *a lot* to be able to use sizers. Once the code is ported
    I'll probably put it into nib files. I don't want to do that now
    because I don't know how the code works well enough to just throw some
    nibs together. Also, I don't know what windows exist, another
    complication.

    Many thanks, Alan

    --
    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
  • You can almost certainly get the same effect by using springs and
    embedding widgets into invisible boxes where necessary.

    On Oct 13, 2006, at 3:18 PM, Alan Smith wrote:

    > Hi everyone,
    >
    > By sizers I am referring to the sizers that wx widgets use. You create
    > a sizer, put UI widgets in it and it will lay them out for you.
    > Rather, space them out for you. I don't know of anything like that in
    > the Cocoa frameworks but I'm hoping that my knowledge is limited in
    > this case. It doesn't have to come from Apple, I don't care.
    >
    > I am wondering because the code I'm porting uses wxWidgets and it
    > would help *a lot* to be able to use sizers. Once the code is ported
    > I'll probably put it into nib files. I don't want to do that now
    > because I don't know how the code works well enough to just throw some
    > nibs together. Also, I don't know what windows exist, another
    > complication.
    >
    > Many thanks, Alan
    >
    > --
    > // Quotes from yours truly -------------------------
    > "You don't forget, you just don't remember."
    > "Maturity resides in the mind."
    > "Silence is the Universe's greatest gift."
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    > 40blizzard.com
    >
    > This email sent to <jstiles...>
  • Alright, awesome! I knew Apple wasn't that dim witted. ;)

    Just one problem. How do I use springs? Heh, heh.

    Thanks, Alan

    --
    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
  • First hit when searching for "springs" on ADC:
    http://developer.apple.com/samplecode/Sproing/

    Next time please do your own research before posting.

    On Oct 13, 2006, at 3:30 PM, Alan Smith wrote:

    > Alright, awesome! I knew Apple wasn't that dim witted. ;)
    >
    > Just one problem. How do I use springs? Heh, heh.
    >
    > Thanks, Alan
    >
    > --
    > // Quotes from yours truly -------------------------
    > "You don't forget, you just don't remember."
    > "Maturity resides in the mind."
    > "Silence is the Universe's greatest gift."
  • As it turns out, those are not quite what I want.

    The springs resize the NSView subclass to shrink/expand with its superview.

    I want some sort of object that will distribute the UI widgets that I
    put into it so that they are not lying on top of each other. That way
    I don't have to manually find space for them. It would be automatic.

    Thanks for the reply though, Alan

    --
    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
  • Would this work?

    http://www.cocoadev.com/index.pl?FlowLayoutView

    --
    I.S.

    On Oct 13, 2006, at 10:44 PM, Alan Smith wrote:

    > As it turns out, those are not quite what I want.
    >
    > The springs resize the NSView subclass to shrink/expand with its
    > superview.
    >
    > I want some sort of object that will distribute the UI widgets that I
    > put into it so that they are not lying on top of each other. That way
    > I don't have to manually find space for them. It would be automatic.
    >
    > Thanks for the reply though, Alan
    >
    > --
    > // Quotes from yours truly -------------------------
    > "You don't forget, you just don't remember."
    > "Maturity resides in the mind."
    > "Silence is the Universe's greatest gift."
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
    > 40gmail.com
    >
    > This email sent to <idiotsavant2005...>
  • On Oct 13, 2006, at 7:44 PM, Alan Smith wrote:

    > The springs resize the NSView subclass to shrink/expand with its
    > superview.
    >
    > I want some sort of object that will distribute the UI widgets that I
    > put into it so that they are not lying on top of each other.

    The springs and struts system does both. One for resizing internal
    space, another for resizing external negative space relative to other
    elements.

    > That way I don't have to manually find space for them. It would be
    > automatic.

    That's not very Mac like.  :)

        - Scott
  • > Would this work?


    Oh, what a beauty of a class!

    Yes, that will work perfectly! Exactly what I was looking for. Many thanks!

    I'll just nest a few of those and the UI widgets will be flying all over! ;)

    Again, thanks, Alan

    --
    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
  • That's not to say this exact example is the best solution to your
    problem (as a drop-in solution), but rather the approach it's taking
    could be used to craft a very specific, targeted solution for your
    particular needs. "Nesting" a few of these, populated with many
    subviews to track, would be very computationally expensive. Laptop
    users would thank you not to max out their processors (thereby
    draining their batteries faster) for a few 'flying widgets'. :-)

    --
    I.S.

    On Oct 14, 2006, at 12:06 AM, Alan Smith wrote:

    >> Would this work?
    >
    >> http://www.cocoadev.com/index.pl?FlowLayoutView
    >
    > Oh, what a beauty of a class!
    >
    > Yes, that will work perfectly! Exactly what I was looking for. Many
    > thanks!
    >
    > I'll just nest a few of those and the UI widgets will be flying all
    > over! ;)
    >
    > Again, thanks, Alan
    >
    > --
    > // Quotes from yours truly -------------------------
    > "You don't forget, you just don't remember."
    > "Maturity resides in the mind."
    > "Silence is the Universe's greatest gift."
  • Yes, I agree.

    But, I don't plan to use these at all in the end, just until I know
    what the UI should look like. Once I've seen all the windows I'll use
    them as a model to make nib files and then trash my use of
    ZFlowLayoutView.

    For further explanation refer to my original post.

    --
    // Quotes from yours truly -------------------------
    "You don't forget, you just don't remember."
    "Maturity resides in the mind."
    "Silence is the Universe's greatest gift."
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today