Project

General

Profile

Actions

Bug #1072

closed

Buttons become unclickable in layouts with images and nonzero stretch factors

Added by Peter K over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
11/27/2011
Due date:
% Done:

0%

Estimated time:

Description

Hi,

It looks to me like WHBoxLayout and WVBoxLayout may have a bug when dealing with images. I narrowed the problem down to a test case (code below). In short, in layouts that contain an image and an element with a non-zero stretch factor, two problems appear:

1) Images are rendered across div (WContainerWidget) boundaries

2) Buttons that are placed in elements after the stretch are unclickable

The "unclickable" buttons are always unclickable on a freshly loaded browser (Firefox, Chrome, Safari). Sometimes, they can become clickable after other buttons on the page have been used.

In the test case I have a nested layout that uses a WHBoxLayout and a WVBoxLayout. Without the image, everything works fine. When the image is added, the image size seems to be ignored and it is rendered across the div boundary. Buttons in elements before the stretch element work as expected, but the button placed after it is apparently invisible to the browser. Any other widgets placed after the stretch also don't respond to events.

MyApplication::MyApplication(const WEnvironment& env):
WApplication(env)
{
    useStyleSheet("CssStyleSheet.css"); //Just background-color to highlight where the divs are

    //A vertical box layout fills out the root widget and contains two WContainerWidgets
    WVBoxLayout* vLayout=new WVBoxLayout(root());
    WContainerWidget *topContainer, *bottomContainer;
    topContainer=new WContainerWidget; bottomContainer=new WContainerWidget;
    vLayout->addWidget(topContainer);
    vLayout->addWidget(bottomContainer);
    topContainer->setStyleClass("grey");
    vLayout->setStretchFactor(bottomContainer,1);   //bottom container takes up all unused space

    //A horizontal box layout fills out the topContainer and has four WContainerWidgets in it
    WHBoxLayout* topLayout=new WHBoxLayout(topContainer);
    WContainerWidget *topDiv1, *topDiv2, *topDiv3, *topDiv4;
    topDiv1=new WContainerWidget; topDiv2=new WContainerWidget;
    topDiv3=new WContainerWidget; topDiv4=new WContainerWidget;
    topLayout->addWidget(topDiv1);
    topLayout->addWidget(topDiv2);
    topLayout->addWidget(topDiv3);
    topLayout->addWidget(topDiv4);
    topLayout->setStretchFactor(topDiv3,1);     //Third WContainerWidget takes up all unused space

    //An image is placed into the first top WContainerWidget
    //Without the image, the bug does not show up
    WImage* image=new WImage("Blue rectangle.jpg",topDiv1);     //?? Image is rendered across the div boundary!

    //Three buttons are added to containers 2,3, and 4. The one after the stretched element (topDiv3)
    //Is unclickable
    WPushButton *button2, *button3, *button4;
    button2=new WPushButton(WString("Button 2"),topDiv2);       //Clickable
    button3=new WPushButton(WString("Button 3"),topDiv3);       //Clickable
    button4=new WPushButton(WString("Button 4"),topDiv4);       //Unclickable!!
}

Files

Blue_rectangle.jpg (8.4 KB) Blue_rectangle.jpg Peter K, 11/27/2011 01:14 AM
CssStyleSheet.css (110 Bytes) CssStyleSheet.css Peter K, 11/27/2011 01:14 AM
Firefox_result.png (17.8 KB) Firefox_result.png Firefox, Chrome and Safari - image misrendered, unclickable button Peter K, 11/28/2011 07:11 PM
IE9_result.png (18.5 KB) IE9_result.png IE9 - no bug Peter K, 11/28/2011 07:11 PM
#1

Updated by Koen Deforche over 13 years ago

  • Status changed from New to InProgress
  • Assignee set to Koen Deforche
  • Target version set to 3.2.0

Updated by Peter K over 13 years ago

#3

Updated by Koen Deforche over 13 years ago

  • Target version changed from 3.2.0 to 3.2.1
#4

Updated by Koen Deforche over 13 years ago

  • Status changed from InProgress to Feedback
#8

Updated by Koen Deforche over 13 years ago

  • Status changed from Feedback to Resolved
#9

Updated by Koen Deforche about 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF