Project

General

Profile

Actions

Bug #565

closed

How to use WObject::implementStateless(...)

Added by omair geetan about 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/20/2010
Due date:
% Done:

0%

Estimated time:

Description

Please Provide full working examples on Usage of these methods

WObject::implementStateless(..)

WObject::resetLearnedSlot()

WObject::implementJavaScript()

And how to use

WStatelessSlot

Actions #1

Updated by Koen Deforche about 14 years ago

  • Status changed from New to Resolved

Hey Omair,

This is complicated. The first thing to realize is when to use it: if you want to write JavaScript without writing JavaScript, i.e. if you want C to be automagically converted to JavaScript.

There is a tutorial dedicated to this: http://www.webtoolkit.eu/wt/doc/reference/html/example.html, which is included as the "tree" example in Wt.

There is now also a more convenient overload available of EventSignal::connect(const std::string&) which takes as argument a JavaScript function:

e.g.

clicked().connect("function() { alert('hello!'); }");

This is a more convenient alternative than JSlot when you do not need the automatic disconnect when the "receiver" goes out of scope. You shouldn't use WStatelessSlot API directly (it's not public API, although a pointer to it is referenced from WObject methods).

Note that stateless slot implementations are a mere optimisation to eliminate a server round trip for simple javascript updates. You are using them already since for example WWidget::show() is implemented in this way: if you connect WWidget::show() to e.g. a clicked() signal, then this is optimized in client-side JavaScript code.

Regards,

koen

Actions #2

Updated by Koen Deforche about 14 years ago

  • Status changed from Resolved to Closed

Fixed in 3.1.6

Actions

Also available in: Atom PDF