Re: List view : no scroll bar and maximum length ?

Adrien <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hi again,

Thanks a lot. This has perfectly worked and even with 100 000 entries,
gui is fast.
However the list view is too short and only displays 3 elements at
once but I guess this is because I haven't yet taken time to tweak
anything. So I'll see that more precisely during the week.
Thanks again.


 ---

Adrien Nader

2008/2/4, Julien Moutinho <[email protected]>:
> On Mon, Feb 04, 2008 at 10:01:48PM +0100, Adrien wrote:
> > Hi,
> Hi,
>
> > I've written a small mp3 player during the week-end, mainly in order
> > to check whether it was possible to write a light and fast one with
> > lablgtk (I miss foobar2000's interface under linux).
> >
> > I've encountered some problems, especially with list view (which the
> > biggest difference between a foobar ui and a winamp one :
> > http://foobar2000.org/screenshots/img/main-simple.png.html )
> >
> > My interface looks like : http://ocaml.yaxm.org/files/blatere/pr11n.png
> > (1000 times the same file in order to see how it scaled)
> >
> > First, I don't have any scroll bar though my playlist is 1000 elements
> > long. I know there is the GRange module but I can't believe these
> > scroll bars are not automatic.
>
> Use a GBin.scrolled_window.
>
> % diff -u second_try.ml.old second_try.ml
> --- second_try.ml.old   2008-02-04 22:47:05.000000000 +0100
> +++ second_try.ml       2008-02-04 22:55:02.000000000 +0100
> @@ -39,7 +39,9 @@
>  let rank_column=playlist#add Gobject.Data.string
>  let fileinfo_column=playlist#add Gobject.Data.string
>
> -let playlist_view=GTree.view ~packing:vbox#pack ()
> +let sw = GBin.scrolled_window () ~packing: vbox#add
> +  ~hpolicy: `AUTOMATIC ~vpolicy: `AUTOMATIC
> +let playlist_view=GTree.view () ~packing:sw#add
>  let _=playlist_view#append_column (GTree.view_column ~title:"Rank" ~renderer:(GTree.cell_renderer_text [], ["text", rank_column]) ())
>  let _=playlist_view#append_column (GTree.view_column ~title:"File Info" ~renderer:(GTree.cell_renderer_text [], ["text", fileinfo_column]) ())
>
> > Second, if I create a 2000 elements-long playlist, my program crashes
> > with the following message:
> >   The program 'blatère' received an X Window System error.
> >   This probably reflects a bug in the program.
> >   The error was 'BadAlloc (insufficient resources for operation)'.
> >     (Details: serial 462 error_code 11 request_code 53 minor_code 0)
> >     (Note to programmers: normally, X errors are reported asynchronously;
> >      that is, you will receive the error a while after causing it.
> >      To debug your program, run it with the --sync command line
> >      option to change this behavior. You can then get a meaningful
> >      backtrace from your debugger if you break on the gdk_x_error() function.)
>
> It should not crash any longer once the scroll bar has been added.
>
> HTH.
>
> _______________________________________________
> Lablgtk mailing list
> [email protected]
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.