From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA24356 for caml-redist; Fri, 28 Apr 2000 12:09:20 +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 EAA13923 for ; Fri, 28 Apr 2000 04:13:09 +0200 (MET DST) Received: from tkb.mpl.com (tkb.mpl.com [198.77.4.83]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id EAA20668 for ; Fri, 28 Apr 2000 04:13:09 +0200 (MET DST) Received: from tkb.mpl.com (IDENT:tkb@tkb.mpl.com [198.77.4.83]) by tkb.mpl.com (8.9.3/8.9.3) with ESMTP id WAA10284; Thu, 27 Apr 2000 22:12:46 -0400 From: "T. Kurt Bond" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14600.62365.447085.191856@tkb.mpl.com> Date: Thu, 27 Apr 2000 22:12:45 -0400 (EDT) To: Jacques Garrigue Cc: tkb@tkb.mpl.com, caml-list@pauillac.inria.fr Subject: Re: LablTk in Objective Caml 3.00 In-Reply-To: <20000428092226C.garrigue@kurims.kyoto-u.ac.jp> References: <14599.19299.666187.535414@tkb.mpl.com> <20000428092226C.garrigue@kurims.kyoto-u.ac.jp> X-Mailer: VM 6.75 under Emacs 20.4.1 Sender: weis T. Kurt Bond (that would be me) wrote: > I noticed that all the ?width options and ?height options for things > like Label.create and Canvas.create have type int; Why don't these > actually have type Tk.units so that one can specify them in any of the > normal Tk screen units: Inches, Millimeters, Centimeters, Points, or > Pixels, just like you can using raw Tcl/Tk or OcamlTk ? Jacques Garrigue writes: > The answer is in the LablTk section of the manual: > > 27.1 Module Tk: basic functions and types for LablTk > Dimensions > type units = [`Pix int|`Cm float|`In float|`Mm float|`Pt float] > val pixels : units -> int > Converts various on-screen units to pixels, respective to the > default display. Available units are pixels, centimeters, inches, > millimeters and points Yes, I'd found Tk.pixels. > Having to write units always explicitly was just a pain. This way you > can either write directly in pixels, or convert from another unit. I guess it's a matter of taste; I always found it helpful that it encouraged one to use screen-independent values like points instead of pixels, and I didn't mind specifying the units. Actually, since I rarely specify raw pixel values in code, the conversion using one of the pixels functions is actually more annoying, since I have to write, for instance, (pixels (`Pt 72)) instead of just (`Pt 72). > There is a very small glitch: if your application is intended to run > on several displays with different dpi's, you must use the > Winfo.pixels or Winfo.fpixels functions. That's a good point I hadn't thought about. Anyway, thanks for the explanation. (I found out it's easy enough to switch, btw, even though I don't fully understand tkcompiler: just change the definitions of "option Height" and "option Width" in Widgets.src from [_; int] to [_;units] and change one place in ocamlbrowser, I think, and everything seems to recompile and work ok. I'll leave it alone, though, since it's the intended behavior.) -- T. Kurt Bond, tkb@tkb.mpl.com