Jump to content

Why GUI element changes depending on initialization?


Geo

Recommended Posts

Pretty simple question, but got me thinking a lot.

Creating a GUI with tables:

gui_elements = {}
gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true)
gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, login_box)
gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, login_box)
gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, login_box)
gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, login_box)


Creates a different sized GUI than like this:
 

login_box = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true)
user_input = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, login_box)
password_input = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, login_box)
big_button = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, login_box)
small_button = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, login_box)


Why is this?

Link to comment
  • Moderators
3 hours ago, Geo said:


Why is this?

 

Because in the first example, login_box is not defined.

 

So:

gui_elements = {}

gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true)
gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, gui_elements["login_box"])
gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, gui_elements["login_box"])
gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, gui_elements["login_box"])
gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, gui_elements["login_box"])

 

  • Thanks 1
Link to comment
Just now, IIYAMA said:

 

Because in the first example, login_box is not defined.

 

So:


gui_elements = {}

gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true)
gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, gui_elements["login_box"])
gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, gui_elements["login_box"])
gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, gui_elements["login_box"])
gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, gui_elements["login_box"])

 


Yeah, I realized my mistake. Embarrasing!

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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