SU Lightbox and GLORP

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

SU Lightbox and GLORP

Richard Eng
Yeah, it's a strange subject title and I have a long story to go with it...

I'm using GLORP to implement a catalog of items. In the "admin" page of my
app, I want to add, delete, or modify items in the catalog.

So the Seaside webpage shows a table of catalog items. When I add an item to
the catalog database, I want it reflected in the web table. When I delete an
item from the catalog database, I also want it reflected in the web table.
In other words, I want the web table to be always in sync with the catalog
database.

The tricky part comes in the delete operation because I want to throw up a
SU Lightbox that asks "Are you SURE?" This lightbox has two buttons: Yes and
No.

It's tricky because the SU Lightbox is non-blocking, ie, it doesn't wait for
the #answer. I've spent all day working around this issue and I think I've
solved it. BUT IT IS NOT PRETTY.

And Smalltalk solutions should usually be pretty.

So I guess I have two questions:

1) Is there a more elegant way to make the webpage table always in sync with
the GLORP database (esp. after add and delete operations)?

2) Is there a way to make the SU Lightbox *blocking*? If there were, I could
do the delete and webpage table update the same clean way I've done it for
the #add operation.

Thanks,
Richard

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

Re: SU Lightbox and GLORP

Lukas Renggli
> It's tricky because the SU Lightbox is non-blocking, ie, it doesn't wait for
> the #answer. I've spent all day working around this issue and I think I've
> solved it. BUT IT IS NOT PRETTY.

Why do you think the lightbox is non-blocking? WAComponent>>#lightbox:
uses exactly the same code as WAComponent>>#call: ...

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: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
Because when I put code after the call to #inform:, it gets executed
immediately and it doesn't wait for either the Yes button or the No button
to be clicked in the lightbox.

Unless I'm doing something really stupid when I call #inform:...

remove: item
 | fred |
 fred := self inform: 'Are you SURE?'.
 fred
  ifNotNil: [Transcript cr; show: 'RKE: Not nil.'].
 Transcript cr; show: 'RKE: After inform.'

inform: aString
 ^self lightbox: (GSRemoveVideoLB new addMessage: aString)

Both lines are printed in the Transcript even before I click on the lightbox
buttons.

Regards,
Richard

-----------
> It's tricky because the SU Lightbox is non-blocking, ie, it doesn't wait
> for
> the #answer. I've spent all day working around this issue and I think I've
> solved it. BUT IT IS NOT PRETTY.

Why do you think the lightbox is non-blocking? WAComponent>>#lightbox:
uses exactly the same code as WAComponent>>#call: ...

Lukas

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

Re: SU Lightbox and GLORP

Lukas Renggli
> Because when I put code after the call to #inform:, it gets executed
> immediately and it doesn't wait for either the Yes button or the No button
> to be clicked in the lightbox.

The test in SULightboxTest works (blocks twice) for me. Does it work for you?

    http://localhost:8080/seaside/tests/lightbox-dialog

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: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
Using the same Transcript test statements, I've found that it doesn't work
me.
The lightbox does not block.

Is there something wrong with my Squeak image? What should I be looking
for?

Richard

---------
> Because when I put code after the call to #inform:, it gets executed
> immediately and it doesn't wait for either the Yes button or the No button
> to be clicked in the lightbox.

The test in SULightboxTest works (blocks twice) for me. Does it work for
you?

    http://localhost:8080/seaside/tests/lightbox-dialog

Lukas

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

Re: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
I went back to the original squeak-web-118 image from Damien and modified
the SULightboxTest as follows:

inform: aString
| fred |
fred := self lightbox: (WAFormDialog new addMessage: aString).
fred
ifNotNil: [Transcript cr; show: 'RKE - 1'].
Transcript cr; show: 'RKE - 2'


It does not block. The print statements show up in the Transcript.

self lightbox: returns the #answer from the Ok button, right? Did I code it
right?

Richard

----- Original Message -----
From: "Richard K Eng" <[hidden email]>
To: "Seaside - general discussion" <[hidden email]>
Sent: Monday, September 24, 2007 6:34 PM
Subject: Re: [Seaside] SU Lightbox and GLORP


> Using the same Transcript test statements, I've found that it doesn't work
> me.
> The lightbox does not block.
>
> Is there something wrong with my Squeak image? What should I be looking
> for?
>
> Richard
>
> ---------
>> Because when I put code after the call to #inform:, it gets executed
>> immediately and it doesn't wait for either the Yes button or the No
>> button
>> to be clicked in the lightbox.
>
> The test in SULightboxTest works (blocks twice) for me. Does it work for
> you?
>
>    http://localhost:8080/seaside/tests/lightbox-dialog
>
> Lukas
>

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

Re: SU Lightbox and GLORP

Lukas Renggli
> fred := self lightbox: (WAFormDialog new addMessage: aString).

