Amerio.Stephane Posted June 20, 2023 Posted June 20, 2023 Well, I long for a UI rehaul, but in the meantime... WidgetGrid doesn't call Gui::ENTER or Gui::LEAVE callbacks. Normal? Fixable? Can we have Rich text on a Button? On a Label? How can I simulate that? (I need a first line in bold large font, second line in small font) An icon would be nice too... button->setToggled will trigger the Gui::CLICKED callback. Not really expected. I'd have expected the Gui::CHANGED callback to be called, not the CLICKED one. Thanks!
karpych11 Posted June 21, 2023 Posted June 21, 2023 Hello. Containers currently only check callbacks for their child widgets, so this cannot be fixed in application logic. For text in widget you can use setFontRich and rich text formatting Here is a small example: WidgetButtonPtr button = WidgetButton::create(); WindowManager::getMainWindow()->addChild(button); button->setFontRich(1); button->setText( "<p align=\"center\"><font size=\"20\" color=\"#ff0000\">big large font</font></p>" "<p align=\"center\"><font size=\"13\" color=\"#00ff00\">small font</font></p>" ); WidgetLabelPtr label = WidgetLabel::create(); WindowManager::getMainWindow()->addChild(label); label->setFontRich(1); label->setText( "Icon in text: <image src=\"my_icon.png\" x=%110 y=%40 scale_x=%80 scale_y=%80/>" );
Amerio.Stephane Posted June 21, 2023 Author Posted June 21, 2023 (edited) I notice a bug though. The intersection box of the button no longer matches the button, in some cases. Example below, multiple buttons in grid: the first buttons won't be clickable, and for the first clickable button its clickable area doesn't match the button. for(...) { auto button = WidgetButton::create(gui); button->setFontRich(true); button->setText( "<p><font size=\"16\">Dummy Title\xA0</font></p>" "<p><font size=\"10\">subtitle\xA0</font></p>"); box->addChild(button); box->arrange(); } Did I miss something? EDIT: I foudn out! We have a second interface in a detached window. If this window loses focus, then the GUI won't respond correctly in the main window. This may be due to the Gui::getCurrent() we use at the creation of the main interface. This issue is somewhat concerning... (but unrelated to Rich text) EDIT: if the second window was overlaying the main window, and it is minimized, then it still blocks all clicks as if it wasn't minimized. Looks defnitively like a bug. Hope it's fixed in 2.17... Edited June 21, 2023 by Amerio.Stephane
silent Posted June 22, 2023 Posted June 22, 2023 Hi Stephane, Unfortunately we have no time to fix this in 2.17. We need to spend some additional resource for a proper reproduction and validation. If you can send us a minimal test scene that will show this bug - that would help a lot and probably we can include this fix in the upcoming hotfix update (or in 2.17.1). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts