Advanced Functional Prog.


Graphical User Interfaces (GUI)

As a final, and more sophisticated example, graphical interfaces can be realized with Gtk framework:

let demo3 _ = 
  Application.Init ()
  let builder = new Builder()
  builder.AddFromFile("applications.glade")
  let win = new Window(builder.GetObject("window").Handle)
  win.DeleteEvent.Add(fun e -> Application.Quit())
  let txt = new TextBuffer(builder.GetObject("text").Handle)
  let url = new Entry(builder.GetObject("url").Handle)
  url.Changed.Add(fun e -> txt.SetText "XXX")
  txt.SetText("<html>...</html>")
  win.Show()
  Application.Run ()
  0

demo3 ()

Remarks:

#r "nuget: GtkSharp, 3.24.24.95"