Bug #1899
closedPush Button with Popup Menu loses caret on text change.
0%
Description
Hello,
When a popup menu is attached to a push button a caret appears at the right of the push button text. But if the text is set explicitly using WPushButton::setText, after the popup menu is attached, the caret at the end of the push button text disappears. Following is a simple test:
<code class="cpp">
class TestApp : public WApplication
{
public:
TestApp(const WEnvironment& env)
: WApplication(env)
{
setTheme(new WBootstrapTheme());
m_pButton = new WPushButton("Test 0", root());
WPopupMenu *m = new WPopupMenu();
m->addItem("Test 1");
m->addItem("Test 2");
m->triggered().connect(this, &TestApp::UpdateButton);
m_pButton->setMenu(m);
}
protected:
void UpdateButton(WMenuItem *pMenuItem)
{
m_pButton->setText(pMenuItem->text());
}
private:
WPushButton *m_pButton;
};
</code>
Thanks and regards,
~Plug
Files
Updated by Plug Gulp over 11 years ago
I managed to fix the issue. But it is a hack rather than a clean solution. For a clean solution, I think, some work will be required to separate themes from content rendering e.g. in the Bootstrap theme the "caret" is treated as part of theme but renderer treats it as content. This discrepancy in handling of the UI artifacts causes bugs such as these. The problem is further complicated when themes do not support the same UI artifacts e.g. the caret is supported by Bootstrap but not by default theme.
Updated by Koen Deforche over 11 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.3.1
Hey,
Theme integration is necessarily a compromise between flexibility and keeping it simple. Rather than making the whole theme system more heavy, I've done something along your lines. Perhaps we will later migrate the caret trick into Wt entirely, or find a more general solution.
Regards,
koen
Updated by Koen Deforche over 11 years ago
- Status changed from Resolved to Closed