From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA27588; Thu, 20 Mar 2003 17:08:39 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 RAA27824 for ; Thu, 20 Mar 2003 17:08:38 +0100 (MET) Received: from madiran.inria.fr (madiran.inria.fr [128.93.8.77]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h2KG8bX07816 for ; Thu, 20 Mar 2003 17:08:37 +0100 (MET) Received: from madiran.inria.fr ([128.93.8.77] helo=localhost ident=furuse) by madiran.inria.fr with esmtp (Exim 3.35 #1 (Debian)) id 18w2aq-0001Jt-00; Thu, 20 Mar 2003 17:08:36 +0100 Date: Thu, 20 Mar 2003 17:08:36 +0100 (CET) Message-Id: <20030320.170836.112624831.Jun.Furuse@inria.fr> To: Vincent.Poirriez@univ-valenciennes.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Camltk and Font_Size From: "Jun P. FURUSE" In-Reply-To: <20030320154534.33e86727.Vincent.Poirriez@univ-valenciennes.fr > References: <20030320154534.33e86727.Vincent.Poirriez@univ-valenciennes.fr > X-URL: http://pauillac.inria.fr/~furuse/ X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; furuse:01 caml-list:01 font:99 api:01 widget:01 closetk:01 run-time:01 labltk:01 otherlibs:01 widgets:01 command:98 raises:01 exists:01 commands:97 exception:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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