F # Mono GTK ConfigureEvent

Did I use ConfigureEvent correctly? When I resize or reposition my window, nothing happens, the label text does not change to β€œResized”, as I expect?

module Main = open System open Gtk [<EntryPoint>] let Main(args) = Application.Init() let win = new MainWindow.MyWindow() // ----------------------------------------- let l = new Label( "None" ) win.Add l win.ConfigureEvent.Add( fun _ -> l.Text <- "Changed" ) // ----------------------------------------- win.ShowAll() Application.Run() 0 
+4
source share
1 answer

According to this faq, you need to add an attribute to the handler for this. This C # code works:

 [GLib.ConnectBefore] protected void OnConfigureEvent (object sender, ConfigureEventArgs a) { label1.Text = "Changed"; } 

In order for this to work in F # code, you probably need a handler for the instance method instead of lambda, so you need to attach this attribute. I suggest that you really should use some other event, although I'm not sure what.

0
source

Source: https://habr.com/ru/post/1483013/


All Articles