Hello Sven, As your method is called 'OnButtonClicked()', I guess that you want to start a file download in response to a click on a button. The easiest thing to do is either to replace the button with an WAnchor, or to put the button inside an anchor if you want to keep the visual appearance of the button. Bur if you want to defer the creation of your file (if it is dynamically created) to the moment that the user clicks the button, it becomes more complicated again: you'll need to specialize WResource and create the file in WResource::handleRequest() (when 'continuation' is false).
Another solution is to keep the code as it is now and simply add a call to WApplciation::redirect(resource->url()) to direct the browser to the WFileResource. Calling WAnchor->clicked().emit(..) invokes all slots previously connected to the clicked() signal (i.e. with WAnchor->clicked().connect(...)), and has no client-side effects. Best regards, Wim. 2010/9/16 Knoblich Sven <[email protected]>: > Hello, > i want to emit a WAnchor direct from code. Because of the use JavaScript and > HTML only i have to use the emit method from WAnchor. But when i call this > method (even with a delay of one second) nothing happens. The normal clicked > - event which is called from the user (by pressing the link) shows the > correct behavior. > > Mechanism: > void OnButtonClicked() > { > -Create WFileResource > -Create WAnchor > -WAnchor->clicked().emit( Wt::WMouseEvent()); > } > > Any idea? > > Many thanks in advance, > Sven > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
