qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
764 stars 260 forks source link

MenuButton in Window error layoutParent #10108

Closed rommni closed 1 month ago

rommni commented 3 years ago

Describe the bug When you try to add a qx.ui.menu.Button element in a qx.ui.window.Window you see in console an error during render, and the button doesn't seem to be render correctly

Playground link https://tinyurl.com/y3s4pl4f If you run the example and look at your dev console you will see the following error: qx.ui.core.queue.Layout: Error in the 'Layout' queue:TypeError: Cannot read property 'getLayoutParent' of null TypeError: Cannot read property 'getLayoutParent' of null

From my test it seems that maybe the error appear at the moment when ButtonLayout call the __getMenu function in renderLayout (qx/ui/menu/ButtonLayout.js:66)

Maybe we can add a check in __getMenu to check if widget is null however I don't know if it could cause other problems and I don't know if it's the problem itself or just a symptom of the problem

zaucker commented 3 years ago

It seems to me, the problem is adding a MenuButton not to a Menu, but to a Window. Seems a bit like driving a car not into a garage, but into a lake (for example).

rommni commented 3 years ago

OK ok I thought it was the correct way to add a button which show a menu when you click on it, how should I do that ?

zaucker commented 3 years ago

OK ok I thought it was the correct way to add a button which show a menu when you click on it, how should I do that ?

I am not sure anymore if my comment above is correct and it should be possible to add the MenuButton directly to the HBox() layout. Sorry about my flippant comment above.

However, this does work: https://tinyurl.com/yyesj34v (will need some layout adjustments). Unfortunately the demobrowser is broken right now, otherwise that would be a good place to check how this is intended to be done. Work is on the way to fix the demobrowser ...