In my image I need to add a "; yourself" here, because #addMessage:
returns the decoration.

> fred
> ifNotNil: [Transcript cr; show: 'RKE - 1'].
> Transcript cr; show: 'RKE - 2'
>
> It does not block. The print statements show up in the Transcript.

After the fix mentioned above this blocks. 'RKE - 1' and 'RKE - 2' are
displayed after I press the OK button in the light-box.

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: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
It doesn't work for me. Oh well. That's alright--my solution works well
enough. I don't want to waste any more time on this issue. I have real
work to do!  :-)

Thanks,
Richard

---------
> fred := self lightbox: (WAFormDialog new addMessage: aString).

In my image I need to add a "; yourself" here, because #addMessage:
returns the decoration.

> fred
> ifNotNil: [Transcript cr; show: 'RKE - 1'].
> Transcript cr; show: 'RKE - 2'
>
> It does not block. The print statements show up in the Transcript.

After the fix mentioned above this blocks. 'RKE - 1' and 'RKE - 2' are
displayed after I press the OK button in the light-box.

Lukas

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

RE: SU Lightbox and GLORP

Sebastian Sastre-2
In reply to this post by Richard Eng
Maybe I'm missing something but you shouldn't be using #confirm: instead of
#inform:? I mean just:

        >>remove: anItem

        (self confirm: 'Really?') ifTrue:[self basicRemove: anItem]

        ???

Sebastian

> -----Mensaje original-----
> De: [hidden email]
> [mailto:[hidden email]] En nombre
> de Richard K Eng
> Enviado el: Lunes, 24 de Septiembre de 2007 17:23
> Para: Seaside - general discussion
> Asunto: Re: [Seaside] SU Lightbox and GLORP
>
> Because when I put code after the call to #inform:, it gets
> executed immediately and it doesn't wait for either the Yes
> button or the No button to be clicked in the lightbox.
>
> Unless I'm doing something really stupid when I call #inform:...
>
> remove: item
>  | fred |
>  fred := self inform: 'Are you SURE?'.
>  fred
>   ifNotNil: [Transcript cr; show: 'RKE: Not nil.'].
>  Transcript cr; show: 'RKE: After inform.'
>
> inform: aString
>  ^self lightbox: (GSRemoveVideoLB new addMessage: aString)
>
> Both lines are printed in the Transcript even before I click
> on the lightbox buttons.
>
> Regards,
> Richard
>
> -----------
> > It's tricky because the SU Lightbox is non-blocking, ie, it doesn't
> > wait for the #answer. I've spent all day working around
> this issue and
> > I think I've solved it. BUT IT IS NOT PRETTY.
>
> Why do you think the lightbox is non-blocking? WAComponent>>#lightbox:
> uses exactly the same code as WAComponent>>#call: ...
>
> Lukas
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

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

Re: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
Yes, you *are* missing something.  :-)

I was trying to apply the exceptionally cool lightbox effect for my
"confirm:" dialog. Maybe I'm being a little anal about it, because
certainly the #confirm: statement will do what I need to do in a
utilitarian fashion, but I wanted to do something a little spiffier
for my application.

Hey, why not?

Richard

------------
Maybe I'm missing something but you shouldn't be using #confirm: instead of
#inform:? I mean just:

 >>remove: anItem

 (self confirm: 'Really?') ifTrue:[self basicRemove: anItem]

 ???

Sebastian

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

RE: SU Lightbox and GLORP

Ramon Leon-5
> Yes, you *are* missing something.  :-)
>
> I was trying to apply the exceptionally cool lightbox effect
> for my "confirm:" dialog. Maybe I'm being a little anal about
> it, because certainly the #confirm: statement will do what I
> need to do in a utilitarian fashion, but I wanted to do
> something a little spiffier for my application.
>
> Hey, why not?
>
> Richard

I think he was wondering why you're checking #inform: for a return value, it
has none, while #confirm: returns a boolean.  He might not have noticed your
earlier custom implementation of #inform:, though you probably should have
overridden #confirm: instead if you expect the user to choose yes or no.

Ramon Leon
http://onsmalltalk.com 

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

Re: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
Good point. I'll use #confirm:.

However, I think I've discovered the reason I can't get it to work...

This works (not using lightbox):

confirm: aString
    ^ self call: (WAYesOrNoDialog new addMessage: aString)

