# How to use vertical GtkScale in GtkGrid with Gtk.jl

**URL:** <https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752>\
**Category:** General Usage\
**Tags:** question, guis, gtk\
**Created:** [September 17, 2020, 5:59am UTC](https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752 "2020-09-17T05:59:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kogad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kogad/32/18629_2.png) [@kogad](https://discourse.julialang.org/u/kogad)\
**Post date:** [September 17, 2020, 5:59am UTC](https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752/1 "2020-09-17T05:59:20Z")

</div>

Hi. I am trying to use a vertical slider (GtkScale) in a grid , but this code does not work well.

```julia
using Gtk 

win = GtkWindow()
c = GtkScale(false, -1:0.1:1)
oc = GtkOrientable(c)
GAccessor.orientation(oc, 1)
b1 = GtkButton("Button1")
b2 = GtkButton("Button2")
g = GtkGrid()
g[1, 1] = c
g[2, 1] = b1
g[2, 2] = b2
push!(win, g)
showall(win)

```

I get:

 ![スクリーンショット 2020-09-17 14.42.25](https://global.discourse-cdn.com/julialang/original/3X/c/e/ce4348d70706f9bb1aceeee84036bc94f92a1af7.png)

It seems the slider is too short.  
Horizontal one can be used by this sample code in the doc ([Layout · Gtk.jl](https://juliagraphics.github.io/Gtk.jl/latest/manual/layout/#Grid-1)) and it works well.  
Is there a way to put a vertical slider which has enough length into a grid?

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [September 17, 2020, 7:44am UTC](https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752/2 "2020-09-17T07:44:06Z")

</div>

I think you put the scale in the upper left corner of your grid, so it cannot expand lower than the lower edge of button1. Try packing the buttons in a VBox and scale and VBox together in a HBox. btw: for experimenting with layout options use glade.

---

<div class="post-metadata">

**Author:** ![kogad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kogad/32/18629_2.png) [@kogad](https://discourse.julialang.org/u/kogad)\
**Post date:** [September 18, 2020, 7:36am UTC](https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752/3 "2020-09-18T07:36:01Z")

</div>

I got the same result by using Vboxes in a Hbox, but it worked well with Glade! I’m not sure why it worked, but it’s probably some property issues 🤔  
Thank you!

---

<div class="post-metadata">

**Author:** ![czylabsonasa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/czylabsonasa/32/8663_2.png) [@czylabsonasa](https://discourse.julialang.org/u/czylabsonasa)\
**Post date:** [August 28, 2021, 4:28pm UTC](https://discourse.julialang.org/t/how-to-use-vertical-gtkscale-in-gtkgrid-with-gtk-jl/46752/4 "2021-08-28T16:28:20Z")

</div>

A possible non-Glade solution:

```julia
using Gtk 

c = GtkScale(true, -1:0.1:1)
set_gtk_property!(c, :vexpand, true)

oc = GtkOrientable(c)
set_gtk_property!(oc, :orientation, 1)

b1 = GtkButton("Button1")
b2 = GtkButton("Button2")

ph = GtkLabel("") # placeholder
set_gtk_property!(ph, :hexpand, true)

g = GtkGrid()
g[1, 1:2] = c

g[2, 1:2] = ph

g[3, 1] = b1
g[3, 2] = b2

win = GtkWindow()
push!(win, g)
showall(win)

```
