Hello,

I have a very strange problem with some anchors, which occurrs only in IE 
and only in certain combinations of version and browser/document modes.
The problem is, that *some* anchors will not work, allthough *all* anchors 
are built by the same method!

There is a list of chess games and at the end of each row there are some 
actions, like "Open" or "Analyze". The actions are realized as anchors. All 
the anchors for a row/game are put into a single panel, which is inserted 
into the list.

When the problem occurrs, the first anchor "Open" will not work (meaning 
that nothing happens), while the second anchor "Analyze" works just fine.

I believe that there must be a side effect somewhere, but I could not find 
it. Perhaps there is a problem with 
"OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml". I cannot remember why 
I decided to use it...

Any ideas how to find the bug or how to do it in another way?

Thanks
Magnus

-----

 private Panel getActions (Game game)
 {
  HorizontalPanel p = new HorizontalPanel ();
  
  addAction (p,CMD_OPEN,game.idx,"Open");
  addAction (p,CMD_ANALYZE,game.idx,"Analyze");
}

 protected void addAction (Panel pnl,int cmd,int idx,String lbl)
 {
  Anchor a = createAnchor (cmd,idx,lbl,this);

  if (hasWidgets (pnl))
   pnl.add(new HTML (" "));

  pnl.add(a);
 }

 private Anchor createAnchor (int cmd,int idx,String lbl,ClickHandler hdl)
 {
  SafeHtml h = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(lbl);
  Anchor a = new Anchor (h);
  
  a.addClickHandler(hdl);
  Element e = a.getElement();
  
  e.setAttribute("cmd",Integer.toString(cmd));
  e.setAttribute("idx",Integer.toString(idx));
  
  return (a);
 }

 public void onClick(ClickEvent evt)
 {
  Object o = evt.getSource();
  
  if (o == null)
   return;
  
  if (!(o instanceof Anchor))
   return;

  Anchor a = (Anchor) o;
  String t;
  
  t = a.getElement().getAttribute("cmd");
  int cmd = Integer.parseInt(t);
  t = a.getElement().getAttribute("idx");
  int idx = Integer.parseInt(t);

  onCommand (cmd,idx);
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to