Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Mattias Waldau <mattias@fforum.se>
To: caml-list@inria.fr
Subject: Typing problems when using LablGTK
Date: Sat, 3 Feb 2001 22:54:20 +0100	[thread overview]
Message-ID: <200102032154.f13LsK116451@fforum.se> (raw)


The first program works fine, but if I take the let button-part and move it to a separate
function called mini, the compilation fails. The type of the method attach is different.

What have I misunderstood?

/mattias

P.s. I learning GNOME using the book "Beginning GTK+/GNOME Programming", and sometimes it is
difficult to map GTK in C to LablGTK. I am on page 111.

Program 1, works.
=================

open GMain

let main () =
  let window = GWindow.window ~border_width:10 ~title:"Fun with tables" ~width:320 ~height:200 () in
  window#connect#destroy ~callback:Main.quit; 
  let table = GPack.table ~rows:10 ~columns:10 ~packing:window#add () in
  let button = GButton.button ~label:"test"
      ~packing:(table#attach ~left:2 ~top:2 ~expand:`BOTH) () in
(*  mini table; *)
  window#show ();
  Main.main ()

let _ = Printexc.print main ()


Program 2, fails
================

open GMain

let mini table : unit =
  GButton.button ~label:"mini"
    ~packing:(table#attach ~left:3 ~top:3 ~expand:`BOTH) ();
  ()

  
let main () =
  let window = GWindow.window ~border_width:10 ~title:"Fun with tables" ~width:320 ~height:200 () in
  window#connect#destroy ~callback:Main.quit; 
  let table = GPack.table ~rows:10 ~columns:10 ~packing:window#add () in
  mini table; 
  window#show ();
  Main.main ()

let _ = Printexc.print main ()



        Objective Caml version 3.00+20 (2000-12-03)

#                                   Characters 366-371:
This expression has type
  GPack.table =
    < add : GObj.widget -> unit; as_widget : Gtk.widget Gtk.obj;
      attach : int ->
               int ->
               ?right:int ->
               ?bottom:int ->
               ?expand:Gtk.Tags.expand_type ->
               ?fill:Gtk.Tags.expand_type ->
               ?shrink:Gtk.Tags.expand_type ->
               ?xpadding:int -> ?ypadding:int -> GObj.widget -> unit;
      children : GObj.widget list; coerce : GObj.widget;
      connect : GContainer.container_signals; destroy : unit -> unit;
      drag : GObj.drag_ops; focus : GContainer.focus; get_id : int;
      misc : GObj.misc_ops; remove : GObj.widget -> unit;
      set_border_width : int -> unit; set_col_spacing : int -> int -> unit;
      set_col_spacings : int -> unit; set_homogeneous : bool -> unit;
      set_row_spacing : int -> int -> unit; set_row_spacings : int -> unit >
but is here used with type
  < add : GObj.widget -> unit; as_widget : Gtk.widget Gtk.obj;
    attach : int -> int -> [> `BOTH] -> GObj.widget -> unit;
    children : GObj.widget list; coerce : GObj.widget;
    connect : GContainer.container_signals; destroy : unit -> unit;
    drag : GObj.drag_ops; focus : GContainer.focus; get_id : int;
    misc : GObj.misc_ops; remove : GObj.widget -> unit;
    set_border_width : int -> unit; set_col_spacing : int -> int -> unit;
    set_col_spacings : int -> unit; set_homogeneous : bool -> unit;
    set_row_spacing : int -> int -> unit; set_row_spacings : int -> unit >
# 



             reply	other threads:[~2001-02-04 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-03 21:54 Mattias Waldau [this message]
2001-02-04 23:09 ` Maxence
2001-02-05  3:05 ` Jacques Garrigue
2001-02-05 18:18   ` Mattias Waldau
2001-02-06  1:58     ` Jacques Garrigue

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=200102032154.f13LsK116451@fforum.se \
    --to=mattias@fforum.se \
    --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