Dynamically Adding Multi Column Listbox For Firefox Extensions XUL

File: multilistbox.js

//Write multi column listbox function populateListbox()      {      //Make an array      var myArray = new Array();      for(i=0;i<10 ;i=i+1)           {           //Make another array inside the original array           myArray[i] = new Array();           //Add some data into the first element of the sub array           myArray[i][0] = 'Cell A'+i;           //Add some data into the second element of the sub array           myArray[i][1] = 'Cell B'+i;           }            for (i=0;i
File: multilistbox.xul

<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://mgwalk_poster/skin/mgwalk_poster.css" type="text/css"?> <window id="listboxexample" title="Multi Column Listbox Example" height="230" width="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">      <script type="application/x-javascript" src="multilistbox.js"/>      <vbox>           <hbox>                <groupbox align="start">                     <caption label="Two Column Example"/>                     <hbox>                          <textbox id="txtcella" size="20"/>                          <textbox id="txtcellb" size="20"/>                     </hbox>                     <hbox>                          <listbox id="multicolumlistbox" rows="5" onselect="getSelected()" width="262">                               <listhead>                                    <listheader label="Cell A" width="131"/>                                    <listheader label="Cell B" width="131"/>                               </listhead>                           </listbox>                     </hbox>                </groupbox>           </hbox>           <hbox>                <button oncommand="populateListbox()">                     <description>Populate Listbox</description>                </button>           </hbox>      </vbox> </window>



Post a comment for www.mgwalk.com
 
Send your comment to www.mgwalk.com
 
Name:
Email:
Web Site:
Rating:
star blank star blank star blank star blank star blank (move mouse over star to select rating)
Comment:
Anti-spam word: (Required) *