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

Author Topic: [Resolved] Redbox GUI Error  (Read 949 times)

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 38
  • HSL Programmer
    • View Profile
    • Daniel J. Burkhart
[Resolved] Redbox GUI Error
« on: Feb 04, 17, 08:46:30 PM »

Hello, today I ran into an error when creating a GUI and I am trying to understand what exactly is going wrong. I think I might know the problem, but I do not fully understand why it is creating a red box in place of the GUI I am trying to build. I see only one other fourm post about this and would like to bring it back up because although that is resolved I do not fully understand what was causing it in that case either.

The Error:
From my understanding the error is cause by a GUI not being able to load properly thus it loads in a red box. However, I do not understand where it is not loading in properly.  The most useful insight I have found has come from this post, however I can not add the class="ClassName" without the GUI being completely inaccessible from everything except the Hero Script Editor.

The Questions:
So I ask, why do I get a red box instead of the properly displayed GUI when I create the node from the prototype? Could it be related to not having the class specified in the GUIXML script or is it something else entirely?
« Last Edit: Feb 05, 17, 07:58:48 AM by Mr_Conflicts »
Logged

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: Redbox GUI Error
« Reply #1 on: Feb 05, 17, 12:38:47 AM »

After CreateFromPrototype("yourGUI") you need to:

Code: [Select]
yourGUI.build = true

if you don't do it in script it will be red box.
Logged

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 38
  • HSL Programmer
    • View Profile
    • Daniel J. Burkhart
Re: Redbox GUI Error
« Reply #2 on: Feb 05, 17, 07:58:26 AM »

After CreateFromPrototype("yourGUI") you need to:

Code: [Select]
yourGUI.build = true

if you don't do it in script it will be red box.

You are correct, however the problem ended up being in the GUIXML file. You can not use the the following code:

Code: [Select]
inheritFrom='_panel9slice'
Instead of using that you should use the following:

Code: [Select]
class='YourClass'
Hopefully this helps anyone who may be using the GUI Editor, you should not use the inherit from option.

Quote from: ToY-Krun
You can use it only if you're creating a new gui that is nothing more than a panel etc, and will never use any class other than the one its inheriting from

So anyways this is resolved now.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1144
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: [Resolved] Redbox GUI Error
« Reply #3 on: Feb 06, 17, 01:26:31 PM »

There are 2 places where a GUI can inherit from another class. One is in the DOM, the other is in the xml file. If the classes are 2 different classes that get inherited from, they might have conflicting or missing fields that are in 1 class but wont work in the other. An example is "text" field in a non label. Another is "move" field in a panel.

I find it easier to define the class in the DOM with an inherit from, and using your new class to make the GUI with. I have also had to replace many GUIs that use "_panel9slice" in our GUIs.
Logged