From: Stalkern 2 Reply-To: stalkern2 at tin.it To: lablgtk at kaba.or.jp Subject: Re: clists, packing beyond viewport, gtk notebook Date: Wed, 28 May 2003 16:53:59 +0200 References: <200305231742.54903.stalkern2 at tin.it> <20030524101032B.garrigue at kurims.kyoto-u.ac.jp> In-Reply-To: <20030524101032B.garrigue at kurims.kyoto-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305281654.00057.stalkern2 at tin.it> Il Saturday 24 May 2003 03:10, Jacques Garrigue ha scritto: > From: Stalkern 2 > > > I'm (still) in GTK 1.2 and I'm using clists. > > I found out that clists are discarded in GTK2 but I don't know why yet. > > Just because the new tree widget is more powerful :-) > But it may be a good idea to put them back in lablgtk2, as APIs are > very different. > > > 1) I'm looking for putting a sorting callback on the TITLES: before I > > start working on it for a week, I'd like to ask ;-) is it feasible with > > lablgtk? is there any code that I should read? I see some sorting > > functions but I still have to try them out and in any case I still have > > to see the whole thing in practice. > > I remember doing it once, but I don't remember where is my code :-) > Basically you just have to use the #set_sort method, but you have only > lexicographical sort. (GTK2 allows defining you own sorting function) Yes, found! I was a bit disappointed because as a user I always meet with clists with arrows, and now I was suddenly de-arrowed (...) > > > 2) Right now, 'm looking for a lablgtk-ish translation of the following: > > (a FAQ from http://www.gtk.org/faq/ ) > > ------------------------------------------------------------------------- > >--------------- 6.2. How do I stop the column headings of a GtkCList > > disappearing when the list is scrolled? > > > > > > How do I stop the column headings of a GtkCList disappearing when the > > list is scrolled? > > > > > > This happens when a GtkCList is packed into a GtkScrolledWindow using the > > function gtk_scroll_window_add_with_viewport(). The prefered method of > > adding a CList to a scrolled window is to use the function > > gtk_container_add, as in: > > > > > > GtkWidget *scrolled, *clist; > > char *titles[] = { "Title1" , "Title2" }; > > > > scrolled = gtk_scrolled_window_new(NULL, NULL); > > > > clist = gtk_clist_new_with_titles(2, titles); > > gtk_container_add(GTK_CONTAINER(scrolled), clist); > > For me the direct translation works: > let scrolled = GBin.scrolled_window () > let clist = GList.clist ~titles:["Title1";"Title2"] ~packing#scrolled#add > () > > Of course, if you have already put something in the scrolled window, > > you must remove it first, otherwise you get an error: > > exception Gtk.Error ("GContainer.container#add: already full") That's it. First time in my life that I see a scrolled Window without a viewport, but it works. Fine. Thank you very much. > > > > 3) Another question: is the use GTK notebook a bad GTK > > practice? I found it out by chance, so I'm wondering if it's clumsy > > somehow. > > Why? If it's there, I suppose it can be used, no? Well, I'll consider this finding as a matter of luck ;-) Thank you again Ernesto