Jump to content

GUI - have container invisible but still call draw


Recommended Posts

I have a container that dynamically positions controls according to their size and some ordering settings. Something like a StackPanel but more suited to my project's needs.

This container mostly contains children whose size is already defined by the time they're added to the container. The container is updated every time the children are drawn.

In this container, I also have a TextBlock with resizeToFit set to true, which means its size is dynamically evaluated at runtime in TextBlock/_renderLines().

The problem is, the other container's children can be drawn before TextBlock size is evaluated, which results in a mess for a split second until it is drawn and the container is updated.

My goal is to hide the container until the TextBlock's size has been evaluated, and save this little mess from the eyes of the user.


This leads me to this question - Is there a way to make the container invisible to the user but still draw it invisibly?

Setting control.isVisible = false results in no further draw calls for the control, I suppose since it means there's no point in rendering it.

From my testing the same goes for control.notRenderable = true.

If there are no further draw calls, it means the TextBlock size is never measured, meaning even if I manually add it again without depending on Control/onAfterDrawObservable, the mess for a split second will remain as nothing was achieved.


I would've posted a PG but it'd be too cumbersome given the involved project's classes.

You can assume everything is working as it's supposed to, it's more about trying to figure out a logical solution to the simple question of drawing in a way that's invisible to the user.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...