Reference view can't be hided and showed at will?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Reference view can't be hided and showed at will?

Sebastián Sastre
Hi all,

    I'm suprised to see that a presenter I've made, inserted as reference
view in the view of a dialog I'm making, do nothing whe receives the message
hide.

    When this dialog is open

    (MyDialog allInstances first presenterNamed:'myReferencedPresenter')
hide.
    (MyDialog allInstances first presenterNamed:'myReferencedPresenter')
show.

    Those messages are ignored.

    The referenced views can't be hided?

    How can I workout this?

thanks,

Seb


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Ian Bartholomew-19
Seb,

>    I'm suprised to see that a presenter I've made, inserted as reference
> view in the view of a dialog I'm making, do nothing whe receives the
> message
> hide.

I haven't tried this but you _may_ need a #referee in there to get to the
actual view...

(MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
referee hide.
(MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
referee show.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Schwab,Wilhelm K
Ian, Seb,

> I haven't tried this but you _may_ need a #referee in there to get to the
> actual view...
>
> (MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
> referee hide.
> (MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
> referee show.

At one point anyway, I found the methods below to be helpful.  I put it
that way only because I think I might be able to get away without them
now, but as the old saying goes, if it ain't broke, don't fix it.

Have a good one,

Bill



!ReferenceView methodsFor!

selfOrReferee
        "Having problems w/ reference views vs. ordinary views"

        ^self referee

! !
!ReferenceView categoriesFor: #selfOrReferee!accessing!must not
strip!public! !

!View methodsFor!

selfOrReferee
        "Having problems w/ reference views vs. ordinary views"

        ^self
! !
!View categoriesFor: #selfOrReferee!accessing!must not strip!public! !



--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Sebastián Sastre
In reply to this post by Ian Bartholomew-19
Actually, I'm having success in hidding a view.

What I'm trying to do is to have two diferent presenters *almost* the same
but showing a diferent perception of the model. Some taxes applies to one
case, and some not in other case. You change the case selecting an item from
a combobox.

So I made
>>onConditionChanged: aCondition

    aCondition shouldHaveTax
        ifTrue:[ (self presenterNamed:'detailsWithoutTax') hide.
            (self presenterNamed:'detailsWithTax') show]
        ifFalse:[(self presenterNamed:'detailsWithTax') hide.
            (self presenterNamed:'detailsWithoutTax') show].

>>createComponents method is with

    self add: DetailPresenter new name:'detailsWithTax';
        add: DetailPresenter new name:'detailsWithoutTax'.

    With the view composer, I've made two reference views of
DetailPresenter. I've put them one in the top of the other so I can just
hide or show the appropiated one at appropiated time.

    Do you think this is a correct approach? better ideas?

regards,

Seb



"Ian Bartholomew" <[hidden email]> escribió en el mensaje
news:[hidden email]...

> Seb,
>
> >    I'm suprised to see that a presenter I've made, inserted as reference
> > view in the view of a dialog I'm making, do nothing whe receives the
> > message
> > hide.
>
> I haven't tried this but you _may_ need a #referee in there to get to the
> actual view...
>
> (MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
> referee hide.
> (MyDialog allInstances first presenterNamed:'myReferencedPresenter') view
> referee show.
>
> --
> Ian
>
> Use the Reply-To address to contact me.
> Mail sent to the From address is ignored.
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Chris Uppal-3
Sebastián Sastre wrote:

>     Do you think this is a correct approach? better ideas?

I don't see anything wrong with it myself.

However, looking at the code for ReferenceView, it doesn't seem to have a #hide
method that causes its referee to #hide too.  So you could try adding something
like:

    RefereceView>>hide
        self referee ifNotNil: [:it | it hide].

which might help.  The #show method is apparently OK already.  If that does fix
your problem then I would say that the lack of ReferenceView>>hide is probably
a Dolphin
bug.

An alternative approach that I have used is to put both components inside a
WizardCardContainer (Presenter.'Wizard card container'), and then use
Presenter>>ensureVisible to switch between your two sub-components.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Schwab,Wilhelm K
Chris, Sebastián,

> An alternative approach that I have used is to put both components inside a
> WizardCardContainer (Presenter.'Wizard card container'), and then use
> Presenter>>ensureVisible to switch between your two sub-components.

I like that, especially for situations that can be statically assembled
in the VC.  Another option is to see whether Pane Holders (on my web
site) solves the problem.  I was focusing too much on the reference view
aspect of this thread to realize that it might be about dynamic presenters.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Reference view can't be hided and showed at will?

Sebastián Sastre
In reply to this post by Chris Uppal-3
Dear Chris,

    finally I managed to make it work.

    The wizard card container, is the valid alternative, but for some
reason, it only works if you dont have the #hide instance method in
ReferenceView class as you suggested.

    best regards,

Seb

"Chris Uppal" <[hidden email]> escribió en el
mensaje news:[hidden email]...
> Sebastián Sastre wrote:
>
> >     Do you think this is a correct approach? better ideas?
>
> I don't see anything wrong with it myself.
>
> However, looking at the code for ReferenceView, it doesn't seem to have a
#hide
> method that causes its referee to #hide too.  So you could try adding
something
> like:
>
>     RefereceView>>hide
>         self referee ifNotNil: [:it | it hide].
>
> which might help.  The #show method is apparently OK already.  If that
does fix
> your problem then I would say that the lack of ReferenceView>>hide is
probably
> a Dolphin
> bug.
>
> An alternative approach that I have used is to put both components inside
a
> WizardCardContainer (Presenter.'Wizard card container'), and then use
> Presenter>>ensureVisible to switch between your two sub-components.
>
>     -- chris
>
>