1 | PRO changefield, base, newfieldname, BOXZOOM = boxzoom |
---|
2 | ; |
---|
3 | ; |
---|
4 | compile_opt idl2, strictarrsubs |
---|
5 | ; |
---|
6 | widget_control, base, get_uvalue = top_uvalue |
---|
7 | ; |
---|
8 | ; Change exextra : |
---|
9 | exextra = definedefaultextra(newfieldname) |
---|
10 | specifieid = widget_info(base, find_by_uname = 'specifie') |
---|
11 | widget_control, specifieid, set_value = exextra |
---|
12 | ; Change the variable -> Do we need to change the vertical axis |
---|
13 | ; according to the tye of points (T or W)? |
---|
14 | dthlv1id = widget_info(base, find_by_uname = 'dthlv1') |
---|
15 | widget_control, dthlv1id, get_uvalue = dthlv1_uval |
---|
16 | oldzgridt = dthlv1_uval.grid_t |
---|
17 | ; get the type of point |
---|
18 | currentfile = extractatt(top_uvalue, 'currentfile') |
---|
19 | listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid |
---|
20 | listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar |
---|
21 | ; for i = 0, n_elements(listvar)-1 do print, listvar[i], '/', listgrid[i] |
---|
22 | indexvar = where(listvar EQ newfieldname) |
---|
23 | indexvar = 0 > indexvar[0] |
---|
24 | zgridt = strupcase(listgrid[indexvar]) NE 'W' |
---|
25 | ; if we change the type of point |
---|
26 | if zgridt NE oldzgridt then BEGIN |
---|
27 | ; update dthlv1_uval.grid_t |
---|
28 | dthlv1_uval.grid_t = zgridt |
---|
29 | widget_control, dthlv1id, set_uvalue = dthlv1_uval |
---|
30 | ; update cw_domain |
---|
31 | if NOT keyword_set(boxzoom) THEN $ |
---|
32 | widget_control, widget_info(base, find_by_uname = 'domain'), get_value = boxzoom |
---|
33 | widget_control, widget_info(base, find_by_uname = 'domain'), set_value = boxzoom |
---|
34 | endif |
---|
35 | ; |
---|
36 | return |
---|
37 | end |
---|