Re: [gtk-list] Gtk/Perl Viewport question



On Sun, Jul 18, 1999 at 08:16:04AM -0400, Michael Benedict wrote:
> and I can't figure out the correct
> syntax to initialize the viewport.  I
> tried to use something like
> 
>   $viewport_window = new Gtk::Viewport(
> undef, undef );
> 
> because a scrolled window is
> 
>   $scrolled_win = new
> Gtk::ScrolledWindow(undef, undef);
> 
> and I figured they should have similiar
> arguements.  I have looked all around,
> and so far the biggest hint of what to
> do came from perl's debugging statement,
> "Usage: Gtk::Viewport::new(Class,
> hadjustment, vadjustment) at my_file.pl
> line XX."  I can't really figure out
> what a valid Class would be and how best
> to declare it (and that is if I am
> interpreting the error correctly ;) ).

In the vesrion available from the gnome cvs I you can use
undef for both the adjustments in the Gtk::Viewport constructor.
Meanwhile you can create your own adjustments with something like:

$vadj = new Gtk::Adjustment(0, 0, 10, 0.1, 1, 1);

Class means that the first param to the function is (to put ii simply)
the module name: perl does it for you when you use the syntax:

	new Gtk::Adjustment(...);
or
	Gtk::Adjustment->new(...);


>     Before I get off the soapbox, I
> would also like to verify my theory in
> actually making the thing scroll. . .
> once I had the viewport, I would get its
> horizontal adjustment, pull it apart,
> and then increment the 'value' in it,
> then set the adjustment, all in a while
> loop, right?

You simply call $adj->set_value($new_value): the viewport should
update accordingly.
Anyway I think you should be using Gtk::ScrolledWindow for that kind
of stuff.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules



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