In my main.js I have a code like this

/*************************************************/

var listBox;

function button1_onClick()
{
        var division = view.appendElement('<div/>');
        division.height='40%';
        division.width='85%';
        division.background='#FF0000';
        division.x=20;
        division.y=196;
        listBox = view.appendElement('<listbox/>');
        listBox.autoscroll = true;
        listBox.background= '#FFFFFF';
        listBox.height = '38%';
        listBox.width = '83%';
        listBox.itemOverColor = '#FF00FF';
//listBox.selectedIndex = -1;
        listBox.x = 21;
        listBox.y=200;
        for(var i=0;i< 12;i++)
        {
             var header = listBox.appendElement('<listitem/>');
             header.background = '#FFFFFF';
             header.height = '20%';
             header.width = '100%';
             header.x = 22;
             header.y= 203;
             header.onclick = listBoxOnClick;
             listBoxHeader(header, '10','Something');
        }
}
function listBoxOnClick()
{
  //listBox.selectedIndex = -1;
        view.alert(listBox.selectedIndex);
        listbox.selectedIndex = -1;
        //view.alert(lsitBox.selectedItem);
}
function listBoxHeader(header,x,text)
{
        var label = header.appendElement('<label/>');
        label.height = 18;
        label.width = '80%';
        label.innerText = text ;
        label.x = x;
}

/******************************************************/
and, in main.xml consists

/*********************************************************/
<view height="350" width="250">
 <img height="356" src="stock_images\background.png"/>
  <button height="22" name="button1" width="84" x="152" y="121"
onclick="button1_onClick()"
    downImage="stock_images\button_down.png" image="stock_images
\button_up.png"
    overImage="stock_images\button_over.png" caption="Click to Add"/>
  <script src="main.js" />
</view>
/***********************************************/

on execution
which produces a dynamic 'listbox' with listitems of length 12  on a
'div', on image. Now when am trying to click on a listitem to know
seletedIndex its showing serial numbers but on every next click
(that is if i click on first index it showing index as -1 and if i
click on last index it showing index as 0 and again when and clicking
on some middle item in the list it showing 1 but not getting
appropriate index number )



Please, can anyone solve and explain where am I doing mistake.....?????

-- 
You received this message because you are subscribed to the Google Groups 
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-desktop-developer?hl=en.

Reply via email to