Re: Container performance



On Dec 1, 2007 10:57 AM, Junior Polegato - GTK+ & GTKmm <gtk juniorpolegato com br> wrote:
jcupitt gmail com escreveu:
> On 12/1/07, digicapt - gtk dev <gtk digicapt ch> wrote:
>
>> If you try following code, you'll see that filling a container with 4000
>> entries (first button) is about 20 times slower than filling a container with
>> 4000 labels (second button) : 1 seconds for labels on my PC, 20 seconds for
>> the edits.
>>
> Entries are just much, much more complicated. Creating 4000 edit
> widgets is always going to be slow.
> What you need to do is use a treeview instead, and have a editable as
> a cell renderer. Now it will display like a label (it should be even
> quicker than the label case), but when you click on an item, it will
> turn into an edit widget for the time that you are using it.
> Read about it here:
> http://library.gnome.org/devel/gtk/unstable/TreeWidgetObjects.html
> John

Hi,

      You can use this technical: insert the labels with formatation
like edit and control the mouse click and the tab key.


A Treeview is really what you will be wanting here, the question is
answered but I just wanted to add; Allocating a widget is effectively
allocating screen realestate - you dont want to go overboard with
how many actual widgets you are allocating for data display
(if you can only see 10 rows of data entry widgets, you should be
able to use a scrollbar just to change the data that those widgets
are displaying/editing, its not effective to allocate 10,000 rows of label,
button, entry etc and just put into a scrolled window, even if this
evil sounds a bit tempting ;-) ). Treeview widgets try to make this
task effective and optimized for displaying/editing dynamic and
potentially huge datasets, in some cases you might want to use
widgets instead and just update the contents - depending on
what visual effect you want to achieve or how huge your dataset
can potentially be.

Cheers,
           -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]