BBjTabCtrl

Description

The BBjTabCtrl object provides methods for manipulating a GUI tab control.

Implemented Interfaces

DropTarget, Focusable, TabTraversable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjTabCtrl

A BBjTabCtrl object is created through the following BBjWindow methods:

Return Value

Method

BBjTabCtrl

addTabCtrl()

BBjTabCtrl

addTabCtrl(int ID)

BBjTabCtrl

addTabCtrl(int ID, number x, number y, number w, number h)

BBjTabCtrl

addTabCtrl(int ID, number x, number y, number w, number h, string flags)

BBjTabCtrl

addTabCtrl(int ID, number x, number y, number w, number h, string flags, string styles)

BBjTabCtrl

addTabCtrl(int ID, number x, number y, number w, number h, string flags, string styles, string tabDesc)

BBjTabCtrl

addTabCtrl(int ID, number x, number y, number w, number h, string flags, string styles, string tabDesc, int imageList)

BBjTabCtrl

addTabCtrl(int ID, string flags)

BBjTabCtrl

addTabCtrl(int ID, string flags, string styles)

BBjTabCtrl

addTabCtrl(int ID, string flags, string styles, string tabDesc)

BBjTabCtrl

addTabCtrl(int ID, string flags, string styles, string tabDesc, int imageList)

BBjTabCtrl

addTabCtrl(string flags)

BBjTabCtrl

addTabCtrl(string flags, string styles)

BBjTabCtrl

addTabCtrl(string flags, string styles, string tabDesc)

BBjTabCtrl

addTabCtrl(string flags, string styles, string tabDesc, int imageList)

Methods of BBjTabCtrl

Return Value

Method

void

addTab(string title, BBjControl control!)

void

addTab(string title, int controlID)

void

addTab(string title, int imgIndex, BBjControl control!)

void

addTab(string title, int imgIndex, int controlID)

void

clearImageSizeAt(int index)

BBjColor

getBackColorAt(int index)

BBjControl

getControlAt(int index)

int

getControlIDAt(int index)

BBjColor

getForeColorAt(int index)

int

getImageHeightAt(int index)

int

getImageIndexAt(int index)

int

getImageListID()

string

getImageListPath()

int

getImageWidthAt(int index)

int

getNumTabs()

int

getSelectedIndex()

int

getTabPlacement()

string

getTitleAt(int index)

string

getToolTipTextAt(int index)

void

insertTab(int index, string title, BBjControl control!)

void

insertTab(int index, string title, int controlID)

void

insertTab(int index, string title, int imgIndex, BBjControl control!)

void

insertTab(int index, string title, int imgIndex, int controlID)

boolean

isCloseable()

boolean

isCloseableAt(int index)

boolean

isEnabledAt(int index)

boolean

isMultiLine()

void

removeTab(int index)

void

setBackColorAt(int index, BBjColor color)

void

setCloseable(boolean closeable)

void

setCloseableAt(int index, boolean closeable)

void

setControlAt(int index, BBjControl control!)

void

setControlIDAt(int index, int controlID)

void

setEnabledAt(int index, boolean enabled)

void

setForeColorAt(int index, BBjColor color)

void

setImageAt(int index, BBjImageimage)

void

setImageIndexAt(int index, int imgIndex)

void

setImageListID(int ID)

void

setImageListPath(string pathFile)

void

setImageSizeAt(int index, number width, int height)

void

setMultiLine(boolean multi)

void

setNumTabs(int num)

void

setSelectedIndex(int index)

void

setTabHeight(int height)

void

setTabPlacement(int place)

void

setTitleAt(int index, string title)

void

setToolTipTextAt(int index, string toolTipText)

Methods of BBjTabCtrl implemented for DropTarget

Return Value Method
int getDropActions()
void setDropActions(int actions)
BBjVector getDropTypes()
void setDropTypes(BBjVector types)

Methods of BBjTabCtrl implemented for Focusable

Return Value Method
boolean isFocusable()
void setFocusable(boolean focus)

Methods of BBjTabCtrl implemented for TabTraversable

Return Value Method
boolean isTabTraversable()
void setTabTraversable(boolean trav)

Methods of BBjTabCtrl from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

ON_LOST_FOCUS

BBjLostFocusEvent

Control Focus Gained/Lost Event

f

ON_MOUSE_ENTER

BBjMouseEnterEvent

Mouse Enter/Exit Event

E

ON_MOUSE_EXIT

BBjMouseExitEvent

Mouse Enter/Exit Event

E

ON_POPUP_REQUEST

BBjPopupRequestEvent

Popup Request Event

r

ON_RIGHT_MOUSE_DOWN

BBjRightMouseDownEvent

Right Mouse Button Down Event

R

ON_TAB_CLOSE

BBjTabCloseEvent

Tab Close Notify Event

N (notify code 4)

ON_TAB_POPUP

BBjTabPopupEvent

Tab Popup Notify Event

N (Notify code 5)

ON_TAB_DESELECT

BBjTabDeselectedEvent

Tab Deselection Notify Event

N (Notify code 3)

ON_TAB_KEYPRESS

BBjTabKeypressEvent

Keypress Notify Event - Tab Control

N (Notify code 1)

