Custom type for WJavascriptHandle
Added by Cemal DEMİR about 2 months ago
Hi Can we produce a class that assignable to WJavascriptHandle.
[error] "Wt: fatal error: Can't assign a value to an invalid handle!"
these is a some usefull class such as "WPointF , WPainterPath ..." but i need a client side draw text/string to canvas
WPaintedWidget does not accepted to add to WJavaScriptObjectStorage jsObjects_; just like WJavaScriptHandle createJSPoint();
should recompile library for adding this?
header below, complete attached.
class WJavascriptText : public WJavaScriptExposableObject
{
public:
WJavascriptText();
WJavascriptText( const std::string &str);
WJavascriptText( const WJavascriptText &other );
WJavascriptText &operator=( const WJavascriptText &other );
bool operator==( const WJavascriptText &other );
bool operator!=( const WJavascriptText &other );
// WJavaScriptExposableObject interface
public:
virtual std::string jsValue() const override;
void setString(const std::string &newString);
std::string string() const;
protected:
virtual void assignFromJSON(const Json::Value &value) override;
private:
std::string m_string;
};
thanks
WJavascriptText.zip (1.08 KB) WJavascriptText.zip |
Replies (1)
RE: Custom type for WJavascriptHandle - Added by Matthias Van Ceulebroeck 25 days ago
Hello Cemal,
I do see your point, as it would be more convenient than the alternative of defining some fairly custom JS to pass the values between where it is entered (WLineEdit
for example), and where it ought to be drawn.
The issue is tracked by #12940.
Best,
Matthias