HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved]Child elements of custom button GUI dont exist  (Read 1443 times)

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile

I created a guicontrol class" "TMP_Button"
Which has the parent class: "_GUIButton"

GUIXML for the guicontrol:
Code: [Select]
<createControlType class='TMP_Button' type=TMP_Button' description='Borderless button ' treePath='CleanEngine' name="TMP_Button">
  <position x="497" y="288"/>
  <size x="80" y="20"/>
  <_label name="text" dockMode="FILL" text="Text" displayfont="JUMBO" justification="CENTER">
    <size x="80"/>
    <defaultStatePresentation>
      <color r="1" g="1" b="1"/>
    </defaultStatePresentation>
  </_label>
</createControlType>


When I use the following:
Code: [Select]
 
button as NodeRef of Class TMP_Button = CreateNodeFromPrototype("TMP_Button")

lbl as NodeRef of Class GUILabel = FindGUIControlByName(button,"text")
println(lbl)
The println result is: 0

And if I Analyze the Button:
Analyze> Control + Children

The children aren't there.

Console:
Code: [Select]
16:39:33: !ERROR!HeroScript::HeroMachine::ScriptError:No Node found for that node ID.
16:39:33: !ERROR!System:SCRIPT ERROR: In function GetGUICompositeScale: No Node found for that node ID.
04/23/2013 16:39:30
Call trace:
  Script GUIControlClassMethods line 204 me[id=1000010869 invalid]
  Script _GUIAnalysisDialogForControlsClassMethods line 129 me[1000016752]
  Script _GUIAnalysisDialogForControlsClassMethods line 67 me[1000016752]
starting method/function _ANALYSISWINDOWASYNCHRONOUSCONSTRUCTIONTIMER_TICK
starting me[id=1000016752 class=_GUIAnalysisDialogForControls]

The noderef of the children are invalid.
However, if I edit the control under the "Children" data field there is a node ID.
But it points to a non-existant node.

The only way I can use the button, and get the children node, is by adding the button to a gui via the gui editor.

What am I doing wrong?

Thanks
« Last Edit: Apr 23, 13, 08:39:39 PM by Jrome90 »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Child elements of custom button GUI dont exist
« Reply #1 on: Apr 23, 13, 07:55:00 PM »

Is that from the Options Window?  Hmm, nm I missed the label inbedded in the GUI.

When using CreateNode, need to add the build
button.build = true
« Last Edit: Apr 23, 13, 08:29:52 PM by Thazager »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: Child elements of custom button GUI dont exist
« Reply #2 on: Apr 23, 13, 08:37:29 PM »

Is that from the Options Window?  Hmm, nm I missed the label inbedded in the GUI.

When using CreateNode, need to add the build
button.build = true

I should know better :-[


Thanks Thazager, it's fixed.

If fact this is so embarrassing, I dont want this thread to exist  ;)
« Last Edit: Apr 23, 13, 08:39:16 PM by Jrome90 »
Logged