Hi Dick,
did you ever create HTML pages using tables? That sure helps, as it is
the same principle of nesting. The problem with widgets is that the ROW
and COLUMN keywords just work weired. Setting ROW=n will create n rows
in the end, however, subseqent elements are put in subsequent columns.
Just an example:
base=widget_base(row=3)
a=widget_button(base, value="a")
b=widget_button(base, value="b")
c=widget_button(base, value="c")
d=widget_button(base, value="d")
widget_control, base, /real
will create a widget which looks loke this:
a b
c
d
So we have three rows, as we defined, but not that the buttons were
filled in row after row, that woul have been too easy ...
As for your special problem, the key is the subsequent useage of base
widgets. I have written an example just using widget buttons just to
illustrate the main points:
; This is the main widget, it has two columns, one for the
; skinny draw widget on the right, one for all the rest.
base = widget_base(col=2)
; All the left parts go into their own base widget,
; which will have 3 rows:
; The draw widgets, the cw_sliders, and another base widget with
; more sliders and buttons:
left = widget_base(base, row=3)
; Here comes the skinny draw widget, based in the root widget:
skinny = widget_button( $
base, $
value="skinny draw widget", $
xsize=100, ysize=300 $
)
; Now for the draw widgets, based in the "left" widget. Just to be sure
; we use another base widget where we specify that all
; draw widgets go into one row:
draw = widget_base(left, row=1)
d1 = widget_button(draw, value="first draw widget")
d2 = widget_button(draw, value="second draw widget")
; Now for the sliders: same approach:
sliders = widget_base(left, row=1)
s1 = widget_button(sliders, value = '1st slider')
s2 = widget_button(sliders, value = '2nd slider')
s3 = widget_button(sliders, value = '3rd slider')
s4 = widget_button(sliders, value = '4th slider')
; Now the sliders and buttons are more complicated, we
; need another base widgets holding in turn the left part
; (the columns of sliders) and the right part (the set of buttons)
; This base widget has only one row, as it will only contain
; two more base widgets:
sliders_and_buttons = widget_base(left, row=1)
; This is the base widget for the sliders. You want two columns with
; four rows here, so we could set either row = 4 or columns = 2, but
; we use col = 2 as we want subsequent sliders appear beneath
; each other:
sliders = widget_base(sliders_and_buttons, col = 2)
s1 = widget_button(sliders, value = '1st slider')
s2 = widget_button(sliders, value = '2nd slider')
s3 = widget_button(sliders, value = '3rd slider')
s4 = widget_button(sliders, value = '4th slider')
s5 = widget_button(sliders, value = '5th slider')
s6 = widget_button(sliders, value = '6th slider')
s7 = widget_button(sliders, value = '7th slider')
s8 = widget_button(sliders, value = '8th slider')
: Now the set of buttons is to appear in one column:
buttons = widget_base(sliders_and_buttons, col = 1)
b1 = widget_button(buttons, value = '1st button')
b2 = widget_button(buttons, value = '2nd button')
b3 = widget_button(buttons, value = '3rd button')
; That's it :-)
widget_control, base, /real
Cheers,
Peter
|