Mono.Terminal.Dialog.AddButton C# (CSharp) Method

AddButton() public method

Adds a button to the dialog
public AddButton ( Button b ) : void
b Button
return void
        public void AddButton(Button b)
        {
            if (buttons == null)
                buttons = new List<Button> ();

            buttons.Add (b);
            button_len += b.w + button_space;

            Add (b);
        }

Usage Example

Exemplo n.º 1
0
	static void AddDialog ()
	{
		int cols = (int) (Application.Cols * 0.7);
		Dialog d = new Dialog (cols, 8, "Add");
		Entry e;
		string name = null;
		
		
		d.Add (new Label (1, 0, "Torrent file:"));
		e = new Entry (1, 1, cols - 6, Environment.CurrentDirectory);
		d.Add (e);

		// buttons
		Button b = new Button ("Ok", true);
		b.Clicked += delegate {
			b.Container.Running = false;
			name = e.Text;
		};
		d.AddButton (b);
		b = new Button ("Cancel");
		b.Clicked += delegate {
			b.Container.Running = false;
		};
		d.AddButton (b);
		
		Application.Run (d);

		if (name != null){
			if (!File.Exists (name)){
				Application.Error ("Missing File", "Torrent file:\n" + name + "\ndoes not exist");
				return;
			}
			torrent_list.Add (name);
		}
	}
All Usage Examples Of Mono.Terminal.Dialog::AddButton