Actually, I just solved no. 1 and no. 3: I removed all resize() and
setMinimumSize() calls and used non-zero stretch factors everywhere:
lMainLayout->setColumnStretch(0, 20);
lMainLayout->setColumnStretch(1, 80);
lMainLayout->setRowStretch(0, 10);
lMainLayout->setRowStretch(1, 10);
lMainLayout->setRowStretch(2, 80);
Works like a charm in both FF and IE.
A potential problem I see with your approach is structuring your code. For
instance, if you want to make a complex control (containing layouts) that you
want to re-use, would you derive your control from WLayout or from WxxxWidget?
In the latter case, you still get layouts within widgets.
I never understand why GUI toolkits treat layouts different from widgets
anyway: why not have different container widgets that layout their children in
different ways?
Cheers,
Rogier
-----Original Message-----
From: Adrian Sutherland [mailto:[email protected]]
Sent: vrijdag 15 mei 2009 10:25
To: [email protected]
Subject: Re: [Wt-interest] FW: Layout blues
I have the same issues (esp 3).
Last night I had a brainwave that I was going to try next. Its taken
me a long time (being slow) but I think:
- If you are using CSS for positioning you should not use layouts -
but instead just use containers and style classes, resize() and CSS
etc.
- If you are NOT using CSS for positioning. You should use layouts.
This means that you should not really use container widgets. Instead
just use embedded layouts - i.e. layouts within layouts. In this case
setminsize() "should" work. You only use widgets once you get to the
lowest level and need to actually display something.
Anyway this is what I am going to try out this weekend.
What this implies is that my remarks about the stacked container is
not quite right; instead we need a "stacked layout" for use with non
CSS scenarios. And therefore menu and tab widgets that use the
stackedLayout rather than the stackedContainer.
It would be good to have a one page bit in the docs explaining this -
as it took me a long time to come to this conclusion.
The question is - of course - am I right or have I missed the point [again]?
Cheers
Adrian
2009/5/15 Rogier Schouten <[email protected]>:
> Oh, and here is the code...
>
>
>
> WGridLayout* lMainLayout = new WGridLayout(root());
>
>
>
> WContainerWidget* lGreen = new WContainerWidget();
>
> lGreen->addWidget(new WText("Green"));
>
> lGreen->setMinimumSize(WLength::Auto, WLength(100));
>
> lGreen->decorationStyle().setBackgroundColor(WColor("green"));
>
>
>
> WContainerWidget* lBlue = new WContainerWidget();
>
> lBlue->addWidget(new WText("Blue"));
>
> lBlue->setMinimumSize(50, 50);
>
> lBlue->decorationStyle().setBackgroundColor(WColor("blue"));
>
>
>
> WContainerWidget* lYellow = new WContainerWidget();
>
> lYellow->addWidget(new WText("Yellow"));
>
> lYellow->decorationStyle().setBackgroundColor(WColor("yellow"));
>
>
>
> WContainerWidget* lRed = new WContainerWidget();
>
> lRed->setMinimumSize(250, 400);
>
> lRed->addWidget(new WText("Red"));
>
> lRed->decorationStyle().setBackgroundColor(WColor("red"));
>
>
>
> WContainerWidget* lNavy = new WContainerWidget();
>
> lNavy->addWidget(new WText("Navy"));
>
> lNavy->decorationStyle().setBackgroundColor(WColor("navy"));
>
>
>
> lMainLayout->addWidget(lGreen, 0, 0, 1, 2, 0);
>
> lMainLayout->addWidget(lBlue, 1, 0, 1, 1, 0);
>
> lMainLayout->addWidget(lYellow, 1, 1, 1, 1, 0);
>
> lMainLayout->addWidget(lRed, 2, 0, 1, 1, 0);
>
> lMainLayout->addWidget(lNavy, 2, 1, 1, 1, 0);
>
>
>
> lMainLayout->setColumnStretch(0, 0);
>
> lMainLayout->setColumnStretch(1, 1);
>
>
>
> lMainLayout->setRowStretch(0, 0);
>
> lMainLayout->setRowStretch(1, 0);
>
> lMainLayout->setRowStretch(2, 1);
>
>
>
> ________________________________
>
> From: Rogier Schouten
> Sent: vrijdag 15 mei 2009 10:07
> To: '[email protected]'
> Subject: Layout blues
>
>
>
> Hi,
>
>
>
> I've tried WBoxLayouts, WBorderLayouts and WGridLayouts, read the manual ten
> times, played with Alignment flags, resize() and setMinimumSize(), and there
> is still something I'm not getting about layouts.
>
>
>
>
>
> The code below produces the attached pictures in Firefox and IE. I have
> several questions:
>
>
>
>
>
> 1) How can I make the YELLOW container stretch to fill its grid cell?
> According to the manual it should already, since I specified alignment=0 for
> GridLayout::addWidget(). However, it only stretches horizontally, not
> vertically.
>
>
>
>
>
> 2) How can I make IE take the minimum size of the WContainerWidgets
> into account? Currently it fits grid cells tightly arount the WTexts even
> though I specified a larget size for the container.
>
>
>
>
>
> 3) Is there a way to specify grid row / column widths as a percentage
> of the browser window? Setting percentages in setMinimumSize() does not
> appear to have any effect.
>
>
>
>
>
> Rogier
>
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest