Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Default height issue with GWT canvas in SmartGWT Layout

    I am trying to add a GWT canvas within a SmartGWT VLayout. It appears the SmartGWT/GWT canvas height defaults to a minimum of 100... no matter what I specify for the GWT canvas height.

    What am I missing here?

    Any help would be appreciated.

    FYI, I am running SmartGWT v2.1 with GWT v2.0.3. The issue appears browser independent, as I have tried this on Safari and Firefox.

    Here is an example of code:
    [CODE]
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight100();

    gwt.canvas.client.Canvas gwtCanvas = new gwt.canvas.client.Canvas(300, 24);

    layout.addMember(gwtCanvas);
    [\CODE]

    #2
    I had the exact same problem with SmartGWT and gwt-canvas. If you put your gwt canvas in a SmartGWT Layout and your gwt canvas was less than 100px high, no matter what you do, the Layout always defaults to a height of 100px. My workaround was to put the gwt canvas in a GWT SimplePanel and the SimplePanel into a SmartGWT VLayout and the problem disappears. I'm not sure why that makes a difference, but it does.

    Here is what you can try:

    Code:
    VLayout layout = new VLayout();
    layout.setWidth100();
    layout.setHeight(1);
    layout.setOverflow(Overflow.VISIBLE);
          
    SimplePanel simple = new SimplePanel();
    simple.setHeight("24px");
    simple.setWidth("100%");
          
    gwt.canvas.client.Canvas gwtCanvas = new gwt.canvas.client.Canvas(300, 24);
    gwtCanvas.setStrokeStyle("#000000");
    gwtCanvas.setLineWidth(2);
    gwtCanvas.beginPath();
    gwtCanvas.moveTo(30, 1);
    gwtCanvas.lineTo(45, 20);
    gwtCanvas.stroke();
    
    simple.add(gwtCanvas);
          
    layout.addMember(simple);
    Hope this helps.

    Comment


      #3
      Hello,

      i'am havin' almost the same Problem,infact i have a class (Treecheckbox) that extends from a canvas,i try to put the object in a Vlayout,but i'am havin' the TreeCheckbox in the top,and my layout(with a toolStrip),in the other side,i tryed ur code,but it didn't work for me,an other idea plz ?

      Comment

      Working...
      X