using script to access UI elements

Scripting questions, discussions, etc
4 posts Page 1 of 1
Posts: 25
Joined: Mon Jun 19, 2017 7:28 pm
by bsisko » Mon May 28, 2018 5:15 am
Is there a way to use script to code UI elements?

For example, I have a GUIImage on the MainMenu GUI.
I want to use script that when a mouse click is resgistered on the control, it will execute the code to change images like
GUIImage.Picture = filename.

BTW, I am not at my work computer, so the above references are not correct, but approximations of what I know about Torque.
Posts: 11
Joined: Thu Apr 19, 2018 5:47 pm
by dstanton » Tue May 29, 2018 6:48 am
Certain GUI elements are updated on an action event, (ammo in the FPS demo, etc) . If you take a look at these events, you'll get a better idea of how it all works. I know theres a onObjectSelected(%this, %obj) event method, not sure if the scope exists on all GUI elements or what, but after it would be called, the main GUI element is stored in the %this variable and you're able to dig into the object further. A lot of these events and object properties can be found in the Torque documentation, found on google, you just have to keep in mind the object you're referencing.
Posts: 1202
Joined: Sun Feb 08, 2015 1:51 am
by Duion » Tue May 29, 2018 9:19 am
Can't you update any GUI at any time through scripts? You just pick the name of the GUI, a value in it and set it to something in script, then it will update.
Posts: 11
Joined: Thu Apr 19, 2018 5:47 pm
by dstanton » Tue May 29, 2018 11:57 am
I'm going to add that I am not the sharpest programmer, and I might have to take back what I had commented earlier. onObjectSelected(%this, %obj) isn't a GUI function and should be ignored. Some of what I said should make a little more sense when you get to know the system more.
4 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest