From: "Jun P. FURUSE" <Jun.Furuse@inria.fr>
To: Vincent.Poirriez@univ-valenciennes.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Camltk and Font_Size
Date: Thu, 20 Mar 2003 17:08:36 +0100 (CET) [thread overview]
Message-ID: <20030320.170836.112624831.Jun.Furuse@inria.fr> (raw)
In-Reply-To: <20030320154534.33e86727.Vincent.Poirriez@univ-valenciennes.fr >
Hello,
> a simple question concerning the Camltk API.
>
> What is the simplest way to specify the size of the font used in a widget.
>
> I've found Font_Size but when I try to use it, it raises Invalid_argument("Font_Size")
>
> I'll appreciate any indication.
> let q = Button.create top
> [Text "quit"; Font_Size 12;
> Command closeTk];;
> (* q exists but is not yet visible *)
This is since Font_Size is not a valid option for the button widget.
What you should do is:
1. define a font using Font_Size 12:
let font = Font.create [Font_Size 12]
2. At the creation of the button, specify this font using Font option:
let q = Button.create top
[Text "quit"; Font font;
Command closeTk];;
The options of Tk commands are gathered and form a huge type
Camltk.options in Camltk. But a widget class does not take all of them
as valid options, but only a small subset. The validity of tk options
is tested at run-time, and if an invalid option is found, Invalid_argument
exception is raised.
In LablTk, this problem is almost resolved, by replacing option lists
to labeled optional arguments.
To find out which options are valid for a widget class is either
* look the source code: otherlibs/labltk/Widgets.src defines the subsets
of valid options for each widget class.
* tk command manual
* or, look at the type of the corresponding LablTk function, which
details the set of possible options.
--
Jun
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2003-03-20 16:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-20 14:45 Vincent Poirriez
2003-03-20 16:08 ` Jun P. FURUSE [this message]
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=20030320.170836.112624831.Jun.Furuse@inria.fr \
--to=jun.furuse@inria.fr \
--cc=Vincent.Poirriez@univ-valenciennes.fr \
--cc=caml-list@inria.fr \
/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