Re: Signals and Slots question...

Andrew Tetlaw <[email protected]> Mon, 7 Mar 2005 09:26:54 +1000
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <OFB659B96E.7BC49FCC-ON4A256FBC.00805790-4A256FBC.0080D107@bvn.com.au>
This is a multipart message in MIME format.
--===============1930420855==
Content-Type: multipart/alternative; 
	boundary="=_alternative 0080D1064A256FBC_="

This is a multipart message in MIME format.
--=_alternative 0080D1064A256FBC_=
Content-Type: text/plain; charset="US-ASCII"

Don't forget that with all those standard DOM event handlers there's an 
accessible event object. And because of the way sigslots works, that event 
object will automagically be passed to the connected function you write.

In an event object the standard browser DOM has properties that point to 
the target DOM element. So maybe you could do it that way? It would enable 
you to get a handle to the field without an intermediary function.

_____________
Andrew Tetlaw

Bligh Voller Nield
http://www.bvn.com.au
P: (07) 3251 5778
F: (07) 3852 2544

[email protected] wrote on 07/03/2005 04:15:02 AM:

> Hi all!
> 
> I've got a series of forms based on rows returned from a database, all 
> being created dynamically. There is one form for each row in the 
> database. For one of the fields, I need to execute some javascript 
> (onBlur, onFocus, whatever). This JS is common for all rows, but affects 

> only the field the user currently has selected (i.e. maybe it converts 
> the text entered to upper case or whatever -- the actual action is 
> immaterial).
> 
> The upshot is I kind of need access to "this" for a particular event-- 
> i.e. the context in which the event is firing.
> 
> The only thing I've been able to figure out is to create a "pre" signal 
> first for each field that sets a global variable to point to the current 

> context:
> i.e.:
> declare this globally:
> var CURRENT_FIELD;
> 
> and then for each field do something like this:
> __sig__.connectByName( domNode, "onfocus", null, __sig__.setAnonFunc( 
> new Function( "", "CURRENT_FIELD = 
> document.forms['formname'].elements['fieldname'];")));
> 
> (where this is output for each field, and formname/fieldname is set as 
> appropriate.
> 
> Is there a better/easier way to do this?
> 
> thanks!
> 
> rob.
> 
> 
> _______________________________________________
> The netWindows developers list: [email protected]
> http://netwindows.org/mailman/listinfo/devel_netwindows.org


<font face="Arial, Helvetica, sans-serif" size="2">
<b>
Please Note
</b>This document, including attachments, is only intended for the addressees and may contain privileged or confidential information. Unauthorised use, copying or distribution of the document or any part of its contents, is prohibited. If you receive this Email in error please notify us by return Email or telephone. We will reimburse you for any reasonable expenses incurred in meeting this request.</font> 


--=_alternative 0080D1064A256FBC_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Don't forget that with all those standard
DOM event handlers there's an accessible event object. And because of the
way sigslots works, that event object will automagically be passed to the
connected function you write.</font>
<br>
<br><font size=2 face="sans-serif">In an event object the standard browser
DOM has properties that point to the target DOM element. So maybe you could
do it that way? It would enable you to get a handle to the field without
an intermediary function.</font>
<br>
<br><font size=2 face="sans-serif">_____________<br>
Andrew Tetlaw<br>
<br>
Bligh Voller Nield<br>
http://www.bvn.com.au<br>
P: (07) 3251 5778<br>
F: (07) 3852 2544</font>
<br>
<br><font size=2><tt>[email protected] wrote on 07/03/2005 04:15:02
AM:<br>
<br>
&gt; Hi all!<br>
&gt; <br>
&gt; I've got a series of forms based on rows returned from a database,
all <br>
&gt; being created dynamically. There is one form for each row in the <br>
&gt; database. For one of the fields, I need to execute some javascript
<br>
&gt; (onBlur, onFocus, whatever). This JS is common for all rows, but affects
<br>
&gt; only the field the user currently has selected (i.e. maybe it converts
<br>
&gt; the text entered to upper case or whatever -- the actual action is
<br>
&gt; immaterial).<br>
&gt; <br>
&gt; The upshot is I kind of need access to &quot;this&quot; for a particular
event-- <br>
&gt; i.e. the context in which the event is firing.<br>
&gt; <br>
&gt; The only thing I've been able to figure out is to create a &quot;pre&quot;
signal <br>
&gt; first for each field that sets a global variable to point to the current
<br>
&gt; context:<br>
&gt; i.e.:<br>
&gt; declare this globally:<br>
&gt; var CURRENT_FIELD;<br>
&gt; <br>
&gt; and then for each field do something like this:<br>
&gt; __sig__.connectByName( domNode, &quot;onfocus&quot;, null, __sig__.setAnonFunc(
<br>
&gt; new Function( &quot;&quot;, &quot;CURRENT_FIELD = <br>
&gt; document.forms['formname'].elements['fieldname'];&quot;)));<br>
&gt; <br>
&gt; (where this is output for each field, and formname/fieldname is set
as <br>
&gt; appropriate.<br>
&gt; <br>
&gt; Is there a better/easier way to do this?<br>
&gt; <br>
&gt; thanks!<br>
&gt; <br>
&gt; rob.<br>
&gt; <br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; The netWindows developers list: [email protected]<br>
&gt; http://netwindows.org/mailman/listinfo/devel_netwindows.org<br>
</tt></font><FONT SIZE=3><BR>
<BR>
<font face="Arial, Helvetica, sans-serif" size="2"><BR>
<b><BR>
Please Note<BR>
</b>This document, including attachments, is only intended for the addressees and may contain privileged or confidential information. Unauthorised use, copying or distribution of the document or any part of its contents, is prohibited. If you receive this Email in error please notify us by return Email or telephone. We will reimburse you for any reasonable expenses incurred in meeting this request.</font> <BR>
</FONT>

--=_alternative 0080D1064A256FBC_=--


--===============1930420855==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============1930420855==--