BBjTabCtrl
Creation Path
BBjAPI
|
+--BBjSysGui
|
+--BBjWindow
|
+--BBjTabCtrl
Description
The BBjTabCtrl object provides methods for manipulating a GUI tab control.
Implemented Interfaces
DropTarget , Focusable , TabTraversable
Creation
A BBjTabCtrl object is created through the following BBjWindow methods:
Return Value
Method
BBjTabCtrl
addTabCtrl (int ID , int x, int y, int w, int h )
BBjTabCtrl
addTabCtrl (int ID , int x, int y, int w, int h , string flags )
BBjTabCtrl
addTabCtrl (int ID , int x, int y, int w, int h , string flags , string styles )
BBjTabCtrl
addTabCtrl (int ID , int x, int y, int w, int h , string flags , string styles , string tabDesc )
BBjTabCtrl
addTabCtrl (int ID , int x, int y, int w, int h , 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 , BBjImage image )
void
setImageIndexAt (int index , int imgIndex )
void
setImageListID (int ID )
void
setImageListPath (string pathFile )
void
setImageSizeAt (int index , int 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
Methods of BBjTabCtrl implemented for Focusable
Methods of BBjTabCtrl implemented for TabTraversable
Methods of BBjTabCtrl from BBjControl
Events
CSS
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 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
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
Focusable
TabTraversable
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.
______________________________________________________________________________________
Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.