Re: Resize event

Julien Moutinho <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <20080108124402.GA28864@localhost>
On Tue, Jan 08, 2008 at 10:14:34AM +0000, Jon Harrop wrote:
> Hi!
Hi!

> I've got a window with a drawable area in it that I'm blitting a pixmap into.
> However, I'd like to resize the pixmap when the window/drawable gets resized.
> How do I hook into that event?
#misc#connect#size_allocate may be what you're looking for:

% lablgtk2
        Objective Caml version 3.10.1+rc2

# let w = GWindow.window ();;
val w : GWindow.window = <obj>
# let print_rect
    { Gtk
    . x      = x
    ; y      = y
    ; width  = width
    ; height = height
    } =
      print_endline
        (Printf.sprintf
          "{ x = %i; y = %i; width = %i; height = %i }"
          x y width height)
  ;;
val print_rect : Gtk.rectangle -> unit = <fun>
# w#misc#connect#size_allocate
    ~callback: print_rect;;
- : GtkSignal.id = <abstr>
# w#show ();;
{ x = 0; y = 0; width = 200; height = 200 }
- : unit = ()
# GMain.main ();;
{ x = 0; y = 0; width = 260; height = 267 }
{ x = 0; y = 0; width = 260; height = 267 }
{ x = 0; y = 0; width = 445; height = 374 }
{ x = 0; y = 0; width = 445; height = 374 }
{ x = 0; y = 0; width = 278; height = 185 }
{ x = 0; y = 0; width = 278; height = 185 }
{ x = 0; y = 0; width = 106; height = 115 }
{ x = 0; y = 0; width = 106; height = 115 }
{ x = 0; y = 0; width = 1; height = 1 }
{ x = 0; y = 0; width = 1; height = 1 }

HTH.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.