Lightbox in child component

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

Lightbox in child component

Amos-15
Hi all,

I was trying to write a small Seaside application and wanted to try
using a lightbox to display an error message (say when logging in with
an invalid password). In my case, the call to #lightbox: seemed to do
nothing at all (except refresh the page; 3.10.6 image), yet when I
tried the lightbox test (from http://localhost:8080/seaside/ -> tests
link -> lightbox-dialog link), it worked just fine.

Investigating this a bit further to eliminate possible differences, I
ended up embedding SULightboxTest itself into my application, and
found that it doesn't work there... my guess is that it only works as
a standalone component, not as an embedded child component. (Can
anyone confirm this?) Even trying to provide the child with a parent
reference (the root component) and then calling something like:

self parent lightbox: (WAFormDialog new
    addMessage: 'testing...';
    yourself)

does nothing (the code is executed, but I don't yet know enough about
AnswerContinuation, WARenderNotification, et al to be able to tell
where it's going "wrong").

Am I missing something really basic, could it be something in my
image, or is this a general problem?

Cheers and Happy New Year,

Amos
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Michael Lucas-Smith-3

> Am I missing something really basic, could it be something in my
> image, or is this a general problem?
>  
Are you sure the parent is holding on to the same instance of the child?
If it's not, then the previously "wrapped" component (when you use
lightbox, it wraps the component in a decoration) is no longer in the
render tree, so the lightbox won't appear.

Cheers,
Michael
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Amos-15
> > Am I missing something really basic, could it be something in my
> > image, or is this a general problem?
> >
> Are you sure the parent is holding on to the same instance of the child?
> If it's not, then the previously "wrapped" component (when you use
> lightbox, it wraps the component in a decoration) is no longer in the
> render tree, so the lightbox won't appear.
>
Yes, the instance is the same (within the session at least) - the
child is held in an instance variable which is initialised in
#initialize and otherwise doesn't change.

For simplification, let's say I have a MainComponent (which
canBeRoot), with children HeaderComponent, ContentComponent, and
FooterComponent. From what you say, should I expect to have only the
child component that calls #lightbox: to be "wrapped" and display the
lightbox? What about the case I mentioned where #lightbox: was sent by
the parent component?
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Michael Lucas-Smith-3
Amos wrote:

>>> Am I missing something really basic, could it be something in my
>>> image, or is this a general problem?
>>>
>>>      
>> Are you sure the parent is holding on to the same instance of the child?
>> If it's not, then the previously "wrapped" component (when you use
>> lightbox, it wraps the component in a decoration) is no longer in the
>> render tree, so the lightbox won't appear.
>>
>>    
> Yes, the instance is the same (within the session at least) - the
> child is held in an instance variable which is initialised in
> #initialize and otherwise doesn't change.
>
> For simplification, let's say I have a MainComponent (which
> canBeRoot), with children HeaderComponent, ContentComponent, and
> FooterComponent. From what you say, should I expect to have only the
> child component that calls #lightbox: to be "wrapped" and display the
> lightbox? What about the case I mentioned where #lightbox: was sent by
> the parent component?
>  
Good point. I guess my only other question is - how is the callback
happening? If it's an ajax callback then you wouldn't expect it to come
in for a re-render pass, therefore the lightbox would never appear.

Other than that, it sounds like the scenario is getting kinda weird -
suggesting that perhaps something is wrong.

Michael
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Lukas Renggli
In reply to this post by Amos-15
> Am I missing something really basic, could it be something in my
> image, or is this a general problem?

I guess you are missing to include SULibrary into your application.
SULibrary provides all necessary JavaScript code that goes with the
SU* classes.

You can see that kind of problems immediately when using FireFox and
FireBug to develop and test your applications.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Amos-15
> > Am I missing something really basic, could it be something in my
> > image, or is this a general problem?
>
> I guess you are missing to include SULibrary into your application.
> SULibrary provides all necessary JavaScript code that goes with the
> SU* classes.

Ah, that may well be it, thanks Lukas!

I had assumed that the files in /seaside/files/WAStandardFiles/ were
sufficient and would include those js files needed for scriptaculous.
I'll have to find out which files are necessary and include them in
#updateRoot: (I'm trying to do it without going the WAFileLibrary way)
along with my CSS.

> You can see that kind of problems immediately when using FireFox and
> FireBug to develop and test your applications.
>

Sorry, I'm not a particular fan of FF - I'm an Opera guy through and
through =o) but will keep the error console open in future. In fact,
though I'll likely get flamed for it, I view the "FF to Opera"
relationship similarly to the "Java to Smalltalk" relationship, but
that's a whole other can of worms... ;-)
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Lightbox in child component

Lukas Renggli
> > You can see that kind of problems immediately when using FireFox and
> > FireBug to develop and test your applications.
>
> Sorry, I'm not a particular fan of FF - I'm an Opera guy through and
> through =o) but will keep the error console open in future. In fact,
> though I'll likely get flamed for it, I view the "FF to Opera"
> relationship similarly to the "Java to Smalltalk" relationship, but
> that's a whole other can of worms... ;-)

I am not a particular fan of FF either. I am normally using Safari,
but for anything that has only remotely to do with JavaScript it is
absolutely essential to use FireBug. Nowadays there are similar tools
for IE and Safari (probably also Opera), but none of them convinces
me. The original FireBug plugin is the only way to detect and fix such
problems.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside