Anyone who uses the keyboard, the context menu or uses some browser extension that adds functionality to links or just overrides link styles in the browser will notice the forgery ;-) You can't win the duck typing [1] race here. Thomas' Anchor solution is of course better than my history-trick, to my shame I must admit the mere existence of the Anchor class has eluded me so far.
To put this discussion into some context, history events can be used not only for history, but for the main and only messaging mechanism in the application. You don't need to register click handlers on links, buttons, nor do you need to register any particularly clever callbacks to RPC services. They just fire history events which you can process in client-side controller classes (I call them "flows"). Is very convenient, especially through development because you don't need to click through to that page you are currently working on but can instantly navigate to it by adding the right history token to the initial URL. [1] http://en.wikipedia.org/wiki/Duck_typing On May 6, 1:38 am, Ian Bambury <[email protected]> wrote: > What is the advantage of a 'real link'? Who will ever know? > If you need focus and no history, use a styled PushButton > > Ian > > http://examples.roughian.com > > 2009/5/5 George Georgovassilis <[email protected]> > > > > > Hi Kevin, > > > had the same problem. Similar to Isaac's solution I used labels to do > > the trick, but that left a shallow aftertaste since you have to put a > > lot of work into them (make them focuseable etc for keyboard > > navigation) and they still don't feel like real links. Left aside the > > cool stuff you can do by right clicking on links. > > > In one case I manipulated the history mechanism to check for > > conditions in which a "rollback" should happen. The short storry is: > > 1. Yes, I _do_ assign a history token to that link > > 2. a history listener listens to that token and sets a boolean > > variable (i.e. dontChange) > > 3. the listener then invokes history.back() > > 4. the history handler is invoked for the pervious token, but because > > the variable dontChange is set, will not perform any processing for > > that token but just reset the variable > > > Uggly, but at least you can use real links. > > Hth, > > G. > > > On May 5, 6:15 pm, Kevin Qiu <[email protected]> wrote: > > > Hi all, > > > > I have a bunch of hyperlinks and I want them to act like buttons > > > (respond to ClickEvent) but I don't want them to change the history > > > token which will mess up my history mechanism. How would I do that? I > > > tried setting target history token to null but it doesn't work. > > > > Thanks, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
