Re: "changed" signal




On Mar 5, 2005, at 9:39 AM, Ari Jolma wrote:

muppet wrote:

Indeed, because "changed" is one of Gtk2::Adjustment's signals, not a Gtk2::Scale's.

Also, the "changed" signal means that the properties of the adjustment have changed -- e.g. the max value, the min


yes, actually I'm trying to catch the "resize-window" event, i.e., when the user resizes the window, the scrollbar is also resized and its page_size changes...

mea culpa, i misunderstood you.

i think the reason you weren't seeing a "changed" signal when the widget resized is that the max and min were not changing. for the increments, i'm not sure.

by the way, the configure-event is sent from X when the window is resized or moved. for a general gtk widget, the way to hook into this is the size-allocate signal, which is emitted when the size calculations are performed and the widget is given a new allocation (actual size).

anyway, I think I'm going back to inherit my custom widget from ScrolledWindow (which I got working) and not reinvent that from scratch just to insert Rulers nicely..

ah, you didn't want an hscale, you wanted an hscrollbar.

i've implemented scrolled widgets in C; there's a deficiency in the bindings that makes it impossible to implement natively scrolled widgets in perl --- you can't set the set-scroll-adjustments-signal variable in the class. it should still be possible, however, to implement a scrolling container (which i've also done only in C) in perl.


In my custom widget I have an image, which I make on the fly. I also can't seem to make the widget support flexible resizing of the window, this also works in ScrolledWindow.

"flexible resizing"?

do you mean scaling the image to whatever size the window is? hook into the size-allocate signal and use Gtk2::Gdk::Pixbuf::scale_simple and Gtk2::Gtk::Image::set_from_pixbuf to show the image at the size of the window.

do you mean shrink the widget below the size of the image? in size-allocate, set the size request to be something small, e.g. 0,0.

--
If I lived in Teletubby Land, the homicide rate would be four.
  -- elysse




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]