Hi Craig,

 Thanks for the reply. Yea, we could do that however I felt it would
spoil the flow of the configuration. The thing is I wanted to be able
to quickly insert a Panel or a GroupBox anywhere in the 'tree' of
controls as defined in the configuration. I was trying to avoid the
noise of having to register all the possible GroupBoxes and Panels etc
as individual components.

 However, I feel as if this is going against the grain a little too
much as I'm experiencing not only this issue, but also an issue where
I can't directly reference another component using the '@' syntax in
the GroupBox / Panels etc (see the 'ViewRef' hack in previous config -
all this class does is actually resolve the named IView)

 But I _really_ want to be able to do this :)




On Feb 17, 2:16 pm, Craig Neuwirt <[email protected]> wrote:
> My recommendation is to start using the newer syntax (easier to read)
> component 'CustomerDetailsView' is ComplaintView <  IView:
>      lifestyle Transient
>
> The problem you are having is that you are creating instances of  the child
> views directly.  You need to register child views as above and use service
> overrides to specify them
>
> ChildViews = ( @childView1, @childView2)
>
> You can look at sample Windor2.boo to get full syntax
>
> On Tue, Feb 17, 2009 at 8:02 AM, Andrew <[email protected]> wrote:
>
> > Hi,
>
> >  I'm using Binsor to compose views for a windows forms type
> > application. We have an IView interface and a bunch of standard
> > implementations like FlowLayoutView, PanelView etc and then custom
> > views like CustomerView. So, for example, we might have a boo file
> > like:
>
> > complaint_view = Component("CustomerDetailsView", IView,
> > ComplaintView, LifestyleType.Transient)
>
> > customer_issues_view = Component("CustomerIssuesView", IView,
> > CustomerIssuesView, LifestyleType.Transient
> >        ... some properties not relevant here
> > )
>
> > Component("CustomerAndIssuesView", IView, FlowLayoutPanelView,
> > LifestyleType.Transient,
> >        ChildViews: (
> >                GroupBoxView(
> >                        Text: "Customer Details",
> >                        ChildViews: (
> >                                ViewRef(ViewName: "CustomerDetailsView"),
> >                        )
> >                ) as IView,
> >                TabControlView(
> >                        ChildViews: (
> >                                GroupBoxView(
> >                                        Text: "Customer Issues",
> >                                        ChildViews: (
> >                                                ViewRef(ViewName:
> > "AnotherView"),
> >                                        )
> >                                ) as IView,
> >                        )
> >                )
> >        )
> > )
>
> > So, as you can see, I'm trying to define a composite view called
> > "CustomerAndIssuesView" of type FlowLayoutPanelView. This type has a
> > 'ChildViews' property which is defined as a property of type IView[].
> > In the config, I'd like to build up the child views as you see above,
> > so it flows naturally.
>
> > This kinda works, however there's a snag: Every time I resolve
> > "CustomerAndIssuesView", I get the same child view instances. E.g.
> > from example above, I get the same GroupBoxView and TabControlView
> > instances. This causes me grief as I need these to be newly
> > instantiated each time the parent component is resolved.
>
> >  So, my problem is that these are just read and instantiated once and
> > then reused when the dependencies of the parent component are
> > requested. I've had a look through the Binsor source, and am not
> > really sure where I should start tbh.
>
> >  One idea I've had is to make all the view types implement ICloneable
> > and then do some sort of custom castle ComponentDescriptor that can
> > spot this and just call Clone() when returning dependencies for
> > component
>
> >  However, as I'm a complete noob with Binsor, I was hoping to get this
> > group's opinion before starting down this path. Is there an easier
> > way?
>
> > Thanks,
> > Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to