... and incidently, the horizontalpanel approach never did work well.
Before I could figure out the problem, I just did the flowpanel+anchor
+clicklistener approach.  Who woulda thought inline links would be
such a pain.

I star'd that issue...



On Oct 3, 11:59 am, Brian <[EMAIL PROTECTED]> wrote:
> If it weren't such pita, it'd be sweet. But yeah, that worked great.
>
> Since I'm doing this on a number of links in a bunch of text, I
> wrapped up the click listener as such instead of new'ing one each
> time.
>
>     ClickListener linkClickListener = new ClickListener() {
>         public void onClick(Widget sender) {
>             History.newItem(((Anchor)sender).getHref().substring(1));
>              DOM.eventGetCurrentEvent().preventDefault();
>         }
>     };
>
> Thanks much.
>
> On Oct 3, 11:44 am, Thomas Broyer <[EMAIL PROTECTED]> wrote:
>
> > On 3 oct, 17:24, Brian <[EMAIL PROTECTED]> wrote:
>
> > > Tricky, but doesn't quite work in my attempts.
>
> > > Both HTMLPanel.add() and HTMLPanel.addAndReplaceElement() puts a
> > > newline before the link, so I end up with:
>
> > > blah blah
> > > link
> > > blah blah
>
> > > instead of: blah blah link blah blah
>
> > > I'm putting the HTMLPanel in a FlexTable's cell.
>
> > It has nothing to do with the HTMLPanel actually, but a problem with
> > the Hyperlink widget: it's made up of a DIV wrapping an A, that's this
> > DIV wrapper that's causing the line breaks, because a DIV is
> > display:block by default.
>
> > I'd suggest replacing the Hyperlink with an Anchor+ClickListener.
> > I'd also use a FlowPanel+InlineLabels but it's up to you, the
> > HTMLPanel should work like a charm too:
>
> > FlowPanel container = new FlowPanel();
> > container.add(new InlineLabel("some text ");
> > Anchor link = new Anchor("link", "#token");
> > link.addClickListener(new ClickListener() {
> >    public void onClick(Widget sender) {
> >       History.newItem("token");
> >       DOM.eventGetCurrentEvent().preventDefault();
> >    }});
>
> > container.add(link);
> > container.add(new InlineLabel(" some more text");
>
> > ...and/or you could "vote for" (i.e. "star") the issue 
> > 2901:http://code.google.com/p/google-web-toolkit/issues/detail?id=2901
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to