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. var win = document.getElementById("mywindow");<br>3. var lbl = document.getElementById("mylabel");<br>4. elapsed = elapsed + 1;<br>5. var time = maketime( elapsed );<br>6. win.setAttribute
("title", time); <br>7. lbl.value = time;<br>8. }<br>9. setInterval('updateTime()',1000);<br><br>*************************<br>The label is updated, but the title isn't.<br><br>Weird stuff:<br>- If I change line 9 to updateTime(), the title is updated but the label isn'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 <
<a href="mailto:[email protected]">[email protected]</a>>:</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 <<a href="mailto:[email protected]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">[email protected]
</a>>:</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'm trying to build my first XUL application and I can't find how to update a window title. <br><br>I've tried:<br><br>document.title = "new title";<br><br>element = document.getElementById
("window"); <br>element.title = "new title"<br><br>How can I do that?</blockquote></span><div><br><span class="q"><br>The following code works :<br>**********************<br><?xml version="1.0
"?><br><?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<br><window id="yourwindow" title="old title" xmlns="<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>">
<br><script type="text/javascript"><br><![CDATA[<br>function pf_change_title(){<br>var win=document.getElementById("yourwindow");<br>win.setAttribute("title","Here is the new title, yeah !!");
<br><br>}<br>]]><br></script><br><label value="Put your XUL here!"/><br><button label="change window title" oncommand="pf_change_title();"/><br></window><br>***************************
<br> </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's Techsay panel and you'll get the chance to share your
<br>opinions on IT & business topics through brief surveys-and earn cash<br><a href="http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV</a><br>_______________________________________________<br>XUL News Wire - <a href="http://xulnews.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://xulnews.com</a><br>XUL Job Postings - <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's Techsay panel and you'll get the chance to share your
<br>opinions on IT & 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&p=sourceforge&CID=DEVDEV" target="_blank">
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV</a><br>_______________________________________________<br>XUL News Wire - <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://xulnews.com" target="_blank">
http://xulnews.com</a><br>XUL Job Postings - <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==--