diff --git a/kmsg/kmsg.kc3 b/kmsg/kmsg.kc3
index 64750bb..1af9971 100755
--- a/kmsg/kmsg.kc3
+++ b/kmsg/kmsg.kc3
@@ -35,8 +35,11 @@ defmodule Kmsg do
Gtk4.Window.present(window)
}
- def on_send = fn (action, window) {
- puts("Kmsg.send")
+ def on_send = fn (action, %{window: window,
+ text_view: text_view}) {
+ message = Gtk4.TextView.get_text(text_view)
+ puts("Kmsg.send #{inspect(message)}")
+ Gtk4.TextView.set_text(text_view, "")
}
def activate = fn (app, void) {
@@ -46,11 +49,11 @@ defmodule Kmsg do
paned = Gtk4.Paned.new(:horizontal)
Gtk4.Widget.set_size_request(paned, 200, 200);
scrolled_window1 = Gtk4.ScrolledWindow.new()
- list_box1 = Gtk4.ListBox.new()
+ channels = Gtk4.ListBox.new()
labels1 = List.map(List.count(20), fn (x) {
label = Gtk4.Label.new("Label")
Gtk4.Widget.set_halign(label, :start)
- Gtk4.ListBox.append(list_box1, label)
+ Gtk4.ListBox.append(channels, label)
label
})
Gtk4.ScrolledWindow.set_child(scrolled_window1, list_box1)
@@ -80,7 +83,8 @@ defmodule Kmsg do
Gtk4.Widget.set_hexpand(text_view, true)
Gtk4.Box.append(box2, text_view)
button = Gtk4.Button.new_with_label("Send")
- Gtk4.signal_connect(button, "clicked", Kmsg.on_send, window)
+ Gtk4.signal_connect(button, "clicked", Kmsg.on_send,
+ %{window: window, text_view: text_view})
Gtk4.Box.append(box2, button)
Gtk4.Paned.set_position(paned, 240);
connect_action = Gtk4.SimpleAction.new("connect", Kmsg.on_connect, void)