I suspect that you have not studied the WIDGET_TAB widgets that were added to IDL just a few versions ago. The example below combines the example that you can access through Online Help for WIDGET_TREE (follow the 'Using Tree Widgerts' link) with the example from WIDGET_TAB's Help page (follow the 'Using Tab Widgets' link). Let me know, if this does not demonstrate what you are looking for.
; Single event handler for TREE_AND_TAB_PAGES_EX
PRO tree_and_tab_pages_ex_event, event
widget_control, event.top, GET_UVALUE=info
case event.id of
; Note: The first 3 WIDGET_TREE events are all followed by WIDGET_TAB events.
info.wL1: widget_control, info.wTab, SET_TAB_CURRENT=0
info.wL2: widget_control, info.wTab, SET_TAB_CURRENT=1
info.wL3: widget_control, info.wTab, SET_TAB_CURRENT=2
else: print, 'Detected ' + tag_names(event, /STRUCTURE_NAME) + $
' event from widget #' + strtrim(event.id, 2)
endcase
END
; Widget creation code
PRO tree_and_tab_pages_ex
tlb = widget_base(/ROW, TITLE='Tree-controlled Tab Pages')
wTree = widget_tree(tlb)
wRoot = widget_tree(wTree, VALUE='Root', /FOLDER, /EXPANDED)
wLeaf1 = widget_tree(wRoot, VALUE='Tab Page 1')
wLeaf2 = widget_tree(wRoot, VALUE='Tab Page 2')
wLeaf3 = widget_tree(wRoot, VALUE='Tab Page 3')
wTab = widget_tab(tlb)
; Create the first tab base, containing a label and two
; button groups.
wT1 = widget_base(wTab, TITLE='TAB 1', /COLUMN)
wLabel = widget_label(wT1, VALUE='Choose values')
wBgroup1 = cw_bgroup(wT1, ['one', 'two', 'three'], $
/ROW, /NONEXCLUSIVE, /RETURN_NAME)
wBgroup2 = cw_bgroup(wT1, ['red', 'green', 'blue'], $
/ROW, /EXCLUSIVE, /RETURN_NAME)
; Create the second tab base, containing a label and
; a slider.
wT2 = widget_base(wTab, TITLE='TAB 2', /COLUMN)
wLabel = widget_label(wT2, VALUE='Move the Slider')
wSlider = widget_slider(wT2)
; Create the third tab base, containing a label and
; a text-entry field.
wT3 = widget_base(wTab, TITLE='TAB 3', /COLUMN)
wLabel = widget_label(wT3, VALUE='Enter some text')
wText= widget_text(wT3, /EDITABLE, /ALL_EVENTS)
widget_control, tlb, /REALIZE
info = {wL1:wLeaf1, wL2:wLeaf2, wL3:wLeaf3, wTab:wTab, wBG1:wBgroup1, $
wBG2:wBgroup2, wSlider:wSlider, wText:wText}
widget_control, tlb, SET_UVALUE=info
XMANAGER, 'tree_and_tab_pages_ex', tlb
END
James Jones
|