Hello,

I have a bunch of WPushButtons and I want to call different Javascript
functions whenever the user clicks them. I was reading about the
WSignalMapper and I have a couple of questions.

1. If you pass the source object as the second argument of the
mapConnect method how do you determine in your slot which object is
that? I mean, can you do something like:

 if (source == btnOption1)

... inside the slot?


2. I am getting a bunch of template errors when I tried to pass an enum
value instead of the source object as the second argument of the
mapConnect method. What would be (if any) the correct way to do that?

Example:

enum {OPTION1, OPTION2}

and I want to do something like this:

mymap->mapConnect(btnOption1->clicked(), OPTION1}
mymap->mapConnect(btnOption2->clicked(), OPTION2}

3. In a different scenario, I want to connect my buttons with javascript
functions on the page. If I am correct, according to the docs you use a
JSlot object to do that. Now, you need to use the setJavaScrip method
which receives a string contains a javascript function with the
signature "function(sender,event)..."

If my functions are already in the webpage and changing their signature
is a pain in the ass, can I write a string like ...


#define WT_JS(...) #__VA_ARGS__
...
"function (sender,event){ " + WT_JS($(function(){myfunction();});) + "}"

Is there a shorter way to do this?

Thank you,

Diego


-- 

 Diego Cantor-Rivera
 Ph.D.Student in Biomedical Engineering, University of Western Ontario
 Imaging Research Laboratories, Robarts Research Institute
 P.O. Box 5015, 100 Perth Drive, London, ON, Canada N6A 5K8
 email: dcantor <at>imaging.robarts.ca
 Visit me at: http://bit.ly/dcantor/ <http://bit.ly/dcantor>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to