BBjTabCtrl::isCloseableAt

Description

In BBj 16.0 and higher, this method returns whether a specific BBjTabCtrl tab currently includes a close button.

Syntax

Return Value

Method

boolean

isCloseableAt(int index)

Parameters

Variable

Description

index

Specifies the 0-based index of tab.

Return Value

Returns whether the tab currently shows a close button (0 = No close button, 1 = Close button).

Remarks

Clicking the close button fires an ON_TAB_CLOSE_EVENT, which the program is free to honor or ignore.  By default, the BBjTabCtrl does not show close buttons on tabs.

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

BBjControl

BBjWindow

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