0

I'm trying to use a Monodevelop gtk# Toolbox item .dll that I built from the code of the Banshee project's "SeekSlider" widget. The code compiles successfully, and I am able to add it to Monodevelop's toolbox, and I'm able to then drop the SeekSlider widget onto a form but when I go to compile that code CS1729 gets thrown. Below is the code, I'm stumped on this one any help which could be provided would be greatly appreciated:

using System;
using Gtk;
using Mono.Unix;

namespace SeekSlider
{
    [System.ComponentModel.ToolboxItem(true)]
    public class SeekSlider : HScale
    {
        private uint timeout;
        private uint timeout_delay = 500;
        private bool can_seek;
        private bool raise_seek_requested;
        private bool can_set_value;
        private double pressed_x;

        public event EventHandler SeekRequested;
        public event EventHandler DurationChanged;

        public SeekSlider () : base (0.0, 0.0, 0.0)
        {
            UpdatePolicy = UpdateType.Continuous;
            DrawValue = false;

            raise_seek_requested = true;
            can_set_value = true;

            Adjustment.Lower = 0;
            Adjustment.Upper = 0;

            Accessible.Name = Catalog.GetString ("Seek");

            SetIdle ();
        }

        protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
        {
            can_set_value = false;
            if (evnt.Button == 1) {
                pressed_x = evnt.X;
            }
            return base.OnButtonPressEvent (evnt);
        }

        protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
        {
            switch (evnt.Key) {
                case Gdk.Key.Left:
                case Gdk.Key.Right:
                    return false;
                default:
                    return base.OnKeyPressEvent (evnt);
            }
        }

        protected override bool OnScrollEvent (Gdk.EventScroll evnt) {
            if (can_seek) {
                SeekValue += (evnt.Direction.Equals (Gdk.ScrollDirection.Down) ? -1 : 1) * 10000; // skip 10s
                OnSeekRequested ();
            }

            return base.OnScrollEvent (evnt);
        }

        protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
        {
            can_set_value = true;

            if (timeout > 0) {
                GLib.Source.Remove (timeout);
            }

            if (can_seek) {
                if (evnt.Button == 1 && Math.Abs (pressed_x - evnt.X) <= 3.0) {
                    SeekValue = (long) (evnt.X / Allocation.Width * Duration); // seek to clicked position
                }
                OnSeekRequested ();
            }

            return base.OnButtonReleaseEvent (evnt);
        }

        protected override void OnValueChanged ()
        {
            if (timeout == 0 && raise_seek_requested) {
                timeout = GLib.Timeout.Add (timeout_delay, OnSeekRequested);
            }

            base.OnValueChanged ();
        }

        private bool OnSeekRequested ()
        {
            if (raise_seek_requested) {
                EventHandler handler = SeekRequested;
                if (handler != null) {
                    handler (this, new EventArgs ());
                }
            }

            timeout = 0;
            return false;
        }

        public long SeekValue {
            get { return (long)Value; }
            set {
                if (!can_set_value) {
                    return;
                }

                raise_seek_requested = false;

                if (value > Duration) {
                    Duration = Int64.MaxValue;
                    Value = value;
                } else {
                    Value = value;
                }

                raise_seek_requested = true;
            }
        }

        public double Duration {
            get { return Adjustment.Upper; }
            set {
                Adjustment.Upper = value;
                EventHandler handler = DurationChanged;
                if (handler != null) {
                    handler (this, EventArgs.Empty);
                }
            }
        }

        public void SetIdle ()
        {
            Sensitive = false;
            SeekValue = 0;
            Duration = 0;
        }

        public uint SeekRequestDelay {
            get { return timeout_delay; }
            set { timeout_delay = value; }
        }

        public bool CanSeek {
            get { return can_seek; }
            set {
                can_seek = value;
                Sensitive = value;
            }
        }

        public new bool Sensitive {
            get { return base.Sensitive; }
            set {
                if (!value) {
                    can_set_value = true;
                }
                base.Sensitive = value;
            }
        }
    }
}
  • On which line? Note that compilation errors aren't "thrown" - they're just reported. There's a big difference between compilation errors and *exceptions* (which are thrown). – Jon Skeet Aug 29 '13 at 06:21
  • Also note that you've currently got a class with the same name as the namespace containing it. That may well be the problem - it's at least *a* problem which you should fix. – Jon Skeet Aug 29 '13 at 06:22
  • If I understand correctly, the error isn't in this code but in the code that tries to instantiate this class. That means that code expects a different constructor signature - maybe you need to expose the 3 arguments, or similar. Look at the code where the constructor is invoked. – Jester Aug 29 '13 at 12:38

0 Answers0