hi

Started by KingOfVC, Apr 28, 2016, 09:24 AM

Previous topic - Next topic

KingOfVC

hi
how to remove created GUI element?

maxorator

By removing all references to it.

KAKAN

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
oh no

KingOfVC

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?

rww

Maybe something like that?

function onWindowClose(window) {
if (this.window == window) {
shutdown();
}
}

from test server (inventory.nut)
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

ThunderStorm

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.



DizzasTeR

myWindow <- GUIWindow( ... )

// Later when you dont need it

myWindow = null

I guess it works pretty much the same for every element.

KAKAN

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 PM
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?
oh no

KingOfVC

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'

maxorator

#9
Quote from: KingOfVC on Apr 28, 2016, 02:19 PM
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'
What exactly are you doing? That error doesn't make sense.

EK.IceFlake

Try this
getroottable().rawset(myWindow, null);

karan20000000000

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'.

With regards,
KP
------------------------------------------

ysc3839

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;

karan20000000000

#13
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?
With regards,
KP
------------------------------------------

DizzasTeR

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