From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA23821 for caml-red; Fri, 18 Aug 2000 13:14:54 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA06664 for ; Thu, 17 Aug 2000 11:57:46 +0200 (MET DST) Received: from faure.inria.fr (faure.inria.fr [128.93.12.23]) by nez-perce.inria.fr (8.10.0/8.10.0) with ESMTP id e7H9vkH29010 for ; Thu, 17 Aug 2000 11:57:46 +0200 (MET DST) Received: (from fleutot@localhost) by faure.inria.fr (8.10.0/8.10.0) id e7H9vkw07841; Thu, 17 Aug 2000 11:57:46 +0200 Date: Thu, 17 Aug 2000 11:57:46 +0200 Message-Id: <200008170957.e7H9vkw07841@faure.inria.fr> X-Authentication-Warning: faure.inria.fr: fleutot set sender to fabien.fleutot@inria.fr using -f From: Fabien Fleutot To: caml-list@inria.fr Subject: Scrolling canvases in LablTk 3.00 Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII Sender: weis@pauillac.inria.fr I can't figure how to add a scrollbar to a canvas; here is my code: ------------------------------------ open Tk open Printf let _ = let win = openTk() in let c = Canvas.create win ~width:2560 ~height:100 in let s = Scrollbar.create win ~orient:`Horizontal in (* draw clearer and clearer gray strips on the canvas. *) for i = 0 to 255 do let color = `Color (sprintf "#%02x%02x%02x" i i i) in ignore(Canvas.create_rectangle c ~x1:(i*10) ~x2:(i*10+10) ~y1:0 ~y2:99 ~fill:color) done ; Canvas.configure c ~xscrollcommand:(Scrollbar.set s) ; Scrollbar.configure s ~command:(Canvas.xview c) ; place c ~x:0 ~y:0; place s ~x:0 ~y:100 ~relwidth:1.; Wm.geometry_set win "300x125" ; mainLoop() ------------------------------------ The translator in the scrollbar uses 100% of the bar's width, instead of (300/2560) = 11.7%. using 'pack' intead of 'place' doesn't change amything, except that if I suppress the 'geometry_set', it creates a 2560 pixels wide window. Does anybody know what's wrong with that piece of code ?