Date: Thu, 23 Mar 2006 20:54:10 +1100 From: Erik de Castro Lopo To: lablgtk at math.nagoya-u.ac.jp Subject: Request for advice (long) Message-Id: <20060323205410.5bb789f8.ocaml-erikd at mega-nerd.com> Organization: Erik Conspiracy Secret Labs Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Content-Length: 3102 Hi all, Yesterday, I posted a very much cut down version of what I was trying to achieve and Olivier Andrieu was kind enough to help me over a couple of hurdles. Unfortunately, it turns out that the cut down version of my problem actually didn't represent the problem very well, so I'm back to ask for some further advice :-). The project I'm working on is a graphical diff program. The idea is to load up two sightly different versions of the same source code file and have them displayed side by side with the differences highlighted. The main requirements for this are two panes of text, separated by a narrow drawing_area widget that has a representation of the full file. There also needs to be a single horizontal and single vertical scroll bar which will act simultaneously on both text widgets. After giving it a brief try, I don't think the scrolled_window container typesuggested by Olivier will work. The problem is that while it is possible to have the two text areas and the drawing area inside a scrolled_window I cannot figure out how to make the two text widgets appear stay at the same size regardless of the size of the parent window. While thinking about solutions, I have come up with a number of possibilities: - Use two scrolled_window widgets side by side, with the un-needed scrollbars hidden or disabled (not even sure if this is possible). If its not possible to hide the unused scrollbars, then they will need to be hooked up so that they act in unison (is this possible). - Write an Ocaml class that basically emulates a scrolled window with the two text areas and the drawing_area as child widgets. Hopefully this can be done in Ocaml without resorting to C. - Put the two text areas, the drawing area and the two scrollbars in a GPack.table and manually connect up the signals from the scrollbars to the two text areas as well as catch the parent window resize events so the size of two text areas can be kept roughly equal. - Writing a widget in C (hacked from gtk_scrolling_window) and then wrapping it in Ocaml. This is probably a poor choice because I'd prefer to code in Ocaml and I'd like to be able to recompile the program for all three major platforms. There are probably other options that I haven't thought of yet. So the questions I would like to ask the more experienced Ocaml/lablgtk2 hackers are: 0) Is there another possibl better option that I haven't thought of? 1) Which of the above possibilities is likely to give the results I'm after with the least amount of headaches? Thanks in advance. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ The idea that Bill Gates has appeared like a knight in shining armour to lead all customers out of a mire of technological chaos neatly ignores the fact that it was he who, by peddling second-rate technology, led them into it in the first place. - Douglas Adams in Guardian, 25-Aug-95