Re: Transforming argument from signal to slot

Sebastian Werner <[email protected]> Thu, 03 Jun 2004 18:37:53 +0200
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <[email protected]>
Alex Russell schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Wednesday 02 June 2004 11:39 am, Sebastian Werner wrote:
> 
>>Hi!
> 
> 
> Hello, welcome to the list!
> 
> 
>>I read the signals-and-slots documention already and ask me know if
>>it's possible to transform the argument from the signal-function to
>>the slot-function. I didn't find anything yet.
> 
> 
> It's been something I've looked at on-and-off for a couple of years, 
> but haven't actually implemented yet.
> 
> 
>>One Example:
>>
>>I create a select-element
>>
>><select name="foo">
>>   <option value="hotel">hotel</option>
>>   <option value="plane">plane</option>
>>   <option value="car">car</option>
>></select>
>>
>>and I create a Layer which should also be only visible if "car" is
>>selected.
>>
>>Both elements are single objects which don't know anything from
>>each other. The select-element has a property "selection" which
>>set/get the current selection. The Layer has a property "display",
>>which is equal to the so named css-property. My simple thought was
>>that I am able to connect the "setSelection" function to the
>>"setDisplay" function and transform the value on the way:
>>
>>selection:
>>hotel       => none
>>plane       => none
>>car         => block
>>
>>Is something like this possible or planned? Some mapping of values
>>or real transformation (math, ...).
> 
> 
> This is entirely possible, but I guess I'd want to know a little bit 
> more about what kind of calling semantics you'd want for this. I can 
> see a situation where you might want to specify a function object to 
> transform one (or more) arguments in a sigslot connection, so what 
> kinds of situations do you see this being common in?

ok, I think that this transformation should be defined with the 
establishment of the connection. I have a few ideas of transformation 
action. One could be to define a function and add it to the parameters.

__sig__.connectByName(o1, f1, o2, f2, function(x) { return x*2 });

or something of internal mapping:

__sig__.connectByName(o1, f1, o2, f2, [[ "hotel", "plane", "car" ], [ 
"none", "none", "block"]]);

I currently have no idea how to allow this with multiple arguments. WE 
could use an array for this fifth connectByName argument...

Best Regards

Sebastian Werner



> 
> Regards
> 
> - -- 
> Alex Russell
> [email protected]   BD10 7AFC 87F6 63F9 1691 83FA 9884 3A15 AFC9 61B7
> [email protected] F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Darwin)
> 
> iD8DBQFAvtrioV0dQ6uSmkYRAqy3AJ9hwLhiKf+cTcUgLgIYfuOA4ma2jwCePjBe
> q4wlnUl5Vv6fHaQxXBz3Gn0=
> =7RGT
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> The netWindows developers list: [email protected]
> http://netwindows.org/mailman/listinfo/devel_netwindows.org
> 


_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org