Author Topic: GUI Functions  (Read 847 times)

Could people just state all the GUI functions you know and how many/what vars there are?

The list
-onWake(%this)


How does the onSelect function work? I called it and it says the function does not exist.
« Last Edit: February 20, 2012, 06:09:30 AM by jes00 »

Jes, there's a method called dump. It exists for all objects. Go make an object, name it arglblargl, and call arglblargl.dump(); It's exactly what you're doing here plus it explains what they do and how to use them.


How does the onSelect function work? I called it and it says the function does not exist.

It works with a text list control

from Client_Buildbot/client.cs
Code: [Select]
function buildbot_filelist::onselect()
{
if($buildbot::doubleclick)
{
if(getsimtime() - $buildbotfileclick < 500)
{
buildbot_open();
$buildbotfileclick = 0;
return 1;
}
$buildbotfileclick = getsimtime();
return 0;
}
buildbot_open();
return 1;
}

function buildbot_open()
{
if((%row = buildbot_filelist.getselectedid()) >= 0)
{
$buildbotpath = $buildbotpath @ getfield(buildbot_filelist.getrowtextbyid(%row), 1);
buildbot_refresh($buildbotpath);
return 1;
}
return 0;
}

looking back at this, it doesn't look like I accounted for clicking on two different options in rapid succession.  I should fix that.
« Last Edit: February 20, 2012, 03:59:15 PM by Nexus »

It works with a text list control

from Client_Buildbot/client.cs
Code: [Select]
function buildbot_filelist::onselect()
{
if($buildbot::doubleclick)
{
if(getsimtime() - $buildbotfileclick < 500)
{
buildbot_open();
$buildbotfileclick = 0;
return 1;
}
$buildbotfileclick = getsimtime();
return 0;
}
buildbot_open();
return 1;
}

function buildbot_open()
{
if((%row = buildbot_filelist.getselectedid()) >= 0)
{
$buildbotpath = $buildbotpath @ getfield(buildbot_filelist.getrowtextbyid(%row), 1);
buildbot_refresh($buildbotpath);
return 1;
}
return 0;
}

looking back at this, it doesn't look like I accounted for clicking on two different options in rapid succession.  I should fix that.
Add-Ons/Client_Friends/Packages.cs (28): Unknown command onSelect.

Add-Ons/Client_Friends/Packages.cs (28): Unknown command onSelect.

You can't call the command to cause an effect unless it's already defined for that control. What are you trying to do?

You can't call the command to cause an effect unless it's already defined for that control. What are you trying to do?
When it's selected I'm trying to call a function to tell if the player is in a txt file.

ALSO:
How would I get the players full name(client sided) from the player list? I tried getWord(NPL_List.getRowTextByID(NPL_List.getSelectedID()), 1); but that does not work if the player has more then one word in their name.
« Last Edit: February 21, 2012, 09:17:53 AM by jes00 »

Create the function nameOfYourListControl::onSelect instead of calling it.

In regard to your second question, use getField instead of getWord.

Create the function nameOfYourListControl::onSelect instead of calling it.

In regard to your second question, use getField instead of getWord.
That's what I was doing, function NPL_List::onSelect(%a, %b, %rowText)

So like this? getField(NPL_List.getRowTextByID(NPL_List.getSelectedID()), 1);

That's what I was doing, function NPL_List::onSelect(%a, %b, %rowText)

The following error would only occur if you explicitly/implicitly called the function or attempted to do parent::onSelect:

Add-Ons/Client_Friends/Packages.cs (28): Unknown command onSelect.

The following error would only occur if you explicitly/implicitly called the function or attempted to do parent::onSelect:
Any way to parent it then?

Add-Ons/Client_Friends/Packages.cs (28): Unknown command onSelect.

You have to name the object, then create the function nameoflistcontrol::onSelect()
Otherwise it does not have access to this class based function

Any way to parent it then?

You don't need to parent it because it doesn't exist by default. It's an engine callback which is only called if the function has been created.