Project

General

Profile

A problem finding Wt::Signals::connection while customizing a WInPlaceEdit widget

Added by Kirill Brutyev about 10 years ago

Hi,

I'd like to customize the WInPlaceEdit widget so that I can use WTextArea in addition to WLineEdit.

All I did for now is replaced WLineEdit with WTextArea. I ran into a problem while compiling.

In WInPlaceAreaEdit.hpp, I have:

....
private:
Signal<WString> valueChanged_;
WContainerWidget *impl_, *editing_;
WText *text_;
WString emptyText_;
WTextArea *edit_;
WPushButton *save_;
WPushButton *cancel_;
Wt::Signals::connection c1_;
Wt::Signals::connection c2_;
bool empty_;
....

output of my cmake:

[ 6%] Building CXX object source/CMakeFiles/../../main.wt.dir/WInPlaceAreaEdit.cpp.o
In file included from /home/kirill/wt/estore/source/WInPlaceAreaEdit.cpp:7:0:
/home/kirill/wt/estore/source/WInPlaceAreaEdit.hpp:150:3: error: ‘Signals’ in namespace ‘Wt’ does not name a type
Wt::Signals::connection c1_;


I tried looking in the documentation but can't figure out how where is Wt::Signals. The documentation says it's defined in cmake file and is a wrapper around either boost signal or boost signal2.


Replies (3)

RE: A problem finding Wt::Signals::connection while customizing a WInPlaceEdit widget - Added by Kirill Brutyev about 10 years ago

ok, kind of fixed it.

I looked at WObject and added the following lines from there to the hpp file:

@#if defined(WT_USE_BOOST_SIGNALS)

#include <boost/signals/trackable.hpp>

#include <boost/signal.hpp>

namespace Wt {

namespace Signals {

using boost::signal;

using boost::signal0;

using boost::signal1;

using boost::signal2;

using boost::signal3;

using boost::signal4;

using boost::signal5;

using boost::signal6;

using boost::signals::trackable;

using boost::signals::connection;

using boost::signals::at_front;

}

}

#elif defined(WT_USE_BOOST_SIGNALS2)

#include <boost/signals2/trackable.hpp>

#include <boost/signals2.hpp>

namespace Wt {

namespace Signals {

using boost::signals2::signal;

using boost::signals2::trackable;

using boost::signals2::connection;

using boost::signals2::at_front;

// Note: signal0-6 are not available in signals2 if the compiler supports

// variadic templates

}

}

#endif@

then I just commented out one of them.

it worked. the only problem the width and the height of the edit field is not the same as of the view field

RE: A problem finding Wt::Signals::connection while customizing a WInPlaceEdit widget - Added by Koen Deforche about 10 years ago

Hey,

W.r.t. Signals: since WInPlaceAreaEdit.hpp includes WObject (indirectly through WCompositeWidget?) I am surprised you got this error in the first place? Or is it because you are basing your WInPlaceAreaEdit.hpp on a WInPlaceEdit of a more recent Wt version?

To make the edit size itself to the available size, you will need to use a layout manager.

Regards,

koen

RE: A problem finding Wt::Signals::connection while customizing a WInPlaceEdit widget - Added by Kirill Brutyev about 10 years ago

you are correct. that was the case. I used the more recent WInPlaceEdit header file in older wt version that I have on my fedora.

thanks for the tip about the layout manager. I ended up changing the size manually. but i'll use the layout manager on the next iteration of the code.

    (1-3/3)