My program doesn't have bugs. It just develops random features.

Legacy:Tab Controls

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

NOTE THAT THIS WORKS FOR UT2003 ONLY![edit]

Tab Controls![edit]

Ok, I had PLENTY of trouble trying to get Tab Controls to work like I wanted in my program. I got a mediocre amount of help at the BuF Coding forum, but mostly this is my own work. First of all there are things you have to know about how the Tab Controls work :)

GUITabControl[edit]

The Tab Control is just like what it sounds like. It's a control which can show tabs in a Dialog Box. Unfortunately, getting the tab control to work requires more than just creating the Tab Control. You also have to worry about the Tab Panel, which is the actual tab. This was the hard thing to understand going through this.

GUITabPanel[edit]

The Tab Panel actually controls the Tabs that are in your Tab Control. You have to add Tabs through it and remove them there also. If you were making a Tab Control where the Tabs showed up depending on certain options, you would have to use the RemoveTab() function in Tab Panel. Likewise, to add, you would have to use the AddTab() function. To get the tab control to work, you have to properly create a subclass of the TabPanel. Here's an example:

// ====================================================================
//  Class:  MyClass.Tab_Cntrl
//  Parent: XInterface.GUITabPanel
//
//  Description: A Tab Panel
//
//  Written by Sir_Brizz
// ====================================================================
class Tabs_Ctrl extends GUITabPanel;
 
function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
         Super.InitComponent(MyController, MyOwner);
}
 
defaultproperties
{
 
}

How to use it![edit]

Now you're probably asking: What is the point of that? I'll tell you what, you have to have your own TabPanel class to creat Tabs. You can't just do it with the Tab Control (yes, I learned the hard way...alot of crashing! :)). Here's an example of what you need in your Config code:

// ====================================================================
//  Class:  MyClass.MutatorConfig
//  Parent: XInterface.GUIPage
//
//  Description:  A Config Page
//
//  Written by Sir_Brizz
// ====================================================================
class MutatorConfig extends GUIPage
            config(user);
 
var Tab_Cntrl                tcTabs;
var GUITabControl            myTabs;
 
function InitComponent (GUIController MyController, GUIComponent MyObject)
{
      Super.InitComponent(MyController, MyObject);
      myTabs=GUITabControl(Controls[1]);
 
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab1","MyClass.Tab_Cntrl",,"The hint..not needed",));
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab2","MyClass.Tab_Cntrl",,"The hint..not needed",));
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab3","MyClass.Tab_Cntrl",,"The hint..not needed",));
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab4","MyClass.Tab_Cntrl",,"The hint..not needed",));
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab5","MyClass.Tab_Cntrl",,"The hint..not needed",));
      tcTabs=Tab_Cntrl(myTabs.AddTab("Tab6","MyClass.Tab_Cntrl",,"The hint..not needed",));
 
      return;
}
 
default properties:
{
Begin Object Class=GUIButton name=DialogBackground
      WinWidth=0.85
      WinHeight=0.80
      WinTop=0.10
      WinLeft=0.10
      bAcceptsInput=false
      bNeverFocus=true
      StyleName="ComboListBox"
      bBoundToParent=false
      bScaleToParent=true
   End Object
   Controls(0)=GUIButton'DialogBackground'
 
   Begin Object Class=GUITabControl Name=tcTabsControl
         WinLeft=0.10
         WinTop=0.10
         WinWidth=0.80
         WinHeight=0.80
         TabHeight=0.05
   End Object
   Controls(1)=GUITabControl'tcTabsControl'
}

Concluded=[edit]


Sir_Brizz: I realize it's not complete but it's still helpful.

Sir_Brizz: This doesn't work in UT2004. Anyone know why not?

Kungfu Hampster: It might have something to do with this.