Project

General

Profile

How to setWordWrap for a WText element in WTable?

Added by Axel Sjöberg about 4 years ago

Hello,

I have a table with a long text:

table~~elementAt(row, column)~~>addWidget(std::make_unique("Long text that wraps around sometimes"));

How do I call setWordWrap(false) for the WText element i just created? Or what would be the correct way to keep the rows in my table from wrapping around?

Br,

Axel


Replies (1)

RE: How to setWordWrap for a WText element in WTable? - Added by lm at about 4 years ago

I would probably use CSS to achieve the result, but if you want to use setWordWrap, you'll need to get a handle to the Wt::WText you just created like so:

auto text{std::make_unique<Wt::WText>("Long text")};
text->setWordWrap(false);
table->elementAt(row, column)->addWidget(std::move(text));
    (1-1/1)