Re: [xul-interop] Updating window title

"Alexandre Giuseppe de Fuccio Pereira" <[email protected]> Fri, 2 Mar 2007 02:07:16 -0300
Newsgroups gmane.comp.lang.xul.general
Message-ID <[email protected]>
--===============1037905261==
Content-Type: multipart/alternative; 
	boundary="----=_Part_83054_13439484.1172812036162"

------=_Part_83054_13439484.1172812036162
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hey Christophe, thanks for the answer.

The example you gave me does not work when wrapped by a setInterval call.

Here is the function in my javascript file:
***********************
1. function updateTime () {
2.     var win = document.getElementById("mywindow");
3.     var lbl = document.getElementById("mylabel");
4.     elapsed = elapsed + 1;
5.     var time = maketime( elapsed );
6.     win.setAttribute("title", time);
7.     lbl.value = time;
8. }
9. setInterval('updateTime()',1000);

*************************
The label is updated, but the title isn't.

Weird stuff:
- If I change line 9 to updateTime(), the title is updated but the label
isn't.
- If I swap lines 6 and 7 and call updateTime() nothing happens.

Please, enlighten me!

-- Alexandre Giuseppe de Fuccio Pereira.






2007/3/1, Christophe Charron <[email protected]>:
>
> Hi,
>
> 2007/3/1, Alexandre Giuseppe de Fuccio Pereira <
> [email protected]>:
> >
> > Hi folks,
> >
> > I'm trying to build my first XUL application and I can't find how to
> > update a window title.
> >
> > I've tried:
> >
> > document.title = "new title";
> >
> > element = document.getElementById ("window");
> > element.title = "new title"
> >
> > How can I do that?
>
>
>
> The following code works :
> **********************
> <?xml version="1.0"?>
> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
> <window id="yourwindow" title="old title" xmlns="
> http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
> <script type="text/javascript">
> <![CDATA[
> function pf_change_title(){
> var win=document.getElementById("yourwindow");
> win.setAttribute("title","Here is the new title, yeah !!");
>
> }
> ]]>
> </script>
> <label value="Put your XUL here!"/>
> <button label="change window title" oncommand="pf_change_title();"/>
> </window>
> ***************************
>
>
> Thanks,
> > -- Alexandre Giuseppe de Fuccio Pereira
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys-and earn cash
> >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > XUL News Wire      - http://xulnews.com
> > XUL Job Postings   - http://xuljobs.com
> > Open XUL Alliance - http://xulalliance.org
> > _______________________________________________
> > xul-talk mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/xul-talk
> >
> >
> --
> Cordially,
> Christophe Charron
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> XUL News Wire      - http://xulnews.com
> XUL Job Postings   - http://xuljobs.com
> Open XUL Alliance - http://xulalliance.org
> _______________________________________________
> xul-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xul-talk
>
>

