Version française
Home     About     Download     Resources     Contact us    
Browse thread
Objective Caml 3.00 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: LablTk in Objective Caml 3.00
From: "T. Kurt Bond" <tkb@tkb.mpl.com>

> 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 ? 

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

Having to write units always explicitly was just a pain. This way you
can either write directly in pixels, or convert from another unit.
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.

---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>