# Accessing elements in Gtk container by name

**URL:** https://discourse.julialang.org/t/accessing-elements-in-gtk-container-by-name/41385
**Category:** General Usage
**Tags:** question
**Created:** [June 14, 2020, 3:29pm UTC](https://discourse.julialang.org/t/accessing-elements-in-gtk-container-by-name/41385 "2020-06-14T15:29:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [June 14, 2020, 3:29pm UTC](https://discourse.julialang.org/t/accessing-elements-in-gtk-container-by-name/41385/1 "2020-06-14T15:29:01Z")

</div>

In Gtk.jl, elements are accessed by an integer index. For example,

```julia
using Gtk
win = GtkWindow()
button = GtkButton("OK", name="ok_button")
push!(win, button)
win[1]

```

This has two limitations in my opinion. First, integer indices convey no inherent meaning. Second, if an element is deleted from the container, some of the indices shift. This means that the association between 1 and button is not permanent. It would be convenient to access nested components with the dot syntax, e.g. `win.ok_button` or `win.ok.label`. It appears that this syntax is already used for some other [purpose](https://github.com/JuliaGraphics/Gtk.jl/blob/7de236853498fe30f0a015fbbcb7663205369d3f/src/GLib/gvalues.jl#L185), which is unclear to me.

Is there a way to add this functionality (assuming it does not exist already in some form)?
