Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How are boxObject's and XBL controls connected? (Or: how to create your own boxObject type)

1 view
Skip to first unread message

Jaywalker

unread,
Jun 15, 2009, 2:04:31 PM6/15/09
to
Hey,

I have created a special type of listbox, which extends listbox_base,
just like the normal xul listbox does.

listbox is using a special boxObject (nsIListBoxObject), but I still
don't understand how the listbox is connected to it. It is not done in
the XBL (neither in listbox_base nor in listbox), and I also didn't
find the place where it is connected in mozilla-central.

My problem is, that my own listbox - due to using the "normal"
boxObject - will fully load all items (images and labels), even though
they may not be not visible, which gives me a big performance impact
on long lists, due to loading all images.

I believe nsIListBoxObject is more intelligent then this.

So, I guess I have to write my own box object type. But how will I
connect it to my XBL control??

Any ideas?

Thanks a lot!
Cheers.

Neil Deakin

unread,
Jun 15, 2009, 3:31:29 PM6/15/09
to
Jaywalker wrote:
> Hey,
>
> I have created a special type of listbox, which extends listbox_base,
> just like the normal xul listbox does.
>
> listbox is using a special boxObject (nsIListBoxObject), but I still
> don't understand how the listbox is connected to it. It is not done in
> the XBL (neither in listbox_base nor in listbox), and I also didn't
> find the place where it is connected in mozilla-central.
>
> My problem is, that my own listbox - due to using the "normal"
> boxObject - will fully load all items (images and labels), even though
> they may not be not visible, which gives me a big performance impact
> on long lists, due to loading all images.

The boxObject doesn't do anything itself. It's main use is to provide
access to apis implemented natively.

I think what you are actually wanting is to use display="xul:listbox" or
just ensure that the special listbox you've created just has the same
tag 'listbox' (and 'listitem' and so forth).

Boris Zbarsky

unread,
Jun 15, 2009, 5:54:33 PM6/15/09
to
Jaywalker wrote:
> My problem is, that my own listbox - due to using the "normal"
> boxObject - will fully load all items (images and labels), even though
> they may not be not visible, which gives me a big performance impact
> on long lists, due to loading all images.

Note that I still plan to remove the code in listbox that normally skips
doing that; if you need performance on long lists, you should probably
be using a tree...

-Boris

Jaywalker

unread,
Jun 16, 2009, 6:13:20 AM6/16/09
to
> Note that I still plan to remove the code in listbox that normally skips
> doing that; if you need performance on long lists, you should probably
> be using a tree...
>
> -Boris

What I am actually trying is to create a list-fileview, just like
Windows Explorer has, meaning: columns of small lists (with a
horizontal overflow if there are many items). See this pic:

http://www.sevenforums.com/attachments/tutorials/4641d1234515443-file-folder-arrangement-change-windows-explorer-window-list.jpg

Essentially it is nothing, but a big list that is separated into
columns. that is, why I extended listbox_base, as it provides list-
functionality without implying how the list looks.

Although tree supports multiple columns, it doesn't support multiple
selection of cells, what would be needed for this.

I further investigated the display="xul:listbox" thing from Neil
Deakin's answer to find out about frames and that these are actually
doing what I thought the boxObject does, namely drawing
intelligently.
So one solution might be to create my own nsIFrame.

On the other side, it might also be possible, that my column-list-
thing is just a container of multiple trees. For this case, I would
need to extend/replace the eventhandlers, so that the trees are
treated as one big list. But then the question still is: will a tree
only load the items that are visible, or will it also load items, if
itself is not visible at the moment (what would be the case for a
column that is outside of the view)?

Every hint would be helpful!

Thank you!

Neil

unread,
Jun 16, 2009, 10:19:09 AM6/16/09
to
Jaywalker wrote:

>My problem is, that my own listbox - due to using the "normal" boxObject - will fully load all items (images and labels), even though they may not be not visible, which gives me a big performance impact on long lists, due to loading all images.
>

It's actually the <listboxbody> that does this. Are you using one?

--
Warning: May contain traces of nuts.

Jaywalker

unread,
Jun 22, 2009, 11:56:54 AM6/22/09
to

No, I am not using a listboxbody. I also doubt it will work, as my
list control is more complicated than the normal list. see my answer
to Boris Zbarsky.

Guess I have to dig into Frames and such.

Thanks.

0 new messages