I got something like this - off hand I think you need an AlignTop flag
when you add the layout (or something like that)

A.

2009/5/5 Rogier Schouten <[email protected]>:
> Hi,
>
>
>
> Below is a simple application that shows a WTable. When a table item is
> clicked, a popup is shown with another WTable.  It is meant to be a
> drop-down menu eventually.
>
>
>
> Strangely enough, when the popup is shown, the table starts to increase its
> size whenever any signal is emitted (by anyone).  This only happens in
> FireFox, not in IE.
>
> The problem disappears when I put the WTable directly in the main layout,
> instead of wrapping it in a WContainerWidget and a WBoxLayout.
>
>
>
> Does anyone have any idea what is happening here? What am I missing?
>
>
>
> I’m using Wt 2.2.4.  And yes, I know that using mouseWentOut to hide a
> pop-up is not going to work this way J. This is just a condensed example of
> the problem.
>
>
>
> Regards,
>
> Rogier
>
>
>
>
>
>
>
>
>
>
>
>
>
> #include <Wt/WApplication>
>
> #include <Wt/WContainerWidget>
>
> #include <Wt/WText>
>
> #include <Wt/WBoxLayout>
>
> #include <Wt/WTable>
>
> #include <Wt/WBorder>
>
>
>
> using namespace Wt;
>
>
>
> class ExampleApplication : public WApplication
>
> {
>
> public:
>
>   ExampleApplication(const WEnvironment& env);
>
>
>
> private:
>
>       WContainerWidget* mSubMenu;
>
>
>
>       void onItemClicked();
>
>       void onMouseWentOut(const WMouseEvent& e);
>
> };
>
>
>
> ExampleApplication::ExampleApplication(const WEnvironment& env)
>
>   : WApplication(env)
>
> {
>
>    WBoxLayout* lMainLayout = new WBoxLayout(WBoxLayout::TopToBottom);
>
>    lMainLayout->setSpacing(0);
>
>    root()->setLayout(lMainLayout);
>
>
>
>    WContainerWidget* lMenuContainer = new WContainerWidget(root());
>
>    lMainLayout->addWidget(lMenuContainer, 0);
>
>
>
>    WBoxLayout* lMenuLayout = new WBoxLayout(WBoxLayout::LeftToRight,
> lMenuContainer);
>
>
>
>    WTable* lTable = new WTable(lMenuContainer);
>
>    lTable->decorationStyle().setBorder(WBorder(WBorder::Inset,
> WBorder::Thin, WColor("black")));
>
>    lMenuLayout->addWidget(lTable, 0);
>
>
>
>    WText* lItem1 = new WText("Item 1");
>
>    lTable->elementAt(0, 0)->addWidget(lItem1);
>
>    lItem1->clicked.connect(SLOT(this, ExampleApplication::onItemClicked));
>
>
>
>    WText* lItem2 = new WText("Item 2");
>
>    lTable->elementAt(0, 1)->addWidget(lItem2);
>
>
>
>    WText* lItem3 = new WText("Item 3");
>
>    lTable->elementAt(0, 2)->addWidget(lItem3);
>
>
>
>    lTable->columnAt(0)->setWidth(WLength(125));
>
>    lTable->columnAt(1)->setWidth(WLength(125));
>
>    lTable->columnAt(2)->setWidth(WLength(125));
>
>    lTable->rowAt(0)->setHeight(WLength(20));
>
>
>
>    mSubMenu = new WContainerWidget(lTable->elementAt(0, 1));
>
>    mSubMenu->setPositionScheme(Absolute);
>
>    mSubMenu->setPopup(true);
>
>    mSubMenu->mouseWentOut.connect(SLOT(this,
> ExampleApplication::onMouseWentOut));
>
>    mSubMenu->hide();
>
>
>
>    WTable* lTable2 = new WTable(mSubMenu);
>
>    lTable2->decorationStyle().setBorder(WBorder(WBorder::Inset,
> WBorder::Thin, WColor("black")));
>
>    mSubMenu->addWidget(lTable2);
>
>    lTable2->elementAt(0, 0)->addWidget(new WText("sub 1"));
>
>    lTable2->elementAt(0, 1)->addWidget(new WText("sub 2"));
>
>    lTable2->elementAt(0, 2)->addWidget(new WText("sub 3"));
>
>
>
>    lTable2->columnAt(0)->setWidth(WLength(125));
>
>    lTable2->rowAt(0)->setHeight(WLength(20));
>
>    lTable2->rowAt(1)->setHeight(WLength(20));
>
>    lTable2->rowAt(2)->setHeight(WLength(20));
>
>
>
>    lMainLayout->insertStretch(1, 1);
>
> }
>
>
>
> void ExampleApplication::onItemClicked()
>
> {
>
>    mSubMenu->show();
>
> }
>
>
>
> void ExampleApplication::onMouseWentOut(const WMouseEvent& e)
>
> {
>
>       if (e.widget().x < 0 || e.widget().y < 0)
>
>       {
>
>          mSubMenu->hide();
>
>       }
>
> }
>
>
>
> WApplication *createApplication(const WEnvironment& env)
>
> {
>
>   return new ExampleApplication(env);
>
> }
>
>
>
> int main(int argc, char **argv)
>
> {
>
>   return WRun(argc, argv, &createApplication);
>
> }
>
>
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to