Project

General

Profile

Actions

Bug #1170

closed

style: height grows on every click event

Added by Anonymous almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
02/22/2012
Due date:
% Done:

0%

Estimated time:

Description

I've modified the hangman example to:

this->setMargin(Wt::WLength(0));

WVBoxLayout *layout = new WVBoxLayout();

layout->setContentsMargins(0, 0, 0, 0);

this->setLayout(layout);

images_ = new ImagesWidget();

layout->addWidget(images_, 0, AlignCenter | AlignMiddle);

m_pButtonTraining = new WPushButton("training", this);

m_pButtonFight = new WPushButton("FIGHT!", this);

m_pButtonTraining->clicked().connect(this, &WrestlingWidget::Training);

m_pButtonFight->clicked().connect(this, &WrestlingWidget::Fight);

layout->addWidget(m_pButtonTraining, 0, AlignCenter | AlignMiddle);

layout->addWidget(m_pButtonFight, 0, AlignCenter | AlignMiddle);

...

everytime I click any of the buttons I created, all lines like:

...

increase the height (%d is a dummy).

my callback functions are empty atm and it happens even when I pause the server binary, chrome reports the modification of the height attribute happens in this line:

(sorry, when I try to expand it, chrome seems to not want to debug it anymore, so I can't be more precise)

Wt3_2_0.StdLayout = function(b,r,j){var o=this;this.getId=function(){return r};this.WT=b;this.marginH=function(a){var c=a.parentNode,d=0;if(!b.boxSizing(a)){d=b.px(a,"marginLeft");db.px(a,"marginRight");d=b.px(a,"borderLeftWidth");db.px(a,"borderRightWidth");d=b.px(a,"paddingLeft");db.px(a,"paddingRight")}d=b.pxself(c,"paddingLeft");db.pxself(c,"paddingRight");return d};this.marginV=function(a){var c=b.px(a,"marginTop");c=b.px(a,"marginBottom");if(!b.boxSizing(a)){c+= b.px(a,"borderTopWidth");cb.px(a,"borderBottomWidth");c=b.px(a,"paddingTop");cb.px(a,"paddingBottom")}return c};this.getColumn=function(a){var c,d,i,h=b.getElement®.firstChild.childNodes;d=c=0;for(i=h.length;d<i;d){var e=h[d];if(b.hasTag(e,"COLGROUP")){d=1;h=e.childNodes;i=h.length}if(b.hasTag(e,"COL"))if(e.className!="Wt-vrh")if(ca)return e;else++c}return null};this.adjustCell=function(a,c){var d=c0;c=b.pxself(a,"paddingTop");c~~b.pxself(a,"paddingBottom");if(c<=0)c=0;a.style.height= c"px";if(!(a.style.verticalAlign||a.childNodes.length0)){a=a.childNodes[0];if(c<=0)c=0;if(a.className"Wt-hcenter"){a.style.height=c"px";a=a.firstChild.firstChild;if(!b.hasTag(a,"TD"))a=a.firstChild;if(a.style.height!=c"px")a.style.height=c"px";a=a.firstChild}c=this.marginV(a);if(c<=0)c=0;if(!b.hasTag(a,"TABLE")){var i,h;if(!d){i=a.parentNode;h=i.offsetWidth-o.marginH(a);if(i.className\"Wt-chwrap\"&&h>0){if(!b.isIE){a.style.position=\"relative\";a=a.firstChild}a.style.width=h+\"px\";a.style.position= \"absolute\"}}if(!d&&a.wtResize)a.wtResize(a,h,c);else if(a.style.height!=c+\"px\"){a.style.height=c+\"px\";if(a.className"Wt-wrapdiv")if(b.isIE&&b.hasTag(a.firstChild,"TEXTAREA"))a.firstChild.style.height=c-b.pxself(a,"marginBottom")"px"}}}};this.adjustRow=function(a,c){var d=[];if(a.style.height!=c"px")a.style.height=c"px";a=a.childNodes;var i,h,e,g;i=0;g=--1;for(h=a.length;i<h;+i){e=a[i];e.className!="Wt-vrh"&&g;if(e.rowSpan!=1){this.adjustCell(e,0,g);d.push({td:e,col:g})}else this.adjustCell(e, c,g)}return d};this.adjust=function(){var a=b.getElement®;if(!a)return false;o.initResize&&o.initResize(b,r,j);if(b.isHidden(a))return true;var c=a.firstChild,d=a.parentNode;if(c.style.height!\"\")c.style.height=\"\";var i=b.pxself(d,\"height\"),h=false;if(i=0){h=true;i=d.clientHeight}var e=d.clientWidth;if(!(a.dirty||c.wi))return true;c.w=e;c.h=i;a.dirty=null;var g=i;if(h){g-=b.px(d,\"paddingTop\");g-=b.px(d,\"paddingBottom\")}else if(b.boxSizing(d)){g-=b.px(d,\"borderTopWidth\");g-=b.px(d, \"borderBottomWidth\");g-=b.px(d,\"paddingTop\");g-=b.px(d,\"paddingBottom\")}g-=b.px(a,\"marginTop\");g-=b.px(a,\"marginBottom\");if(d.children&&d.children.length!1){h=0;for(i=d.children.length;h<i;h){e=d.children[h];if(e!a)g-=$(e).outerHeight()}}a=d=0;var p,n;i=c.rows.length;for(p=h=0;h<i;h++){e=c.rows[h];if(e.className)g-=e.offsetHeight;else{a+=j.minheight[p];if(j.stretch[p]<=0)g-=e.offsetHeight;else d+=j.stretch[p];++p}}g=g>a?g:a;a=[];if(d!0&&g>0){var s=g,t;for(p=h=0;h<i;h){e=c.rows[h];if(!e.className){n= j.stretch[p];if(n!0){if(n!1){t=j.minheight[p];n=g*n/d;n=s>n?n:s;n=Math.round(t>n?t:n);s~~=n}else n=e.offsetHeight;b.addAll(a,this.adjustRow(e,n))}p}}}h=0;for(i=a.length;h<i;h){e=a[h].td;g=a[h].col;this.adjustCell(e,e.offsetHeight,g)}if(c.style.tableLayout!\"fixed\")return true;p=0;s=c.childNodes;var z,A,x;a=0;for(d=s.length;a<d;a++){g=s[a];if(b.hasTag(g,\"COLGROUP\")){a=-1;s=g.childNodes;d=s.length}if(b.hasTag(g,\"COL\")){if(b.pctself(g,\"width\")=0){h=t=0;for(i=c.rows.length;h<i;h){e=c.rows[h]; n=e.childNodes;A=z=0;for(x=n.length;A<x;A){e=n[A];if(e.colSpan=1&&z=p&&e.childNodes.length=1){e=e.firstChild;e=e.offsetWidth+o.marginH(e);t=Math.max(t,e);break}z+=e.colSpan;if(z>p)break}}if(t>0&&b.pxself(g,\"width\")!t)g.style.width=t"px"}++p}}return true};this.contains=function(a){var c=b.getElement®;a=b.getElement(a.getId());return c&&a?b.contains(c,a):false}}

Actions #1

Updated by Koen Deforche almost 13 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche

Hey,

That is typical caveat with layout managers if you are trying to use a layout manager that should actively manage the height of children within a widget that itself is not constrained in height.

You probably want this instead, which tells the layout manager to align the contents within the container, instead of fitting it:

this->setLayout(layout, AlignTop | AlignJustify);

Regards,

koen

Actions #2

Updated by Koen Deforche over 12 years ago

  • Status changed from Resolved to Closed
  • Target version set to 3.2.1
Actions

Also available in: Atom PDF