Hi Lee,
Unfortunately this is something that you will have to try and build yourself. I do have a bit of example code which uses a secondary widget to display the contents of a selected cell from a widget table. This was made for a similar case where the cell width couldn't be increased to hold the text contents of the widget. Save this code as table_example_gui.pro
;======================================
pro table_example_gui_event, event
compile_opt idl2
widget_control, event.top, get_uvalue = stash
;if there is an event, then check which widget button is pressed
CASE TAG_NAMES(event, /STRUCTURE_NAME) OF
'WIDGET_TABLE_CELL_SEL': BEGIN
;cell selection event, make sure it is not a deselection event, which
;returns -1 values for cells
if ((event.type eq 4) AND (event.sel_right ne -1) AND (event.sel_bottom ne -1)) then begin
widget_control, stash.widget_table,get_value = table_data, get_uvalue = headers
column = event.sel_right
row = event.sel_bottom
widget_control, stash.cell_display, set_value = $
(orderedhash(((table_data[row])[0]), /extract))[headers[column]]
endif
END
;move the second base to the right of the original base
'WIDGET_TLB_MOVE': BEGIN
widget_control, event.top, TLB_GET_SIZE = TLB_DIMS
widget_control, stash.cell_base, $
TLB_SET_YOFFSET = event.y-5,$
TLB_SET_XOFFSET = event.x + TLB_DIMS[0] + 10
END
;close both widgets when the first is closed
'WIDGET_KILL_REQUEST':BEGIN
widget_control, stash.cell_base, /destroy
widget_control, stash.table_base, /destroy
END
ELSE:;do nothing
ENDCASE
end
pro table_example_gui
compile_opt idl2
;table column width
cwidth = [100,60,1000]
;;Top level base
table_base = widget_base(title='Table_example', /column, $
MBAR = bar, $
tlb_FRAME_ATTR=1,$
UNAME='window_tl_base',$
scr_xsize = 500,$
x_scroll_size = total(cwidth),$
yoffset = 5, /TLB_KILL_REQUEST_EVENTS)
;;generate sample subset of data for table
tmp = {T_d, $
NAME: '', $
ID: '', $
DESCR: ''}
table_d = replicate({T_d}, 3)
table_d[0].NAME ="John Doe"
table_d[0].ID ='000000'
table_d[0].DESCR ='A short description.'
table_d[1].NAME ="Jane Doe"
table_d[1].ID ='000001'
table_d[1].DESCR ='A description that is somewhat longer, but still short enough to read by scrolling right.'
table_d[2].NAME ='NID'
table_d[2].ID ='000002'
table_d[2].DESCR ='A description that is quite long, so long in fact that it will not fit within the preset 500px table width, so you cannot read this part even if you scroll.'
widget_table = widget_table(table_base, $
/DISJOINT_SELECTION, $
COLUMN_WIDTHS=cwidth, $
COLUMN_LABELS=['Name', 'ID','Description'], $
SENSITIVE=1,$
value = table_d,$
uvalue = ['NAME', 'ID', 'DESCR'],$
scr_xsize = total(cwidth))
widget_control, widget_table, /all_table_events
;widget base for displaying the cell contents
tl_base2 = widget_base(/column, title = 'Cell Viewer', /TLB_KILL_REQUEST_EVENTS)
cell_display = widget_text(tl_base2, $
xsize = 60, $
ysize = 5, $
/wrap, $
/align_left,$
/scroll,$
value = table_d[0].NAME)
;GUI struct
stash = { widget_table:widget_table,$
table_base:table_base,$
cell_display:cell_display,$
cell_base:tl_base2}
;realize GUI
widget_control, table_base, set_uvalue=stash, /realize, /tlb_move_events
;get widget size and move second widget to the right of the first
widget_control, table_base, TLB_GET_SIZE = TLB_DIMS
widget_control, tl_base2, /realize
widget_control, tl_base2, $
TLB_SET_YOFFSET = 0,$
TLB_SET_XOFFSET = TLB_DIMS[0] + 10
xmanager, 'table_example_gui', table_base, /no_block
END
;=======================================
|