Author Topic: GUI Modifying Help [Solved by Port!]  (Read 2190 times)

I cannot find why this is not working, but it's not.
Code: [Select]
if(isObject(Button_FillCan))
Button_FillCan.position = "205 232";
if(isObject(Button_Duplicator))
Button_Duplicator.position = "205 192";

%fetchAllButton = new GuiBitmapButtonCtrl(Button_FetchAll)
{
profile = "BlockButtonProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "205 172";
extent = "99 19";
minExtent = "8 2";
visible = "1";
command = "adminGui::FetchAll();";
text = "Fetch All";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
lockAspectRatio = "0";
alignLeft = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};

adminGui.add(%fetchAllButton);
« Last Edit: January 20, 2012, 09:34:07 AM by jes00 »



What?
Your value for command is not valid. You're using the namespace :: instead of a .

CityRPG, you can use '::' instead of '.'. but what do you mean it don't work, it won't appear on the gui? Or does the function don't get called?

I never do this kind of stuff, but I am pretty sure it is because :: are for class functions, and admin gui is an object and not a class.  Therefore admingui.fetchall(); would be better.

I personally would do admingui_fetchall(); and not bother with what object the function is being called on or what class it is.  I have always seemed to screw that stuff up.

The following is fully valid code:
wandImage::onFire( magicWandImage );

If you call something using the '::' namespace, the only difference is that you have to specify the object itself (allows you to utilize one object type's functions on something else). You have to be careful though, the original function may depend on the object existing in a specific way.

Ok I changed the command name to adminGui_FetchAll() (I changed the command called with the fetch all button to this too) but it still does not work. When I look at the GUI the buttons are still in the same position and the fetch all button does not exist.

So, the button doesn't appear on the admin GUI? In any case, you shouldn't use local variables outside function scope. If you do that and then execute the add-on through the console window (not in-game), the game will crash.

So, the button doesn't appear on the admin GUI? In any case, you shouldn't use local variables outside function scope. If you do that and then execute the add-on through the console window (not in-game), the game will crash.
No it does not. Should I do this?
Code: [Select]
$FetchAllButton = new GuiBitmapButtonCtrl(Button_FetchAll)
{
profile = "BlockButtonProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "205 172";
extent = "99 19";
minExtent = "8 2";
visible = "1";
command = "adminGui::FetchAll();";
text = "Fetch All";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
lockAspectRatio = "0";
alignLeft = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};

adminGui.add($FetchAllButton);

You don't need to set a variable for it (just use adminGui.add( Button_FetchAll );). Why it isn't appearing in the first case I currently can't see.

You don't need to set a variable for it (just use adminGui.add( Button_FetchAll );). Why it isn't appearing in the first case I currently can't see.
Ok, I figured out why it's not appearing, it's because Client_AdminGUIPlus is executed after my add on which means all I have to do is change the name.

How can I make the GUI window control it's parent? I tried adminGUI.GuiWindowCtrl.Add(Button_FetchAll); to no effect.

The name of the window is not "GuiWindowControl". Just look in the GUI to find the name of the window.
If it doesn't have a name, adminGUI.getObject( 0 ).add( button_fetchAll ); should work.

The name of the window is not "GuiWindowControl". Just look in the GUI to find the name of the window.
If it doesn't have a name, adminGUI.getObject( 0 ).add( button_fetchAll ); should work.
Thanks Port, your awesome!

*Topic Locked*
« Last Edit: January 20, 2012, 09:45:55 AM by jes00 »

This is what happens when I do this adminGUI.getObject(9).position = "209 134";
Code: (console) [Select]
adminGUI.getObject(9).position = "209 134";
Set::getObject index out of range on adminGui. Index = 9, Size = 1

EDIT: Nvm, adminGUI.getObject(0).getObject(8).position = "209 134";
« Last Edit: January 20, 2012, 09:51:21 AM by jes00 »