Bug #5012
closed[3.3.6-rc2] PlaceholderText of WInPlaceEdit
0%
Description
Hey,
until 3.3.5 the "emptyText" of a WInPlaceEdit wasn't rendered in the "lineEdit" widget and now it is (fear enough).
In my use case I use a XHTMLText format for the "textWidget" of the WInPlaceEdit, so that (only) the placeholder text is rendered "Italic":
edit_ = new Wt::WInPlaceEdit();
edit_->setButtonsEnabled(false);
edit_->setPlaceholderText(WString("<i>not avaliable</i>"));
edit_->textWidget()->setTextFormat(XHTMLText);
How could I ignore/remove the html tags of the "PlaceholderText" if the "lineEdit" is empty.
Regards,
Stoycho
Files
Updated by Koen Deforche over 8 years ago
- Status changed from New to InProgress
- Assignee set to Roel Standaert
Updated by Koen Deforche over 8 years ago
- Status changed from InProgress to Feedback
- Assignee deleted (
Roel Standaert) - Priority changed from Normal to High
I'm not entirely sure how to resolve this in the library. But can you not work around the issue like below?
edit_ = new Wt::WInPlaceEdit();
edit_->setButtonsEnabled(false);
edit_->setPlaceholderText(WString("<i>not avaliable</i>"));
edit_->linedEdit()->setPlaceholderText(WString::Empty);
edit_->textWidget()->setTextFormat(XHTMLText);
Updated by Стойчо Стефанов Stoycho Stefanov over 8 years ago
Hey,
In order to make this work around really work, you have to distinguish between the place holder of the WInPlaceEdit's "textWidget" and that of the "lineEdit", because in the current implementation you have a single place holders due to:
const WString& WInPlaceEdit::placeholderText() const
{
return edit_->placeholderText();
}
The following do the trick:
...
WString textPlaceHolder_;
...
void WInPlaceEdit::setPlaceholderText(const WString& text)
{
textPlaceHolder_ = text;
edit_->setPlaceholderText(text);
if (empty_)
text_->setText(text);
}
const WString& WInPlaceEdit::placeholderText() const
{
return textPlaceHolder_;
}
regards,
Stoycho
Updated by Koen Deforche over 8 years ago
- Status changed from Feedback to Implemented @Emweb
- Assignee set to Koen Deforche
I've implemented the changes in WInPlaceEdit that you suggested.
Updated by Koen Deforche over 8 years ago
- Status changed from Implemented @Emweb to Closed