Using Tabs on a Dialog Box

This complete script demonstrates how to implement tabs on your dialog box. Use this as a template to build your tab-based dialog box.

//	Example to show how to use tabs

/*

*/

const string tabStrings[] = {"Failure", "History", "Notification"}
DB box = centered "Example"
DBE theTab, Frame1, Frame2, Frame3 , theTextBox

Skip skipTabs = create    // tab skip list - holds the following frame skip lists

Skip skipFrame1 = create  // to hold elements associated with frame1
Skip skipFrame2 = create  // to hold elements associated with frame2
Skip skipFrame3 = create  // to hold elements associated with frame3

/***************************************
	tabsShow

	show all the DBEs in the skip list
****************************************/
void tabsShow(Skip skp)
{
	DBE element

   	for element in skp do
  	{
       	show element
   	}
}

/*************************************
	tabsHide

	hide all the DBEs in the skip list
*************************************/
void tabsHide(Skip skp)
{
	DBE element

   	for element in skp do
  	{
       	hide element
   	}
}

/*********************************
	showSelected
*********************************/
void showSelected(int selectedTab)
{
	int index

    Skip elementsSkip

    for elementsSkip in skipTabs do
    {
        index = (int key skipTabs)

        if (index == selectedTab)
        {
            tabsShow(elementsSkip)
        }
        else
        {
            tabsHide(elementsSkip)
        }
    }
}

void tabCb(DBE clicktab)
{
	int i = get clicktab
	showSelected(i)
}

theTab = tab(box, tabStrings, 800, 500, tabCb)
theTab->"left"->"form"
theTab->"right"->"form"
theTab->"top"->"form"
theTab->"bottom"->"form"

Frame1 = frame(box, "Test Case Details", 100, 100)
put(skipFrame1, Frame1, Frame1)
Frame1->"left"->"inside"->theTab
Frame1->"right"->"inside"->theTab
Frame1->"top"->"inside"->theTab
Frame1->"bottom"->"inside"->theTab

Frame2 = frame(box, "History", 100, 100)
put(skipFrame2, Frame2, Frame2)
Frame2->"left"->"inside"->theTab
Frame2->"right"->"inside"->theTab
Frame2->"top"->"inside"->theTab
Frame2->"bottom"->"inside"->theTab
put(skipTabs, 1, skipFrame2)

Frame3 = frame(box, "Notification", 100, 100)
put(skipFrame3, Frame3, Frame3)
Frame3->"left"->"inside"->theTab
Frame3->"right"->"inside"->theTab
Frame3->"top"->"inside"->theTab
Frame3->"bottom"->"inside"->theTab

theTextBox = text(box,"Test Case ID:",null,100,20,false)
put(skipFrame1, theTextBox, theTextBox)
theTextBox->"left"->"inside"->Frame1
theTextBox->"right"->"unattached"
theTextBox->"top"->"inside"->Frame1
theTextBox->"bottom"->"unattached"

put(skipTabs, 0, skipFrame1)  // key must match the tab index returned by get(theTab)
put(skipTabs, 1, skipFrame2)
put(skipTabs, 2, skipFrame3)  

realize box
set(theTab, 0)
showSelected(0)
show box