------=_Part_83054_13439484.1172812036162
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hey Christophe, thanks for the answer. <br><br>The example you gave me does not work when wrapped by a setInterval call. <br><br>Here is the function in my javascript file:<br>***********************<br>1. function updateTime () {
<br>2. &nbsp; &nbsp; var win = document.getElementById(&quot;mywindow&quot;);<br>3.&nbsp; &nbsp;&nbsp; var lbl = document.getElementById(&quot;mylabel&quot;);<br>4.&nbsp; &nbsp;&nbsp; elapsed = elapsed + 1;<br>5.&nbsp; &nbsp;&nbsp; var time = maketime( elapsed );<br>6.&nbsp; &nbsp;&nbsp; win.setAttribute
(&quot;title&quot;, time); <br>7.&nbsp; &nbsp;&nbsp; lbl.value = time;<br>8. }<br>9. setInterval(&#39;updateTime()&#39;,1000);<br><br>*************************<br>The label is updated, but the title isn&#39;t.<br><br>Weird stuff:<br>- If I change line 9 to updateTime(), the title is updated but the label isn&#39;t.
<br>- If I swap lines 6 and 7 and call updateTime() nothing happens.<br><br>Please, enlighten me!<br><br>-- Alexandre Giuseppe de Fuccio Pereira.<br><br><br><br><br><br><br><div><span class="gmail_quote">2007/3/1, Christophe Charron &lt;
<a href="mailto:[email protected]">[email protected]</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br><div><span class="gmail_quote">2007/3/1, Alexandre Giuseppe de Fuccio Pereira &lt;<a href="mailto:[email protected]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">[email protected]
</a>&gt;:</span><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi folks,<br><br>I&#39;m trying to build my first XUL application and I can&#39;t find how to update a window title. <br><br>I&#39;ve tried:<br><br>document.title = &quot;new title&quot;;<br><br>element = document.getElementById


(&quot;window&quot;); <br>element.title = &quot;new title&quot;<br><br>How can I do that?</blockquote></span><div><br><span class="q"><br>The following code works :<br>**********************<br>&lt;?xml version=&quot;1.0
&quot;?&gt;<br>&lt;?xml-stylesheet href=&quot;chrome://global/skin/&quot; type=&quot;text/css&quot;?&gt;
<br>&lt;window id=&quot;yourwindow&quot; title=&quot;old title&quot; xmlns=&quot;<a href="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul</a>&quot;&gt;
<br>&lt;script type=&quot;text/javascript&quot;&gt;<br>&lt;![CDATA[<br>function pf_change_title(){<br>var win=document.getElementById(&quot;yourwindow&quot;);<br>win.setAttribute(&quot;title&quot;,&quot;Here is the new title, yeah !!&quot;);
<br><br>}<br>]]&gt;<br>&lt;/script&gt;<br>&lt;label value=&quot;Put your XUL here!&quot;/&gt;<br>&lt;button label=&quot;change window title&quot; oncommand=&quot;pf_change_title();&quot;/&gt;<br>&lt;/window&gt;<br>***************************
<br>&nbsp;</span></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><span class="q">Thanks,<br><span>-- Alexandre Giuseppe de Fuccio Pereira
<br>
</span><br></span><span class="q">-------------------------------------------------------------------------<br>Take Surveys. Earn Cash. Influence the Future of IT<br>Join SourceForge.net&#39;s Techsay panel and you&#39;ll get the chance to share your
<br>opinions on IT &amp; business topics through brief surveys-and earn cash<br><a href="http://www.techsay.com/default.php?page=join.php&amp;p=sourceforge&amp;CID=DEVDEV" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://www.techsay.com/default.php?page=join.php&amp;p=sourceforge&amp;CID=DEVDEV</a><br>_______________________________________________<br>XUL News Wire &nbsp; &nbsp; &nbsp;- <a href="http://xulnews.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://xulnews.com</a><br>XUL Job Postings &nbsp; - <a href="http://xuljobs.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://xuljobs.com</a><br>Open XUL Alliance - <a href="http://xulalliance.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://xulalliance.org</a><br>_______________________________________________<br>xul-talk mailing list<br><a href="mailto:[email protected]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
[email protected]
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/xul-talk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.sourceforge.net/lists/listinfo/xul-talk</a><br><br></span></blockquote>

</div><br>-- <br>Cordially,<br><span class="sg">Christophe Charron
</span><br>-------------------------------------------------------------------------<br>Take Surveys. Earn Cash. Influence the Future of IT<br>Join SourceForge.net&#39;s Techsay panel and you&#39;ll get the chance to share your
<br>opinions on IT &amp; business topics through brief surveys-and earn cash<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.techsay.com/default.php?page=join.php&amp;p=sourceforge&amp;CID=DEVDEV" target="_blank">
http://www.techsay.com/default.php?page=join.php&amp;p=sourceforge&amp;CID=DEVDEV</a><br>_______________________________________________<br>XUL News Wire &nbsp; &nbsp; &nbsp;- <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://xulnews.com" target="_blank">
http://xulnews.com</a><br>XUL Job Postings &nbsp; - <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://xuljobs.com" target="_blank">http://xuljobs.com</a><br>Open XUL Alliance - <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://xulalliance.org" target="_blank">
http://xulalliance.org</a><br>_______________________________________________<br>xul-talk mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:[email protected]">[email protected]
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.sourceforge.net/lists/listinfo/xul-talk" target="_blank">https://lists.sourceforge.net/lists/listinfo/xul-talk</a><br><br></blockquote>
</div><br>

------=_Part_83054_13439484.1172812036162--


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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--===============1037905261==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
XUL News Wire      - http://xulnews.com
XUL Job Postings   - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org  
_______________________________________________
xul-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xul-talk

--===============1037905261==--