How can I create a modal dialog with Gtk.jl ?
The following code kind-of works:
# This example creates a modal dialog with two checkboxes.
using Gtk.ShortNames, GtkObservables
# define the default values
OPTION_A = false
OPTION_B = false
finished = false
cb1 = checkbox(OPTION_A, label="Option A")
cb2 = checkbox(OPTION_B, label="Option B")
btnOK = button(label="OK")
win = Window("Dialog", 200, 72) |> (bx = Box(:v))
push!(bx, cb1)
push!(bx, cb2)
push!(bx, btnOK)
function on_button_clicked(win)
global OPTION_A, OPTION_B, finished, win
OPTION_A = observable(cb1)[]
OPTION_B = observable(cb2)[]
destroy(win)
finished = true
end
signal_connect(on_button_clicked, widget(btnOK), "clicked")
Gtk.showall(win)
G_.keep_above(win, true)
G_.position(win, 800, 400)
while ! finished
sleep(0.1)
end
println("Option A: $OPTION_A")
println("Option B: $OPTION_B")
nothing
The problem is, that this is a window with a close icon, and if I close the window the variable “finished” is not set to true and the script does not terminate…
How can I create a modal dialog window that does NOT have a close icon and no icon to enlarge to full screen?