# Text node is recreating after minimizing window (DEF-2520)

**URL:** <https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826>\
**Category:** Bugs\
**Created:** [March 27, 2017, 6:45pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826 "2017-03-27T18:45:21Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [March 27, 2017, 6:45pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/1 "2017-03-27T18:45:21Z")

</div>

When i minimize window. Text nodes is recreating. I have a gui with text nodes. Then i changed text, font scale and etc.Then i minimaze window.But when i maximize window, my text node is reverted to default state(mb was recreated)  
My os is windows 10.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 28, 2017, 7:32am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/2 "2017-03-28T07:32:41Z")

</div>

Are you using multiple gui layouts? And could it be that you’re getting a [layout\_changed](http://www.defold.com/ref/gui/#layout_changed:id-previous_id) message to your gui\_script when the app is minimized/maximized? When the layout changes the gui will be reset but since you get the callback you’re able to recreate the gui into the correct state again.

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [March 28, 2017, 7:59am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/3 "2017-03-28T07:59:58Z")

</div>

yes i use multiple layouts.Actually i don’t need different layouts, but i don’t find a way to change default layout size(changing size in game.project not good idea, because i want gui in 2048x1536, which bigger then my screen, and in html build window will be too big).  
I get messages:  
DEBUG:SCRIPT: hash: [layout\_changed]  
DEBUG:SCRIPT: hash: --layout\_id  
DEBUG:SCRIPT: hash: [layout\_changed]  
DEBUG:SCRIPT: hash: [Landscape] --layout\_id

So when i maximaze window layout set to default, then set to landscape. Why 2 times, is it realy need. Also why layout changed? When i stretch the window, i never get this messages.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 28, 2017, 10:22am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/4 "2017-03-28T10:22:50Z")

</div>

