[Project_owners] listbox strange behavior?

MacCpp maccpp at yahoo.com.ar
Sun Feb 13 12:38:44 EST 2005


Neil:
       Thank you, so much thanks. Your help give me the solution, I add 
a call to listBox . ensureElementIsVisible ( ) and the functions do the 
correct work.
       Again, thanks. Mariano.

PS: here is the implementation for fill in a listbox well ( ; - D )....

function fillInScoList ( )
{

  for ( var i = new Number ( 0 ) ; i < aScoList . length ; i ++)
  {
    var scoList = window . document . getElementById ( 'scoList' );

    var text = window . document . createElement ( 'textbox' );
    text . setAttribute ( "id", "text_scoTitle_" + String ( i ) );
   
    var label1 = window . document . createElement ( 'label' );
    var label2 = window . document . createElement ( 'label' );
    var label3 = window . document . createElement ( 'label' );

    label1 . setAttribute ( "id", "label_1_" + String ( i ) );
    label1 . setAttribute ( "crop", "end" );
    label1 . setAttribute ( "value", aScoList [ i ] . realFolder );

    label2 . setAttribute ( "id", "label_2_" + String ( i ) );
    label2 . setAttribute ( "crop", "end" );
    label2 . setAttribute ( "value", aScoList [ i ] . baseFolder );

    label3 . setAttribute ( "id", "label_3_" + String ( i ) );
    label3 . setAttribute ( "crop", "end" );
    label3 . setAttribute ( "value", aScoList [ i ] . scoFolder );

    var cell1 = window . document . createElement ( 'listcell' );
    var cell2 = window . document . createElement ( 'listcell' );
    var cell3 = window . document . createElement ( 'listcell' );
    var cell4 = window . document . createElement ( 'listcell' );

    cell1 . appendChild ( label1 );
    cell2 . appendChild ( label2 );
    cell3 . appendChild ( label3 );
    cell4 . appendChild ( text   );

    var item = scoList . appendItem ( "sco" + String ( i ) );// this 
line make the diference ( ; - D )....

    scoList . ensureElementIsVisible ( item );

    item . appendChild ( cell1 );
    item . appendChild ( cell2 );
    item . appendChild ( cell3 );
    item . appendChild ( cell4 );

  }
}
//------------------------------

Neil wrote:

> MacCpp wrote:
>
>> Excuseme by my low english level.
>
>
> I've tried to shorten the explanation for you.
>
>> You can see the problem here 
>> http://www.handssolutions.com/mariano/idezilla/content/idezilla.xul 
>> then press on 'test 1'. And a script will fill in the listbox. And 
>> here, http://www.handssolutions.com/mariano/idezilla/whatIsWrong.jpg, 
>> that is a screen showing the problem that I have when I sroll down 
>> the list.
>
>
> Basically appendItem will only create the first cell for visible 
> items; for invisible items in singlecolumn lists the cell will be 
> created when the item is first made visible. For multicolumn lists you 
> should always create the item and append all the cells manually before 
> appending the item to the list.
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>




More information about the Project_owners mailing list