Disabling the back button

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

Disabling the back button

Carl Gundel
If I need to disable the back button in my Seaside app, how can I do it?

Thanks,

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com

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

RE: Disabling the back button

Ramon Leon-5
>
> If I need to disable the back button in my Seaside app, how
> can I do it?
>
> Thanks,
>
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com


Short answer...
 self isolate: [some code]

Longer answer, read the paper about half way down this page..

http://seaside.st/Community/ExternalDocumentation/

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

Re: Disabling the back button

Carl Gundel
In reply to this post by Carl Gundel
>> > If I need to disable the back button in my Seaside app, how
>> can I do it?
>>
>> Thanks,
>>
>> -Carl Gundel, author of Liberty BASIC
>> http://www.libertybasic.com
>
>Short answer...
> self isolate: [some code]
>
>Longer answer, read the paper about half way down this page..
>
>http://seaside.st/Community/ExternalDocumentation/

Thanks.  I read the document.  Looks like a slight API change since the
isolate: method has moved from WASession to WAComponent.  That aside, I
decided to test this by adding the technique to the WACounter example class.
Here are the methods I changed:

increase
 self isolate: [ count := count + 1 ]

decrease
  self isolate: [ count = 0
    ifFalse: [count := count - 1]
    ifTrue:
        [(self confirm: 'Do you want to go negative?')
               ifTrue: [self inform: 'Ok, let''s go negative!'.
             count := -100]]].

The example seems to behave exactly as without the isolate: code.  I can use
the back button and then click on ++ or --.  They work as before.  Ideas?

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com


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

Re: Disabling the back button

Ramon Leon-4
> Thanks.  I read the document.  Looks like a slight API change since the
> isolate: method has moved from WASession to WAComponent.  That aside, I
> decided to test this by adding the technique to the WACounter example class.
> Here are the methods I changed:
>
> increase
>  self isolate: [ count := count + 1 ]
>
> decrease
>   self isolate: [ count = 0
>     ifFalse: [count := count - 1]
>     ifTrue:
>         [(self confirm: 'Do you want to go negative?')
>                ifTrue: [self inform: 'Ok, let''s go negative!'.
>              count := -100]]].
>
> The example seems to behave exactly as without the isolate: code.  I can use
> the back button and then click on ++ or --.  They work as before.  Ideas?
>
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com

I think you misunderstand the intent of isolate.  You can't isolate
individual actions in a callback, rather you isolate the viewing of a
component.  Trying using it from a WATask subclass to coordinate
workflow and prevent a user from going back in the flow.

Consider the sample in the WAStoreTask

go
     | shipping billing creditCard |
     cart := WAStoreCart new.
     self isolate:
         [[self fillCart.
         self confirmContentsOfCart]
             whileFalse].

     self isolate:
         [shipping := self getShippingAddress.
         billing := (self useAsBillingAddress: shipping)
                     ifFalse: [self getBillingAddress]
                     ifTrue: [shipping].
         creditCard := self getPaymentInfo.
         self shipTo: shipping billTo: billing payWith: creditCard].

     self displayConfirmation.

#isolate: is used to wrap what is essentially #call: to several
components in succession.  You could use isolate in a callback, if the
callback is calling another component to display, but not if it's just
setting instance variables.

The point is, all isolate does is expire any components created within
the block passed to it, when the execution of the block is complete.
Once execution has passed beyond the isolate block, the user cannot go
back to any component called from within the block.

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