Project

General

Profile

Adding an Image to a WPushButton

Added by Paul T... 11 months ago

Hello,

I'd like to put an image instead of text using a WPushbutton in Wt 3.... but each time I try to do something such as m_pButton[bb]->setIcon(pcFilePath); (with pcFilePath being for example "/etc/images/button_1.jpg")

What am I doing wrong ?

Best,

Paul


Replies (1)

RE: Adding an Image to a WPushButton - Added by Matthias Van Ceulebroeck 11 months ago

Hello,

first of, my apologies for the belated reply.

If you are using a file that is served to the front-end, do make sure that its path is provided correctly against the application's docroot.
I.E. if your docroot is defined as /foo/bar, then it can find the file /foo/bar/biz.jpg if you have pcFilePath set to biz.jpg. If you would define the docroot as /foo for example, it will not be able to find the file.

Do also note that Wt 3 is outdated and no longer actively supported.

    (1-1/1)