From: "T. Kurt Bond" <tkb@tkb.mpl.com>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: tkb@tkb.mpl.com, caml-list@pauillac.inria.fr
Subject: Re: LablTk in Objective Caml 3.00
Date: Thu, 27 Apr 2000 22:12:45 -0400 (EDT) [thread overview]
Message-ID: <14600.62365.447085.191856@tkb.mpl.com> (raw)
In-Reply-To: <20000428092226C.garrigue@kurims.kyoto-u.ac.jp>
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
next prev parent reply other threads:[~2000-04-28 10:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-25 13:26 Objective Caml 3.00 released Xavier Leroy
2000-04-25 19:08 ` John Prevost
2000-04-26 7:00 ` Max Skaller
2000-04-27 8:17 ` what does "32-bit integer" mean? Xavier Leroy
2000-04-27 15:41 ` Paul A. Steckler
2000-04-28 2:07 ` John Max Skaller
2000-04-28 8:35 ` Xavier Leroy
2000-04-28 23:24 ` John Max Skaller
2000-04-26 9:55 ` Objective Caml 3.00 released Andreas Rossberg
2000-04-26 20:02 ` LablTk in Objective Caml 3.00 T. Kurt Bond
2000-04-28 0:22 ` Jacques Garrigue
2000-04-28 2:12 ` T. Kurt Bond [this message]
2000-04-26 21:35 ` Help: anyone knows what this error message means Friedman Roy
2000-04-27 13:39 ` Frank Atanassow
2000-04-27 17:01 ` Objective Caml 3.00 released Julian Assange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14600.62365.447085.191856@tkb.mpl.com \
--to=tkb@tkb.mpl.com \
--cc=caml-list@pauillac.inria.fr \
--cc=garrigue@kurims.kyoto-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox