Author Topic: Gui help  (Read 3950 times)

OK, so I had an old topic to help me, sorry but I doubt most have the time to just use Blockland all the time and guess the topic expired. (Add a button)

After a bit of thinking I've decided to make the addon primarily gui edited. This will make it easier for you guys to explain it and for the users to use it.

Code: [Select]
new GuiBitmapButtonCtrl() {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "91 38";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
command = "function();";
text = "Button";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button2";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};

Or if you use the GUI editor just add a new control, and search for GuiBitmapButtonCtrl

That's not what I need I have the gui editor, and I know how to use it.

I think he wants to dynamically add tabs, like google chrome's window tabs.

Well how about a link to the old topic or an explanation what you want

Oh the quote goes to the old topic
Well
Now you still have to give a detailed explanation of what you actually want
« Last Edit: June 23, 2014, 06:59:54 PM by Zeblote »

Well you have a small GUI there, why not just make the tabs, then throw in code to make them visible and set text when someone adds a new one?

You could dofunction YourGui::addButton(), and make the new button's position use the previous one's and += it by 30 or something.

Yeah those are good Ideas. Is there a way to have the button specs. I've worked with tabs before and I understand how to make things "visible". Thanks

Yeah those are good Ideas. Is there a way to have the button specs. I've worked with tabs before and I understand how to make things "visible". Thanks

By have are you trying to pull the information, or alter the information?

I guess "pull". Do I have to have the script for the gui button prewritten, then call it when needed? If so, then where do I put it and what do I type.

You could dofunction YourGui::addButton(), and make the new button's position use the previous one's and += it by 30 or something.

 How would I get the previous' pos?
« Last Edit: June 24, 2014, 10:22:34 PM by KingDavid »

I'd just do a $TabsSpace then on a new one + w/e to it, and do guiControlName.position=($TabsSpace@" number");

I recommend installing torque 3D and using their built in GUI editor. It's allot less buggy and packed with more features then blocklands

The way I would do this would be as follows.

%newTabPos = (%numTabs * (%tabWidth + %spacing) SPC %YPos; //Where %numTabs = current number of tabs, %tabWidth = the width of the button tab, %spacing = the separation of each tab, %YPos = the Y position of all tabs
GUIWindow.add(newButton); //Adds a predefined button named newButton to the GUI's windowCtrl
newButton.position = %newTabPos; //Shifts the button to the correct position
%numTabs++; //Increases %numTabs by 1

Ahh, that makes sense I'll put the code in order. Thanks blockheads.

Ok, I got the last thing to work. I usually try to search something before I ask, but I can't get this to work.
Code: [Select]
if(%client.isOwner)
{
Edit.setVisible(1);
}
else
{
Edit.setVisible(0);
}
I have also tried
Code: [Select]
if(getTrustLevel(%client,%obj) >= 3)

Ok, I got the last thing to work. I usually try to search something before I ask, but I can't get this to work.
Code: [Select]
if(%client.isOwner)
{
Edit.setVisible(1);
}
else
{
Edit.setVisible(0);
}
I have also tried
Code: [Select]
if(getTrustLevel(%client,%obj) >= 3)

isOwner of what? I don't think that's a default thing so that will have to be defined. And is %obj ever defined when you tried it?