[Gtk-sharp-list] Scrollbar.MoveSlider

Scott Ellington scottellington at comcast.net
Wed Nov 9 11:21:36 EST 2005


Hi,

Below is some simple code that tries to catch a MoveSlider event on a
Scrollbar.  I expect that when the scrollbar is adjusted, this event
will trigger.  It seems to not.  Am I missing something?

thanks.
Scott

---------------

using System;
using Gtk;

class SliderSample
{
	static void Main ()
	{
		new SliderSample ();
	}

	SliderSample ()
	{
		Application.Init ();
		Window win = new Window ("SliderSample");
		win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
		win.SetDefaultSize (400, 400);

		Adjustment a = new Adjustment (30,0,100,1,5,20);
		VScrollbar vs = new VScrollbar (a);
		vs.MoveSlider += new MoveSliderHandler (ScrollbarAdjusted);

		win.Add (vs);
		win.ShowAll ();
		Application.Run ();
	}

	void OnWinDelete (object obj, DeleteEventArgs args)
	{
		Application.Quit ();
	}

	void ScrollbarAdjusted (object o, MoveSliderArgs args)
	{
		Console.WriteLine("Scrolled: " + args.Scroll);
	}
} 



More information about the Gtk-sharp-list mailing list