Re: [xul-interop] Updating window title
"Christophe Charron" <[email protected]> Fri, 2 Mar 2007 08:31:18 +0100
| Newsgroups | gmane.comp.lang.xul.general |
|---|---|
| Message-ID | <[email protected]> |
--===============1108976006== Content-Type: multipart/alternative; boundary="----=_Part_89109_3924464.1172820678714" ------=_Part_89109_3924464.1172820678714 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, It works and I say that because i saw it in Firebug ( http://www.getfirebug.com/) but i think you can't see it in the browser? Is the view refreshed ? -- Cordially Christophe 2007/3/2, Alexandre Giuseppe de Fuccio Pereira <[email protected] >: > > 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 > > > > > > ------------------------------------------------------------------------- > 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 > > -- Cordialement Christophe Charron ------=_Part_89109_3924464.1172820678714 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,<br>It works and I say that because i saw it in Firebug (<a href="http://www.getfirebug.com/">http://www.getfirebug.com/</a>) but i think you can't see it in the browser? Is the view refreshed ?<br><br>-- <br>Cordially <br>Christophe <br><br><div><span class="gmail_quote">2007/3/2, Alexandre Giuseppe de Fuccio Pereira <<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;"> 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]" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">[email protected]</a>>:</span><div><span class="e" id="q_111110be3479cb21_1"><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><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><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>Thanks,<br><span>-- Alexandre Giuseppe de Fuccio Pereira <br> </span><br></span><span>-------------------------------------------------------------------------<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>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 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></blockquote> </span></div></div><br> <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><br clear="all"><br>-- <br>Cordialement<br>Christophe Charron ------=_Part_89109_3924464.1172820678714-- --===============1108976006== 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 --===============1108976006== 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 --===============1108976006==--