Gui.set_parent

#1

I have this code below and I’m not getting result I anticipate

		--//draw card label 1
		card1label = gui.new_text_node(vmath.vector3(500,50,1), "Label")
		gui.set_id(card1label, "card1label")
		gui.set_parent(card1label, GuiNodes["Card1"].nodedata[GuiNodes["Card1"].stringroot.."ROOT"]) --//assigns the label to the parent node which is a multi-layered rectangle -- root is transparent root object for this gui template... delete it - delete everything attached to it.
		gui.set_font(card1label, "CardTitleTall")
		gui.set_color(card1label, ColorTable["black"])
		gui.set_outline(card1label, ColorTable["white"])
		gui.set_layer(card1label, "textual")  --// because it's text I'm putting it on a text layer - rest of gui object is on a different layer as they're boxnodes
		gui.set_position(card1label, vmath.vector3(50,50,1))

The issue I’m getting is that when I reset the position (last state) its not displaying anywhere on the parent gui object. I’m trying to get it to position relative to the parent node. The text just doesn’t appear. If I add true to the gui.set_parent command it will show up relative to the screen so the text appears. When I set_parent but not use true to get relative positioning the text disappears. I think it’s hiding within the layers of the parent gui object - I tried issuing a gui.move_above command but it didn’t work.

0 Likes

#2

Are you using layers?

Can you share a minimal repro case of your problem?

0 Likes

#3

Earlier I reported a problem with gui.move_below and gui.move_above which was not investigated.

Could it be the same problem in this case?

0 Likes

#4

I am using layers and text is stored in its own layer while the graphical objects aren’t. If I set the parent but use screen positioning vs. parent object positioning flag, the text appears. I want to use the parent object though for easier code readability of relative positioning.

I can try to post a zip file but it’ll take a bit to move everything into its own smaller shareable zip - not sure I’ll get to that until the upcoming weekend.

0 Likes

#5

Interesting… I’ll look and see if I get the same Nil reply in my code later to see. Not 100% sure it’s related but I am definitely trying to make this work with a fairly layered GUI Template object.

0 Likes