Hey Michael,
2008/11/26 Michael Sørensen Loft <[EMAIL PROTECTED]>:
>> -----Original Message-----
>> From: Koen Deforche [mailto:[EMAIL PROTECTED]
>> > I don't know how to create the WMouseEvent. Can anyone here help me?
>>
>> You can use its default constructor.
>
> Silly me. Years of coding C# & Java made me think I could do:
> hiddenDownloadLogFileButton->clicked.emit(WMouseEvent myEvent);
>
> But in C++ one has do do:
> WMouseEvent mouseEvent;
> hiddenDownloadLogFileButton->clicked.emit(mouseEvent);
>
>
> I looks like the clicked.emit only triggers method connected on the server
> side.
> I have placed a bit of custom javascript on the hiddenDownloadLogFileButton
> by:
>
> JSlot* downloadLogFilesHandlerJS = new JSlot();
> downloadLogFilesHandlerJS->setJavaScript("window.open('"
> + logFilesAnchor->ref()
> + "', "
> "'download'); "
> "return false;");
> hiddenDownloadLogFileButton->clicked.connect(*downloadLogFilesHandlerJS);
The JavaScript should be "function() { window.open... }" ? I am a bit
surprised this works for you, but hey, it's JavaScript so there is
always some magic around the corner :-) ?
And, unless you are doing something else to manage the JSlot, you are
leaking it here?
> but the emit() method does not cause the javascript to be executed (but
> clicking the button manually does).
>
> Is there another way to trigger a piece of javascript from the server side?
You are probably looking for WApplication::doJavaScript().
Regards,
koen
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest