Cannot set WPushButton::setLink()
Added by Mark Petryk over 4 years ago
I have called setLink() on pushbuttons during construction and it has always worked fine, but now I have moved code to set the link after construction. I can set the text, but setting the link doesn't appear to work;
2961 {
2962 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
2963
2964 auto imgFile = std::make_shared< PdfFileResource >( jobItem().id() ); // WFileResource to deliver up PDF
2965 auto link = Wt::WLink( imgFile );
2966 link.setTarget( Wt::LinkTarget::NewWindow );
2967 m_pbShowEstimate-> setLink( link ); // the link _does not_ get set here
2968
2969 m_pbShowEstimate-> setText( "this is a test" ); // the text _does_ change here
2970 }
So, previously, when the pushbutton was first constructed, and I set up the Link and it worked fine, but now I have an UI event that causes the particular link on this push button to change. I would have thought resetting the link just like resetting the text would result in the link being changed just like the text was changed.
Am I misunderstanding this?
~mark
Replies (1)
RE: Cannot set WPushButton::setLink() - Added by Mark Petryk over 4 years ago
I fixed this by binding the button in to a template, and any time I want to update the Link I just build a new button and bind it in newly.