X
3233

How to Construct a WIDGET_TABLE With No Row Labels


Normally when a table widget is constructed, the row headers will contain numbers if no row labels are specified. Is it possible to construct a table which has no row labels?

When creating a table via the WIDGET_TABLE routine, simply set the keyword ROW_LABELS equal to a null string ('') to make a table with no row labels. Please note that the fields for the row headers will still be shown, but they will be empty. See the Example Code section below.
; ---------------------------------------------------------
PRO noRowLabels_Event, ev

WIDGET_CONTROL, ev.top, /DESTROY

END

; ---------------------------------------------------------
PRO noRowLabels
tlb = WIDGET_BASE( TITLE='Table test' )

table_base = WIDGET_BASE( tlb, /COLUMN )

;set the column labels
col_labels = [ ' Label 1 ',$
' Label 2 ',$
' Label 3 ',$
' Label 4 ',$
' Label 5 ']

;Set the variable ncols equal to the number of elements in the col_labels array
ncols = N_ELEMENTS(col_labels)

;Build the table, notice the ROW_LABELS keyword is set to a null string. Also
; notice the XSIZE of the table is equal to ncols.
table = WIDGET_TABLE( table_base, $
COLUMN_LABELS=col_labels, $
ROW_LABELS='', $
XSIZE=ncols, $
YSIZE=6 )

exit_btn = WIDGET_BUTTON( table_base, VALUE='Exit' )

WIDGET_CONTROL, tlb, /REALIZE

XMANAGER, 'noRowLabels', tlb

END