I understand that WMenu is intendend for usage as a Web menu more like
a tab widget that shows/hides its child items one at a time.
Is it possible to use WMenu in a simular manner as Ext::Menu, ie
insert WPopupMenu's as children of a horizontal WMenu? Or should I
just forget about it and use Ext::Menu?
Currently trying to do the above, seems to uncover a bug:
Code (just changing hello example):
HelloWmenuApplication::HelloWmenuApplication(const WEnvironment& env)
: WApplication(env)
{
WStackedWidget *contents = new WStackedWidget();
WMenu *menu = new WMenu(contents, Horizontal);
WPopupMenu *popup = new WPopupMenu();
popup->addItem("Roof included")->setCheckable(true);
popup->addItem("Add a door")->setDisabled(true);
menu->addItem("Submenu", popup);
root()->addWidget(menu)
}
Above throws assert() menu->addItem(), the source of assert is as
follows, the WMenuitem() is derived from WObject, and tries to add the
widget passed to it as a child, by calling WObject::addChild(). if
child->parent_ is not NULL, WObject::addChild() tries to do
parent_->removeChild() first. This fails, because of the following:
Apparently WObject and WWidget both have child tracking functionality,
with methods named the same, addChild(), removeChild().
WWidget methods are virtual, and use different children_ list then WObject.
But both these classes share the parent_ member variable.. So if you added
WWidget as a parent to any other WWidget, it can not be re-parented to
a WObject such as WMenuItem(), because it gets confused by parent_ member
variable set, and asserts its in WObject's children_ list.
It seems if WWidget duplicates the child tracking functionality of WObject,
it should not reuse parent_ member variable of WObject? ;As this confuses all
WObject child tracking methods?
Regards,
Max
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest