| Home Page | Recent Changes | Preferences

Sir Brizz/Developer Journal

Woo Woo!! My experiences as a UScript coder!! :D

Tab Controls!

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

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

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 BJ Cardon
//  (c) 2002, Premonition Software
// ====================================================================
class Tabs_Ctrl extends GUITabPanel;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
         Super.InitComponent(MyController, MyOwner);
}

defaultproperties
{

}

How to use it!

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 BJ Cardon
//  (c) 2002, Premonition Software
// ====================================================================
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

If anyone has any other suggestions, let me know :)


Category Journal

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In