Cocoa Bindings & different nibs

  • Hi,

    I'm writing a document based application. The document window
    consists of 3 zones: an inspector view (which is a custom view), an
    outline view, and another custom view where I draw rectangles that
    represent certain objects.

    What I wanna do is, if either the outlineview or the custom view is
    selected, change the subviews of the inspectorview. The subviews of
    the inspectorview are made in separate nibs, which are then loaded by
    my InspectorController.
    I would like to use bindings to populate each of the GUI elements of
    these subviews. So for instance if I click on the custom view and a
    rectangle is selected, I would tell the InspectorController to add
    the subview that has all the properties I can change for this
    rectangle and somehow tell bindings that the selection has been
    changed so the subview gets populated.

    I've looked at mmalc's GraphicBindings example (http://
    homepage.mac.com/mmalc/CocoaExamples/GraphicsBindings.zip) but I
    can't figure out how this all works. I wanna do something similiar,
    except that my inspector subviews come from a external nibs.

    How could I solve this problem? Any pointers would be very welcome.

    Thanks in advance.
  • on 10/9/06 2:53 AM, <jesus...> purportedly said:

    > What I wanna do is, if either the outlineview or the custom view is
    > selected, change the subviews of the inspectorview. The subviews of
    > the inspectorview are made in separate nibs, which are then loaded by
    > my InspectorController.
    > I would like to use bindings to populate each of the GUI elements of
    > these subviews. So for instance if I click on the custom view and a
    > rectangle is selected, I would tell the InspectorController to add
    > the subview that has all the properties I can change for this
    > rectangle and somehow tell bindings that the selection has been
    > changed so the subview gets populated.

    With this setup you will have to bind to or through the InspectorController,
    which should be the file's owner of the separate nibs. When a nib is loaded
    (note: *loaded* but not necessarily displayed), all of the bindings will
    automatically trigger. After that point, as long as you are changing values
    in a KVO/KVC compliant manner, the bindings will sync properly.

    A word of advice: you will probably run into less problems and headaches if
    you keep the inspector view and all the subviews in a single nib.

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
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