Thanks for responding.

Thanks in advance for any help.

Since I have posed two questions at once, if it's all the same to
everyone, I'd like to focus on my issue with canvas first.

What's goes wrong when I try to make a Canvas part of a view using
uibinder?

If I code something like this, I see a Canvas with the appropriate
stuff drawn on it.  But (see below)...

        public void onModuleLoad() {
                SimpleLayoutPanel pnl = new SimpleLayoutPanel();
                Canvas cvs = Canvas.createIfSupported();
                pnl.add(cvs);
                RootLayoutPanel.get().add(pnl);
                Context2d ctx = cvs.getContext2d();
                int w = cvs.getCoordinateSpaceWidth();
                int h = cvs.getCoordinateSpaceHeight();
                ctx.setFillStyle("#d53747");
                ctx.moveTo(0, 0);
                ctx.lineTo(w, h);
                ctx.beginPath();
                ctx.arc(w/2, h/2, 9, 0, Math.PI * 2.0, true);
                ctx.closePath();
                ctx.fillText("Yay!!", w/2, h/2 + 20);
                ctx.fill();
                }

if I code something like this:

(1) Here's the uibinder declaration.

        <g:SimpleLayoutPanel addStyleNames="{style.pnl}" ui:field="pnl">
                <c:Canvas ui:field="cvs" />
        </g:SimpleLayoutPanel>

(2)  Here's the corresponding field in the view class:

        @UiField
        Canvas cvs;

(3)  And of course, Canvas needs this:

        @UiFactory public Canvas getCvs() {
                return Canvas.createIfSupported();
        }

Then do the same drawing, nothing appears on the Canvas.  It remains
blank.  It has size. Nothing is null. No errors are thrown.

                Context2d ctx = vw.getCtx();
                int w = vw.getCvs().getCoordinateSpaceWidth();
                int h = vw.getCvs().getCoordinateSpaceHeight();
                ctx.setFillStyle("#d53747");
                ctx.beginPath();
                ctx.arc(10, 10, 9, 0, Math.PI * 2.0, true);
                ctx.closePath();
                ctx.fillText("Yay!!", w/2, h/2 + 10);
                ctx.fill();


On Sep 19, 3:26 am, Alexandre Dupriez <alexandre.dupr...@gmail.com>
wrote:
> You do not need to invalidate or refresh your components to make them
> updated with your last change.
> There must be something wrong with your UI binding indeed. Could you
> please post us a snippet of your xml? Which widget do you use to bing
> the ui?

-- 
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-toolkit@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