> [@d954mas](#):
>
> but i don’t find a way to change default layout size

The default layout size corresponds to what you have in game.project and that is as far as I know the only way to change it.

> [@d954mas](#):
>
> So when i maximaze window layout set to default, then set to landscape. Why 2 times, is it realy need.

Hmm, are you saying that you get two messages when you maximise the window?

> [@d954mas](#):
>
> When i stretch the window, i never get this messages.

You should get a message as soon as the layout is changed. The system will chose the layout that is closest to the current window size.

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [March 28, 2017, 12:01pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/5 "2017-03-28T12:01:37Z")

</div>

Yes i get 2 messages when maximize window.My game size is 1366x768(16x9) My layout size 2048x1536(4x3). When i stretch window, i newer get layout-changed nessages

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [March 29, 2017, 9:01am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/6 "2017-03-29T09:01:26Z")

</div>

i created a sample project. When i use default display\_profiles i also get 2 messages when maximaze window.  
DEBUG:SCRIPT: change from:hash: [Landscape] to hash:   
DEBUG:SCRIPT: change from:hash: to hash: [Landscape]

Sample: [Are you not a robot?](https://yadi.sk/d/glhbmzAW3GSmFS)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 29, 2017, 9:56am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/7 "2017-03-29T09:56:20Z")

</div>

Ok, so I don’t have any access to a Windows machine from where I’m at right now, but I do get messages when I change the window aspect ratio from landscape to portrait and vice versa on OSX:

![](https://forum-defold.b-cdn.net/uploads/default/original/2X/5/50a464469cf29513d8ff85ead7ac537817ad6279.gif)

I do not get any messages when the app is maximized or minimized on OSX though.

And you’re saying that on windows when you press minimize or maxmize you get two messages?

@sven or @Mathias_Westerdahl , are you able to test this behaviour on Windows? Do you get two messages when you maxmize/minimize and do you get any message when you change aspect ratio?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 29, 2017, 9:59am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/8 "2017-03-29T09:59:08Z")

</div>

In any case, if you have multiple layouts you need to react to layout\_changed messages and update your nodes with whatever dynamic data that you might need.

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [March 29, 2017, 10:03am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/9 "2017-03-29T10:03:23Z")

</div>

When i change window size i get message from portrait to landscape and vice versa.  
When i minimaze window i don’t get any message but when i maximaze window i get two messages.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [March 29, 2017, 11:44am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/10 "2017-03-29T11:44:59Z")

</div>

Ah, I see. I’m guessing that the first message is when you minimize and the second is when you maximize, but the minimize message gets “queued up” somehow when the app stops running.

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [April 4, 2017, 7:29am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/11 "2017-04-04T07:29:46Z")

</div>

So is it big, or expected behavior?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 4, 2017, 9:57am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/12 "2017-04-04T09:57:39Z")

</div>

Not sure. @Mathias_Westerdahl or @Johan_Beck-Noren?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 4, 2017, 11:19am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/13 "2017-04-04T11:19:06Z")

</div>

I’d say it’s unintentional, we have a related issue, so I reused that one (DEF-2520)

---

<div class="post-metadata">

**Author:** ![Insality](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/insality/32/39737_2.png) [@Insality](https://forum.defold.com/u/Insality)\
**Post date:** [June 9, 2020, 4:05pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/14 "2020-06-09T16:05:44Z")

</div>

Up theme.

We add single layout for _gui\_scene_ and on minimize/maximize (Windows) got next message:

```lua
{ --[[0000023D0D290AF0]]
  message_id = hash: [layout_changed],
  message = { --[[0000023D0D290930]]
    previous_id = hash: [Default-Wide],
    id = hash: []
  }
}

{ --[[0000023D0D291B90]]
  message_id = hash: [layout_changed],
  message = { --[[0000023D0D291A50]]
    previous_id = hash: [],
    id = hash: [Default-Wide]
  }
}

```

For single layout in _gui_ scene it’s not expected to catch _layout\_changed_. Chance to reset all GUI scene is not so good 🙂

Is it safe to use single layout and to be sure gui scene will not be reset on mobile platforms (iOS/Android)?

**PS** : I am “the Necromancer” again, 3 years later 😉

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [June 9, 2020, 9:56pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/15 "2020-06-09T21:56:42Z")

</div>

That sounds really strange. Can you please create a minima repro case for this?

---

<div class="post-metadata">

**Author:** ![Insality](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/insality/32/39737_2.png) [@Insality](https://forum.defold.com/u/Insality)\
**Post date:** [June 10, 2020, 8:07am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/16 "2020-06-10T08:07:56Z")

</div>

Sure, here is the link: [layouts\_bug.zip](https://forum.defold.com/uploads/default/original/3X/7/9/790cb2ef3b6c42b4fef96699e573e73f8642a7b4.zip) (2.9 KB)

The bug is reproducing on windows (not macOS, don’t sure about mobiles).

To reproduce just minimize and maximize the game window. The text on the scene should be changed from “_this text from gui script_” to “_this text default for layout_”

Gui scene contains single layout. It’s used to change gui scene size for this gui scene without changing game.project game dimensions.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [July 15, 2020, 7:01pm UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/17 "2020-07-15T19:01:32Z")

</div>

> [@Insality](#):
>
> The bug is reproducing on windows (not macOS, don’t sure about mobiles).

Created [Single gui layout generates layout\_changed message · Issue #5016 · defold/defold · GitHub](https://github.com/defold/defold/issues/5016)

---

<div class="post-metadata">

**Author:** ![PizzaConsole](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pizzaconsole/32/36520_2.png) [@PizzaConsole](https://forum.defold.com/u/PizzaConsole)\
**Post date:** [July 9, 2024, 3:03am UTC](https://forum.defold.com/t/text-node-is-recreating-after-minimizing-window-def-2520/6826/18 "2024-07-09T03:03:11Z")

</div>

How would you handle this with Druid on something like Dynamic Data Lists? Would you rebuild the whole list every time the window is minimized an reopened? I do have 2 layouts but having the application minimize count as a layout change is weird.  
Either way if my user resizes the app I do need a way for the content to stay the same, and unfortunately because I am using a “prefab” component all the text in the Dynamic list gets reset to the text of the “prefab”
