I just noticed something, these two constructors aren't the same, that's probably my problem sorry: Hyperlink myLogoutHyperlink = new Hyperlink("Logout", ""); Anchor myLogoutHyperlink = new Anchor("Logout", "");
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.