how to remove created GUI element?
By removing all references to it.
Quote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.
He wants to function to do it. Like: GUIElement.remove() or something
Quote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.
I tried, label = null but it gave that error. So how do I remove the references?
Maybe something like that?
function onWindowClose(window) {
if (this.window == window) {
shutdown();
}
}
from test server (inventory.nut)
Quote from: rww on Apr 28, 2016, 12:52 PMMaybe something like that?
function onWindowClose(window) {
if (this.window == window) {
shutdown();
}
}
from test server (inventory.nut)
no.
We would like to close the GUI when InputReturn(element) is called.
myWindow <- GUIWindow( ... )
// Later when you dont need it
myWindow = null
I guess it works pretty much the same for every element.
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )
// Later when you dont need it
myWindow = null
I guess it works pretty much the same for every element.
Quote from: KingOfVC on Apr 28, 2016, 12:45 PMQuote from: maxorator on Apr 28, 2016, 10:09 AMBy removing all references to it.
I tried, label = null but it gave that error. So how do I remove the references?
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )
// Later when you dont need it
myWindow = null
I guess it works pretty much the same for every element.
The error I get is: trying to set 'class'
Quote from: KingOfVC on Apr 28, 2016, 02:19 PMQuote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )
// Later when you dont need it
myWindow = null
I guess it works pretty much the same for every element.
The error I get is: trying to set 'class'
What exactly are you doing? That error doesn't make sense.
Try this
getroottable().rawset(myWindow, null);
Quote from: karan20000000000 on Apr 26, 2016, 08:34 PMThe GUIEntity class seems to be lacking .Delete() method. I tried setting the instance variable to null and it gave an error saying 'trying to set class'. (@maxorator)
I guess you didn't notice it :[.Quote from: maxorator on Apr 28, 2016, 09:03 PM...
What exactly are you doing? That error doesn't make sense.
This is what I did: I made a label through /exe command for client script. The label showed up properly right where I wanted it to be. But, when I tried to remove it by setting that instance = null, this error popped up. However when I made a function to do this,
function GUILabel::Delete()
{
return this = null;
}
then nothing came up, neither any error nor did the label disappear. Similar was the case when I tried getroottable().rawset.... by CrystalBlue.
The third time, I directly initialised the label through the script and set it to null under onplayershoot. When I did it, the same error came up, i.e., trying to set 'class'.
Quote from: Doom_Kill3R on Apr 28, 2016, 01:15 PMmyWindow <- GUIWindow( ... )
// Later when you dont need it
myWindow = null
I guess it works pretty much the same for every element.
Try myWindow <- null;
Quote from: ysc3839 on Apr 29, 2016, 05:13 AM...
Try myWindow <- null;
Worked :]
Thanks.
But, could you please explain why the other methods weren't working?
How come that worked for you but the correct way doesn't? I simply set the variable to null and all the GUI elements corresponding to it are removed automatically.
P.S:
@karan20000000000, I've guessed what you're up to, I'd tell you to leave that to me :D
Quote from: karan20000000000 on Apr 29, 2016, 05:45 AMQuote from: ysc3839 on Apr 29, 2016, 05:13 AM...
Try myWindow <- null;
Worked :]
Thanks.
But, could you please explain why the other methods weren't working?
I think Squirrel treat the "=" as an operator. But the class doesn't have an "=" operator.