Moving a GTK window

I have the following code:

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_.window_move(win, 100, 100)

while ! finished
    sleep(0.1)
end

println("Option A: $OPTION_A")
println("Option B: $OPTION_B")
nothing

The dialog always shows up when I run the script, which is fine.

But it sticks to the top of the screen. How can I move the window to a different position?

This function should do the trick: Gtk.Window.move

But I could not find it, neither in the Gtk. namespace nor in the G_. namespace.

Any idea how to move the window?

G_.position should do it.

3 Likes

Indeed,
G_.position(win, 800, 400)
works!

do we know, what Glib/Gtk function is called with that?

:slight_smile:

1 Like