Project

General

Profile

Bug #5012

[3.3.6-rc2] PlaceholderText of WInPlaceEdit

Added by Стойчо Стефанов Stoycho Stefanov over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
06/30/2016
Due date:
% Done:

0%

Estimated time:

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

placeholder.png (2.73 KB) placeholder.png Стойчо Стефанов Stoycho Stefanov, 06/30/2016 04:57 PM
#1

Updated by Koen Deforche over 6 years ago

  • Status changed from New to InProgress
  • Assignee set to Roel Standaert
#2

Updated by Koen Deforche over 6 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);
#3

Updated by Стойчо Стефанов Stoycho Stefanov over 6 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

#4

Updated by Koen Deforche over 6 years ago

  • Status changed from Feedback to Implemented @Emweb
  • Assignee set to Koen Deforche

I've implemented the changes in WInPlaceEdit that you suggested.

#5

Updated by Koen Deforche over 6 years ago

  • Status changed from Implemented @Emweb to Closed

Also available in: Atom PDF