remove: item
    (self confirm: 'Are you SURE?') ifTrue: [Transcript cr; show: 'RKE:
done!']


Now if I change the #call: to #lightbox:, I now get the dialog in a
lightbox. Great.

However, I now get *two* returns from #lightbox:. The first when the dialog
is
displayed. The second after I've clicked on Yes or No.

The first return is the self object. The second return is from whatever is
returned
from the Yes or No buttons. I am absolutely certain you guys can replicate
this.
Try it.

(Inserting #yourself in '(WAYesOrNoDialog new addMessage: aString)'
makes no difference.)

Now this makes it damn difficult for me to workaround. Why are there two
returns???

Richard

----- Original Message -----

> Yes, you *are* missing something.  :-)
>
> I was trying to apply the exceptionally cool lightbox effect for my
> "confirm:" dialog. Maybe I'm being a little anal about it, because
> certainly the #confirm: statement will do what I need to do in a
> utilitarian fashion, but I wanted to do something a little spiffier for my
> application.
>
> Hey, why not?
>
> Richard

I think he was wondering why you're checking #inform: for a return value, it
has none, while #confirm: returns a boolean.  He might not have noticed your
earlier custom implementation of #inform:, though you probably should have
overridden #confirm: instead if you expect the user to choose yes or no.

Ramon Leon

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

Re: SU Lightbox and GLORP

Lukas Renggli
> confirm: aString
>     ^ self call: (WAYesOrNoDialog new addMessage: aString)

You must be on a very very old version of Seaside?

Starting from Seaside 2.6 it is required to add a #yourself here. I
get a stack trace with your code. I doubt that anything before Seaside
2.7 supports the lightbox.

> However, I now get *two* returns from #lightbox:. The first when the dialog
> is displayed. The second after I've clicked on Yes or No.

Do you have any custom error handling in place? What are the methods
that you override in the calling class?

> from the Yes or No buttons. I am absolutely certain you guys can replicate
> this. Try it.

No, I cannot reproduce this.

> Now this makes it damn difficult for me to workaround. Why are there two
> returns???

There is something strange with your code. Can you provide a file-out?

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: SU Lightbox and GLORP

Chris Muller-3
In reply to this post by Richard Eng
I would avoid "Are you sure" confirmations as much as possible and,
instead, provide undo capability.

Computers should follow user directives without question or intrusion,
and be ready to accomodate their frailty.

On 9/24/07, Richard K Eng <[hidden email]> wrote:

> Yeah, it's a strange subject title and I have a long story to go with it...
>
> I'm using GLORP to implement a catalog of items. In the "admin" page of my
> app, I want to add, delete, or modify items in the catalog.
>
> So the Seaside webpage shows a table of catalog items. When I add an item to
> the catalog database, I want it reflected in the web table. When I delete an
> item from the catalog database, I also want it reflected in the web table.
> In other words, I want the web table to be always in sync with the catalog
> database.
>
> The tricky part comes in the delete operation because I want to throw up a
> SU Lightbox that asks "Are you SURE?" This lightbox has two buttons: Yes and
> No.
>
> It's tricky because the SU Lightbox is non-blocking, ie, it doesn't wait for
> the #answer. I've spent all day working around this issue and I think I've
> solved it. BUT IT IS NOT PRETTY.
>
> And Smalltalk solutions should usually be pretty.
>
> So I guess I have two questions:
>
> 1) Is there a more elegant way to make the webpage table always in sync with
> the GLORP database (esp. after add and delete operations)?
>
> 2) Is there a way to make the SU Lightbox *blocking*? If there were, I could
> do the delete and webpage table update the same clean way I've done it for
> the #add operation.
>
> Thanks,
> Richard
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: SU Lightbox and GLORP

Richard Eng
In reply to this post by Richard Eng
Okay, with Lukas' help, I've learned that my Squeak image (squeak-web-118)
as downloaded from Damien Cassou's website was corrupted somehow. At his
recommendation, I've avoided the "developer image" and started from scratch
with a fresh Squeak 3.9 image. I've installed Seaside 2.8a.

#confirm: now works fine with lightbox. I'm a happy camper. Well, almost.
Now that I'm no longer using the developer image, I miss not having the
"refactoring browser" or color coding or eCompletion. I don't know where to
get (or how to install) these things.

Regards,
Richard

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

RE: SU Lightbox and GLORP

Ramon Leon-5
> Okay, with Lukas' help, I've learned that my Squeak image
> (squeak-web-118) as downloaded from Damien Cassou's website
> was corrupted somehow. At his recommendation, I've avoided
> the "developer image" and started from scratch with a fresh
> Squeak 3.9 image. I've installed Seaside 2.8a.
>
> #confirm: now works fine with lightbox. I'm a happy camper.
> Well, almost.
> Now that I'm no longer using the developer image, I miss not
> having the "refactoring browser" or color coding or
> eCompletion. I don't know where to get (or how to install)
> these things.
>
> Regards,
> Richard

Try Damien's squeak-dev image rather than squeak-web, and load Seaside
yourself from package universe.  If not, then just install the tools you
want from Squeak Map, Shout is the color coding, and you can find the
Refactoring Browser and eCompletion there as well.  Try always keeping a
clean image to start from so should something like this happen, you already
have a clean fully loaded image to clone.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside