Gtk# window application with MonoDevelop


Introduction

In this application we used label, textview, button and entry widgets to design an application.

Working

In this application, when we put any text input into the entry widget and click on the add button, the given input get displayed in the textview widget.

Designing
 
Step 1 : Open MonoDevelop.

d1.gif

Step 2 : Create a new solution and rename it.

1.gif

2.gif

Step 3 : Go to the designer mode, take a vbox widget and add label ,text view ,entry and entry widgets to the MainWindow.


5.gif


6.gif


Overall Designing as given below. 

24-nov.gif

Program

using System;
using Gtk;
public partial class MainWindow : Gtk.Window
{
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build();
    }
    protected void OnDeleteEvent(object sender, DeleteEventArgs a)
    {
        Application.Quit();
        a.RetVal = true;
    }
    protected void onbuttonclick(object sender, System.EventArgs e)
    {
        textview1.Buffer.Text = entry1.Text;
    }
}

Output : To run Press Ctrl+F5

RUN.gif


24-nov-2.gif

Enter the desired input into the entry widget as show below.

24-nov-3.gif

After clicking on the "click to add in TextView widgets"

24-nov-4.gif


Similar Articles