Project

General

Profile

Rotate just the Text in a WPushButton

Added by Volker Sahrhage about 6 years ago

Hi everybody,

I want to rotate the text of a WPushButton.

I do not want to rotate the whole button.

To rotate just the text I added a <span<>/span> to the button with the corresponding styles and defined it in the .xml resource file:

<message id="ActualMeasurementPage.UpperVertButton"><span style="-moz-transform:rotate(90deg); -moz-transform-origin: 40% 45%; -ms-transform:rotate(90deg); -ms-transform-origin: 40% 45%; -o-transform:rotate(90deg); -o-transform-origin: 40% 45%; -webkit-transform:rotate(90deg); -webkit-transform-origin: 40% 45%; transform:rotate(90deg); transform-origin: 40% 45%;  display: inline-block; horizontal-align: middle;">{1}</span></message>

The text to be shown, comes as parameter {1}.

In the source it is called as follows:

newButton->setText(Wt::WString::tr("ActualMeasurementPage.UpperVertButton").arg(tmpText));

This worked well with Wt 3.2.0. Now when updated to Wt 3.3.9 the whole is shown as text and is not interpreted as html.

Does anyone has a hint?

Greets

Volker


Replies (3)

RE: Rotate just the Text in a WPushButton - Added by Roel Standaert about 6 years ago

It was changed, because defaulting to XHTML text was not quite right. You should still be able to get that effect if you also set the text format to XHTML, so:

newButton->setTextFormat(Wt::XHTMLText);
newButton->setText(Wt::WString::tr("ActualMeasurementPage.UpperVertButton").arg(tmpText));

Regards,

Roel

    (1-3/3)