Project

General

Profile

Access to "style" field on element definition

Added by Ricardo Cunha over 2 years ago

I’m looking for some way to set the “style” field on html item definition.

I know there are some functions on wt that add fields to the style statement but I’m not sure they do full customization.

Example:

From:

To:
<input
id="ouxonuk" flg="0" name="ouxonuk" size="10" type="text" value="10" class="form-control"
style="flex: 1 1 auto;overflow: hidden;height: 22px; border-top-color: red; border-bottom-color: blue; border-left-color: green;"

In this example I added to style “border-top-color: red; border-bottom-color: blue; border-left-color: green;”.

In fact, independent of the text added to the style field, I would like to have direct access to add text to “style= ”.

I could do that overriding the “updateDom” method (see below), but the documentation warning on use DomElement (internal, subject to changes).

virtual void updateDom(Wt::DomElement& element,bool all) override {
WPushButton::updateDom(element,all);
if (all) element.setProperty(Wt::Property::Style,"outline: none;padding: 0px;");
}

Any tips?


Replies (1)

RE: Access to "style" field on element definition - Added by Ricardo Cunha over 2 years ago

Missing text:
From:
<input
id="ouxonuk" flg="0" name="ouxonuk" size="10" type="text" value="10" class="form-control"
style="flex: 1 1 auto; overflow: hidden; height: 22px;"

    (1-1/1)