Here's what I mean by it crashed, I click an Anchor which is tied to a
server call.  During the RPC call -
com.google.gwt.user.client.rpc.StatusCodeException is thrown.  Which
causes the "GWT Development Mode" to create a new Session, reloading
the app as if I just launched it (entering the onModuleLoad() of my
main class).  Remember this happens where the ONLY difference is using
"Anchor" instead of "Hyperlink" in the declaration, the rest of the
code is identical.

I am doing something a little dangerous, I use onModuleLoad() as my
entry point for each web page, even though there is only ONE module
for the application...  Let me repeat to be more clear, I click a link
which calls myOtherClass.onModuleLoad() which draws the screen how
that "webpage" should look.  I should probably make a new method name
instead of overloading onModuleLoad() and see if that is what was
causing the Anchor class to throw during RPC.

On Mar 4, 9:10 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Mar 4, 1:22 am, javaunixsolaris <lpah...@gmail.com> wrote:
>
> > Thanks Zak, that's exactly what I meant by the "history way".  Because
> > I thought by deprecating Hyperlink.addClickHandler that was GWT's way
> > of saying, "if you use the Hyperlink class make sure to use history
> > tokens!"...  I'd like to know the actual reason it became deprecated?
> > Mainly because Anchor doesn't work for me.
>
> > These two ways of handling clicks give me different behavior:
>
> > Hyperlink link = new Hyperlink("text");
> > link.addClickHandler(...);
> > =NOT the same as:
> > Anchor link = new Anchor("text");
> > link.addClickHandler(...);
>
> > Anchors actually crash the app!
>
> Can you clarify "crash the app", and what is your ClickHandler doing?
>
> 1. if you want a "Hyperlink with ClickHandler", use an Anchor, set its
> Href to #token (token being your history token), and in the
> ClickHandler make sure you preventDefault() on the event and call
> History.newItem() (this is what Hyperlink actually does)
> 2. if you want a link to another web page, well, I don't see a reason
> it would "crash"...
> 3. if you just want some kind of "button looking like link", then do
> not (ab)use an Anchor, use a Label or PushButton instead and style it
> as you want it to look like.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to