# Matrix of type textbox?

**URL:** https://discourse.julialang.org/t/matrix-of-type-textbox/135260
**Category:** New to Julia
**Tags:** makie, matrix
**Created:** [January 25, 2026, 11:17pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260 "2026-01-25T23:17:12Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![BananaMaster3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bananamaster3/32/218457_2.png) [@BananaMaster3](https://discourse.julialang.org/u/BananaMaster3)
#### Post date: [January 25, 2026, 11:17pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/1 "2026-01-25T23:17:13Z")

</div>

Hey, I want to store my instances of Makie.Textbox in a matrix of size m=(L,L) where L is an integer.  
The ideal situation would be:

```julia-auto
matrix = zeros(m, Makie.Textbox)
for ...
  #assign different parts of the matrix to different textboxes
end

```

Unfortunately, that zeros function doesn’t work. It feels weird to make a custom zeros function that creates a new figure, and makes each “zero” textbox be inside of that figure. Is there a better way to do this?  
Thank you!

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 26, 2026, 12:52am UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/2 "2026-01-26T00:52:07Z")

</div>

> [@BananaMaster3](#):
>
> `matrix = zeros(m, Makie.Textbox)`

`zeros` doesn’t make sense here because the array is not numeric. Just do

```julia-auto
matrix = Array{Makie.Textbox}(undef, m)

```

to allocate an uninitialized 2d array.

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [January 26, 2026, 1:24pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/3 "2026-01-26T13:24:24Z")

</div>

You can check `isundefined(array, i, j)` to check if that needs to be initialized as well, iirc

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 26, 2026, 1:52pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/4 "2026-01-26T13:52:25Z")

</div>

I think you mean `isassigned`?

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 26, 2026, 1:59pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/5 "2026-01-26T13:59:02Z")

</div>

> [@BananaMaster3](#):
>
> ```julia-auto
> matrix = zeros(m, Makie.Textbox)
> for ...
> #assign different parts of the matrix to different textboxes
> end
> 
> ```

Usually, rather than preallocating an array with the right return type and filling that, I find it easier to use `map` which is like a for loop with automated storage. If you need a matrix as output, you’d need some 2d iterator as input, too, as `for ..., for ...` syntax doesn’t work with `map`. `Iterators.product` can fulfill this purpose, like. Here’s an example with strings, but those could also return `Textbox`es:

```julia
julia> map(Iterators.product(1:3, 1:3)) do (i, j)
           "textbox $i, $j"
       end
3×3 Matrix{String}:
 "textbox 1, 1" "textbox 1, 2" "textbox 1, 3"
 "textbox 2, 1" "textbox 2, 2" "textbox 2, 3"
 "textbox 3, 1" "textbox 3, 2" "textbox 3, 3"

```

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 26, 2026, 2:19pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/6 "2026-01-26T14:19:20Z")

</div>

A comprehension is also pretty convenient:

```julia-auto
julia> ["textbox $i, $j" for i=1:3, j=1:3]
3×3 Matrix{String}:
 "textbox 1, 1" "textbox 1, 2" "textbox 1, 3"
 "textbox 2, 1" "textbox 2, 2" "textbox 2, 3"
 "textbox 3, 1" "textbox 3, 2" "textbox 3, 3"

```

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [January 27, 2026, 7:53pm UTC](https://discourse.julialang.org/t/matrix-of-type-textbox/135260/7 "2026-01-27T19:53:18Z")

</div>

Ah my bad, it’s actually `isdefined(array, i, j)`.
