# Gtk window appears in the background

**URL:** <https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725>\
**Category:** General Usage\
**Tags:** question, package, gtk\
**Created:** [August 14, 2022, 12:02pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725 "2022-08-14T12:02:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 14, 2022, 12:02pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725/1 "2022-08-14T12:02:07Z")

</div>

I want to ccall the following Gtk function: [Gtk.Window.set\_keep\_above](https://docs.gtk.org/gtk3/method.Window.set_keep_above.html)

```julia
void
gtk_window_set_keep_above (
  GtkWindow* window,
  gboolean setting
)

```

I looked at [Gtk.jl/windows.jl at master · JuliaGraphics/Gtk.jl · GitHub](https://github.com/JuliaGraphics/Gtk.jl/blob/master/src/windows.jl) for inspiration, but there is no example for `gboolean`.

This is what I tried so far:

```julia
function set_keep_above(win::GtkWindow, setting::Bool)
    # handle_auto_idle(win); ccall((:gtk_window_set_keep_above, libgtk), (Ptr{GObject},), win)
    # gtk_window_set_keep_above(GTK_WINDOW(window), TRUE)
end

```

Any idea?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 14, 2022, 12:12pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725/2 "2022-08-14T12:12:49Z")

</div>

Ok, this seams to work:

```julia
using Gtk.ShortNames, GtkObservables

# define the default values
finished = false 

btnOK = button(label="OK")

win = Window("Dialog", 100, 36) |> (bx = Box(:v))
push!(bx, btnOK)

Gtk.showall(win)
ccall((:gtk_window_set_keep_above, Gtk.libgtk), Nothing, (Ptr{GObject},), win)
nothing

```

I just omitted the gboolean parameter… So I think it is wrong. How can I do this correctly?

---

<div class="post-metadata">

**Author:** ![tomaklutfu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomaklutfu/32/2411_2.png) [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Post date:** [August 14, 2022, 12:26pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725/3 "2022-08-14T12:26:21Z")

</div>

I found this [website](https://developer.gimp.org/api/2.0/glib/glib-Basic-Types.html) from google search. It says it is `gint` and which is also `int` in C. Maybe making it `Cint` in julia should do the trick. By the way, using `ccall` that way, the function in question uses garbage value in the corresponding register/memory for the second argument in the function call convention of the system.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [August 14, 2022, 12:39pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725/4 "2022-08-14T12:39:43Z")

</div>

I found out that the function IS already wrapped, and I can call it with:

```julia
G_.keep_above(win, true)

```

Thanks anyways!