ON_TAB_SELECT

BBjTabSelectedEvent

Tab Selection Notify Event

N (Notify code 2)

BUI logoCSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

To see the effect of some simple CSS rules, use the following BBjTabCtrl sample:

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(100,100,200,200,"TabCtrl",$00090083$,$$)
tabctrl! = window!.addTabCtrl(101,10,10,180,180,$0010$)
window!.setCallback(bbjapi().ON_CLOSE,"eoj")
for tab = 0 to 3
    child = 1000 + tab
    child! = window!.addChildWindow(child,0,0,150,130,"",$00000810$,child,$$)
    child!.addEditBox(101,10*tab+10,10*tab+10,60,25,str(tab))
    tabctrl!.addTab("Tab "+str(tab),child!)
next tab
window!.setTitle("TabCtrl ("+str(tab)+" tabs)")
tabctrl!.setVisible(1)

process_events

eoj:
release

With the default CSS, that BBjTabCtrl looks like this:

The BBjTabCtrl defines the following CSS style names:

.BBjTabCtrl (the top level control)

.BBjTabCtrl.bbj-disabled (the tab control is disabled)

.BBjTabCtrl.bbj-focused (the tab control is focused)

.BBjTabCtrl-tabs (the tab bar running across the top)

.BBjTabCtrl-tab (an individual tab)

.BBjTabCtrl-tab-close (an individual tab)

.BBjTabCtrl-tab-selected (the close button on a tab)

.BBjTabCtrl-tab.bbj-disabled (a disabled tab)

.BBjTabCtrl-contentContainer (the body area of the tab that contains the currently selected tab child window)

.BBjTabCtrl-content (the window added to the tab)

The following test CSS gives the tabs a shiny purple-blue appearance shown below:

.BBjTabCtrl-tab
{
    color: white !important;
    background-color: #00009f !important;
    background-image: radial-gradient(160% 100% at 50% 0%,hsla(0,0%,100%,.3),hsla(0,0%,100%,.3) 50%,hsla(0,0%,100%,0) 52%, hsla(0,30%,400%,0)) !important;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}
.BBjTabCtrl-tab-selected
{
background-color: #00005f !important;
}
.BBjTabCtrl-contentContainer
{
        border-color: #f0f0f0 !important;
}

Remarks

In BBj 17.00 and higher, setting the PRESERVE_TABCTRL_SIZE !COMPAT setting  to TRUE preserves the original size of  controls added to a BBjTabCtrl, the original behavior of BBj. By default, controls are now resized to take the full available width and height within the BBjTabCtrl client area.

Constants

TOP
BOTTOM
RIGHT
LEFT

Constants inherited from BBjControl

Example

rem ' BBjTabCtrl

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(100,100,400,300,"BBjTabCtrl",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
tabctrl! = window!.addTabCtrl(101,25,25,350,200)
tabctrl!.setCallback(tabctrl!.ON_TAB_SELECT,"select")
tabctrl!.setCallback(tabctrl!.ON_TAB_CLOSE,"close")
for i = 1 to 4
    child! = window!.addChildWindow(200+I,50,50,200,100,"",$00000800$,I,$$)
    text$ = "Child Window " + str(I)
    text! = child!.addStaticText(300+I,i*10,i*10,150,25,text$)
    title$ = "Tab " + str(I)
    tabctrl!.addTab(title$,child!)
next i

closeable! = window!.addCheckBox(102,25,250,150,25,"setCloseable",$$)
closeable!.setCallback(closeable!.ON_CHECK_ON,"setCloseable1")
closeable!.setCallback(closeable!.ON_CHECK_OFF,"setCloseable0")
closeableAt! = window!.addCheckBox(103,200,250,150,25,"setCloseableAt",$$)
closeableAt!.setCallback(closeable!.ON_CHECK_ON,"setCloseableAt1")
closeableAt!.setCallback(closeable!.ON_CHECK_OFF,"setCloseableAt0")

process_events

eoj:
release

select:
    event! = sysgui!.getLastEvent()
    index = event!.getIndex()
    title$ = event!.getTitle()
    print "Selected index",index,": ",title$
    closeableAt!.setSelected(tabctrl!.isCloseableAt(index))
    closeableAt!.setText("setClosebleAt "+str(index))
return

setCloseable0:
    tabctrl!.setCloseable(0)
return

setCloseable1:
    tabctrl!.setCloseable(1)
return

setCloseableAt0:
    tabctrl!.setCloseableAt(tabctrl!.getSelectedIndex(),0)
return

setCloseableAt1:
    tabctrl!.setCloseableAt(tabctrl!.getSelectedIndex(),1)
return

close:
    event! = sysgui!.getLastEvent()
    index = event!.getIndex()
    title$ = event!.getTitle()
    query$ = "Close tab #"+str(index)+" ("""+title$+""")?"
    if (msgbox(query$,4+32+256,"ON_TAB_CLOSE") = 6) then
        tabctrl!.removeTab(index)
    endif
return

See Also

BBjAPI

BBjSysGui

BBjWindow

TABCTRL Mnemonic - Create a Tab Control

CALLBACK Verb - Register BBj Subroutine

DWC Component: dwc-tabbed-pane

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.