; IDL> testwid ; PRO testwid_event, event ; ; help, event, /struct ; Id = widget_info(event.top,find_by_uname = 'c''est lui') ; widget_control, event.id, get_uvalue=uval ; if n_elements(uval) EQ 0 then return ; case uval of ; 'done':widget_control, event.top, /destroy ; 'set':BEGIN ; widget_control, event.id, get_value = value & value = value[0] ; nothing = execute('boxzoom ='+value) ; widget_control, Id, set_value = boxzoom ; END ; 'get':BEGIN ; widget_control, Id, get_value = value ; print, value ; END ; ELSE: ; endcase ; return ; end ; PRO testwid, _extra = ex ; base=widget_base(/COLUMN) ; print, 'base=', base ; nothing = widget_label(base, value = 'beginning of the test') ; ; ; nothing = cw_domain(base,_extra = ex, uname = 'c''est lui', uvalue = 'c''est lui') ; print, 'cw_domain ID =', nothing ; ; ; nothing = widget_label(base, value = 'end of the test') ; nothing = widget_text(base, value = '[40, 100, -10, 10]', uvalue = 'set', /editable) ; nothing = widget_button(base, value = 'get', uvalue = 'get') ; nothing = widget_button(base, value = 'done', uvalue = 'done') ; widget_control, base, /REALIZE ; xmanager,'testwid', base ; return ; end ; ; ;+ ; ; @file_comments ; ; @categories ; Compound widget ; ; @param ID ; ; ; @param VALUE ; It is the default tick mark value (a floating-point number). ; ; @returns ; ; @uses ; ; @restrictions ; ; @examples ; ; @history ; ; @version ; $Id$ ; ;- PRO cw_domain_set_value, id, value ; compile_opt idl2, strictarrsubs ; @cm_4mesh ; topid = findtopid(id) widget_control, topid, get_uvalue = top_uvalue ;------------------------------------------------ ; make sure that we have the good grid stored in the cm_4mesh common parameters. currentfile = extractatt(top_uvalue, 'currentfile') currentgrid = *(extractatt(top_uvalue, 'meshparameters'))[currentfile] change = changegrid(currentgrid) ;------------------------------------------------ ; What is the type of boxzoom ? currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1 options = extractatt(top_uvalue, 'options') flags = extractatt(top_uvalue, 'optionsflag') flags = flags[*, currentplot] IF (flags[where(options EQ 'Longitude / x index')])[0] EQ 0 THEN $ xtype = 'geographic' ELSE xtype = 'index' IF (flags[where(options EQ 'Latitude / y index')])[0] EQ 0 THEN $ ytype = 'geographic' ELSE ytype = 'index' ;------------------------------------------------ ; How to complete the boxzoom ? IF xtype EQ 'geographic' then begin lonn1 = lon1 lonn2 = lon2 xtitle = 'lon' ENDIF ELSE BEGIN lonn1 = firstxt lonn2 = lastxt xtitle = 'x ind' ENDELSE IF ytype EQ 'geographic' then begin latt1 = lat1 latt2 = lat2 ytitle = 'lat' ENDIF ELSE BEGIN latt1 = firstyt latt2 = lastyt ytitle = 'y ind' ENDELSE ;------------------------------------------------ vertf1 = floor(min([gdepw[0], gdept[0]])) vertf2 = ceil(max([gdepw[0], gdept[0]])) ;------------------------------------------------ Case N_Elements(Value) OF 0:boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] 1:BEGIN if value EQ -1 then boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] $ ELSE boxzoom=[lonn1, lonn2, latt1, latt2, 0.,value[0]] END 2:boxzoom=[lonn1, lonn2, latt1, latt2, value[0],value[1]] 4:boxzoom=[Value] 5:boxzoom=[Value[0:3], 0, Value[4]] 6:boxzoom = Value Else:BEGIN rien = report('Wrong Definition of Boxzoom') END ENDCASE ;------------------------------------------------ boxzoom[0] = floor(boxzoom[0]) boxzoom[1] = ceil(boxzoom[1]) boxzoom[2] = floor(boxzoom[2]) boxzoom[3] = ceil(boxzoom[3]) if n_elements(boxzoom GE 5) then begin boxzoom[4] = floor(boxzoom[4]) boxzoom[5] = ceil(boxzoom[5]) endif ;------------------------------------------------ ;------------------------------------------------ widget_control,widget_info(id,find_by_uname = 'lon1'), get_uvalue = uvalue strict = uvalue.strict ; ; Longitudes ; ; Possible min and max if xtype EQ 'geographic' then BEGIN min = floor(min([glamt,glamf], max = max)) max = ceil(max) ENDIF ELSE BEGIN min = 0 max = jpi-1 ENDELSE ; widgets's id lon1id = widget_info(id,find_by_uname = 'lon1') lon2id = widget_info(id,find_by_uname = 'lon2') ; Do we have to change the type of x axis: longitude/index lonbase = widget_info(id,find_by_uname = 'lonbase') widget_control, lonbase, get_uvalue = lonbase_uvalue if lonbase_uvalue.name NE xtype then BEGIN widget_control, lonbase, update = 0 ; We break everything widget_control, lon1id, /destroy widget_control, lon2id, /destroy ; We reconstruct lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $ , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $ , title = xtitle+'1', minimum = min $ , maximum = (boxzoom[1] < max)-keyword_set(strict)) lon2id = cw_slider_pm(lonbase,value=((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $ , uvalue={name:'lon2', strict:keyword_set(strict)} $ , uname='lon2', title = xtitle+'2', maximum = max $ , minimum = (min > boxzoom[0])+keyword_set(strict)) widget_control, lonbase, set_uvalue = {name:xtype} widget_control, lonbase, update = 1 ENDIF ELSE BEGIN ; The new value they will have cursorvalue1 = min > boxzoom[0] < ((boxzoom[1] < max)-strict) cursorvalue2 = ((min > boxzoom[0])+strict) > boxzoom[1] < max ; We change slider's boundaries widget_control, lon1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict} widget_control, lon2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max} ; We attribute the new value widget_control, lon1id , set_value = cursorvalue1 widget_control, lon2id, set_value = cursorvalue2 ENDELSE ; ; Latitudes ; ; Possible min and max if ytype EQ 'geographic' then begin min = floor(min([gphit,gphif], max = max)) max = ceil(max) ENDIF ELSE BEGIN min = 0 max = jpj-1 ENDELSE ; Do we have to change the type of y axis: latitude/index latbase = widget_info(id,find_by_uname = 'latbase') widget_control, latbase, get_uvalue = latbase_uvalue lat1id = widget_info(id,find_by_uname = 'lat1') lat2id = widget_info(id,find_by_uname = 'lat2') if latbase_uvalue.name NE ytype then BEGIN widget_control, latbase, update = 0 widget_control, lat1id, /destroy widget_control, lat2id, /destroy lat1id = cw_slider_pm(latbase,value=min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $ , uvalue={name:'lat1', strict:keyword_set(strict)},uname ='lat1' $ , title = ytitle+'1', minimum =min $ , maximum = ((boxzoom[3] < max)-keyword_set(strict))) lat2id = cw_slider_pm(latbase,value=((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $ , uvalue={name:'lat2', strict:keyword_set(strict)} $ , uname ='lat2', title = ytitle+'2' ,maximum = max $ , minimum =(min > boxzoom[2])+keyword_set(strict)) widget_control, latbase, set_uvalue = {name:ytype} widget_control, latbase, update = 1 ENDIF ELSE BEGIN cursorvalue1 = min > boxzoom[2] < ((boxzoom[3] < max)-strict) cursorvalue2 = ((min > boxzoom[2])+strict) > boxzoom[3] < max widget_control, lat1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict} widget_control, lat2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max} widget_control, lat1id, set_value = cursorvalue1 widget_control, lat2id, set_value = cursorvalue2 ENDELSE ; if n_elements(boxzoom) EQ 4 then return ; ; depth ; dthlv1id = widget_info(id, find_by_uname = 'dthlv1') dthlv2id = widget_info(id, find_by_uname = 'dthlv2') depth1id = widget_info(id, find_by_uname = 'depth1') depth2id = widget_info(id, find_by_uname = 'depth2') ; which type of point? widget_control, dthlv1id, get_uvalue = dthlv1_uval ; get the new axis if dthlv1_uval.grid_t EQ 1 then gdep = gdept ELSE gdep = gdepw ; Did we change the vertical axis? widget_control, dthlv1id, get_value = dthlv1_value gdep1 = floor(fix(dthlv1_value.combobox_value)) IF array_equal(gdep1, floor(gdep)) NE 1 THEN BEGIN gdep1 = floor(gdep) gdep2 = ceil(gdep) ;; same = where(gdep2-gdep1 EQ 0) ;; if same[0] NE -1 then gdep2[same] = gdep2[same] + 1 widget_control, dthlv1id, set_value = {value:strtrim(gdep1, 1)} widget_control, dthlv2id, set_value = {value:strtrim(gdep2, 1)} ENDIF ELSE gdep2 = gdep1+1 ; We make sure that given depths contains at least one level. if boxzoom[4] GT boxzoom[5] then begin rien = boxzoom[4] boxzoom[4] = boxzoom[5] boxzoom[5] = rien endif ; rien = where(gdep1 LT boxzoom[4], indice1) indice1 = indice1 < (jpk-1) rien = where(gdep2 LE boxzoom[5], indice2) indice2 = indice1 > (indice2-1) ; if indice1 EQ indice2 then BEGIN if (where(gdep1 GE boxzoom[4] AND gdep2 LE boxzoom[5]))[0] EQ -1 then begin indice1 = 0 > (indice1-(dthlv1_uval.grid_t EQ 1)) indice2 = indice1 endif boxzoom[4] = gdep1[indice1] boxzoom[5] = boxzoom[4]+1 endif ; Now, values and indexes are properly defined. ; So we can apply them widget_control, dthlv1id, set_value = {combobox_select:indice1} widget_control, dthlv2id, set_value = {combobox_select:indice2} ; control mins and maxs of sliders... if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] max1 = (min1+1) > gdep1[indice2] widget_control, depth1id, set_value = {slider_min:min1, slider_max:max1, value:boxzoom[4]} min2 = gdep2[indice1] if indice2 EQ jpk-1 then BEGIN max2 = max([gdept, gdepw]) max2 = strtrim(string(max2,format='(e8.0)'), 1) max2 = float('1'+strmid(max2, 1))+float(max2) ENDIF ELSE max2 = gdep1[indice2+1] widget_control, depth2id, set_value = {slider_min:min2, slider_max:max2, value:boxzoom[5]} ; return end ; ;+ ; ; @file_comments ; ; @categories ; Compound widget ; ; @param ID ; ; @returns ; ; @uses ; ; @restrictions ; ; @examples ; ; @history ; ; @version ; $Id$ ; ;- FUNCTION cw_domain_get_value, id ; compile_opt idl2, strictarrsubs ; box = fltarr(6) possiblecase = ['lon1', 'lon2', 'lat1', 'lat2', 'depth1', 'depth2'] for i = 0, 5 do begin widget_control, widget_info(id, find_by_uname = possiblecase[i]) $ , get_value = value box[i] = value.value ENDFOR return, box end ;+ ; ; @file_comments ; ; @categories ; Compound widget ; ; @param EVENT ; ; @returns ; ; @uses ; ; @restrictions ; ; @examples ; ; @history ; ; @version ; $Id$ ; ;- FUNCTION cw_domain_event, event ; compile_opt idl2, strictarrsubs ; @common ; help, /struct, event if (where(tag_names(event) EQ 'OUT'))[0] NE -1 then if event.out NE 0 then return, -1 widget_control, event.id, get_uvalue = uval case uval.name of 'lon1':widget_control,widget_info(event.handler,find_by_uname = 'lon2') $ , set_value = {slider_min:event.value+uval.strict} 'lon2':widget_control,widget_info(event.handler,find_by_uname = 'lon1') $ , set_value = {slider_max:event.value-uval.strict} 'lat1':widget_control,widget_info(event.handler,find_by_uname = 'lat2') $ , set_value = {slider_min:event.value+uval.strict} 'lat2':widget_control,widget_info(event.handler,find_by_uname = 'lat1') $ , set_value = {slider_max:event.value-uval.strict} 'unzoom':BEGIN id = widget_info(event.handler,find_by_uname = 'lon1') widget_control, id, get_value = value widget_control, id, set_value = {slider_min:value.slider_min_max[0]} widget_control, id, set_value = value.slider_min_max[0] id = widget_info(event.handler,find_by_uname = 'lat1') widget_control, id, get_value = value widget_control, id, set_value = {slider_min:value.slider_min_max[0]} widget_control, id, set_value = value.slider_min_max[0] id = widget_info(event.handler,find_by_uname = 'lon2') widget_control, id, get_value = value widget_control, id, set_value = {slider_max:value.slider_min_max[1]} widget_control, id, set_value = value.slider_min_max[1] id = widget_info(event.handler,find_by_uname = 'lat2') widget_control, id, get_value = value widget_control, id, set_value = {slider_max:value.slider_min_max[1]} widget_control, id, set_value = value.slider_min_max[1] END 'dthlv1':BEGIN ; ids... depth1id = widget_info(event.handler,find_by_uname = 'depth1') depth2id = widget_info(event.handler,find_by_uname = 'depth2') dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') ; Do we have to change dthlv2 ? widget_control, event.id, get_value = dthlv1_value gdep1 = fix(dthlv1_value.combobox_value) widget_control, dthlv2id, get_value = dthlv2_value gdep2 = fix(dthlv2_value.combobox_value) if dthlv2_value.combobox_index LT event.index then BEGIN ; We redefine the dthlv2id's value widget_control, dthlv2id, set_value = {combobox_select:event.index} ; So we redefine the value and the max of the slider 2 if event.index EQ jpk-1 then BEGIN max = max([gdept, gdepw]) max = strtrim(string(max,format='(e8.0)'), 1) max = float('1'+strmid(max, 1))+float(max) ENDIF ELSE max = gdep2[event.index+1]-1 widget_control, depth2id $ , set_value = {slider_max:max, value:gdep2[event.index]} ; So we redefine the max of the slider 1 widget_control, depth1id, set_value = {slider_max:gdep1[event.index]} END ; We redefine the value and the min of the slider depth1 if event.index EQ 0 then min = 0 ELSE min = gdep1[event.index-1]+1 widget_control, depth1id, set_value = {slider_min:min, value:gdep1[event.index]} ; S we change the value of the min of the slider depth 2 widget_control, depth2id, set_value = {slider_min:gdep1[event.index]+1} END 'dthlv2':BEGIN ; ids... depth1id = widget_info(event.handler,find_by_uname = 'depth1') depth2id = widget_info(event.handler,find_by_uname = 'depth2') dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') ; Do we have to change dthlv1 ? widget_control, dthlv1id, get_value = dthlv1_value gdep1 = fix(dthlv1_value.combobox_value) widget_control, event.id, get_value = dthlv2_value gdep2 = fix(dthlv2_value.combobox_value) if dthlv1_value.combobox_index GT event.index then BEGIN ; We redfine the value of dthlv1id widget_control, dthlv1id, set_value = {combobox_select:event.index} ; So we redefine the value and the min of the slider 1 if event.index EQ 0 then min = 0 ELSE min = gdep2[event.index-1] widget_control, depth1id $ , set_value = {slider_min:min, value:gdep1[event.index]} ; Se we redefine the min of the slider 2 widget_control, depth2id, set_value = {slider_min:gdep2[event.index]} END ; We redefine the value and the max of the slider depth 2 if event.index EQ jpk-1 then BEGIN max = max([gdept, gdepw]) max = strtrim(string(max,format='(e8.0)'), 1) max = float('1'+strmid(max, 1))+float(max) ENDIF ELSE max = gdep2[event.index+1]-1 widget_control, depth2id, set_value = {slider_max:max, value:gdep2[event.index]} ; So we change the value of the max of the slider depth 1 widget_control, depth1id, set_value = {slider_max:gdep2[event.index]-1} END 'depth1':BEGIN ; ids... depth2id = widget_info(event.handler,find_by_uname = 'depth2') dthlv1id = widget_info(event.handler,find_by_uname = 'dthlv1') ; Do we have to change dthlv1 ? widget_control, dthlv1id, get_value = dthlv1_value gdep1 = fix(dthlv1_value.combobox_value) rien = where(gdep1 LT event.value, indice) indice = indice < (jpk-1) if indice NE dthlv1_value.combobox_index then begin ; We change the min of depth2 widget_control, depth2id, set_value = {slider_min:gdep1[indice]+1} ; We redefine the value of dthlv1id widget_control, dthlv1id, set_value = {combobox_select:indice} ; So we redefine the min of the slider 1 if indice EQ 0 then min = 0 ELSE min = gdep1[indice-1]+1 widget_control, event.id, set_value = {slider_min:min} endif END 'depth2':BEGIN ; ids... depth1id = widget_info(event.handler,find_by_uname = 'depth1') dthlv2id = widget_info(event.handler,find_by_uname = 'dthlv2') ; Do we have to change dthlv2 ? widget_control, dthlv2id, get_value = dthlv2_value gdep2 = fix(dthlv2_value.combobox_value) rien = where(gdep2 LE event.value, indice) indice = 0 > (indice-1) if indice NE dthlv2_value.combobox_index then begin ; We change the min of depth1 widget_control, depth1id, set_value = {slider_max:gdep2[indice]-1} ; We redefine the value of dthlv2id widget_control, dthlv2id, set_value = {combobox_select:indice} ; So we redefine the min of the slider 2 if indice EQ jpk-1 then BEGIN max = max([gdept, gdepw]) max = strtrim(string(max,format='(e8.0)'), 1) max = float('1'+strmid(max, 1))+float(max) ENDIF ELSE max = gdep2[indice+1]-1 widget_control, event.id, set_value = {slider_max:max} endif END ELSE: ENDCASE ; slidesliceid = widget_info(event.top, find_by_uname = 'slide_slice') ; if slidesliceid NE 0 then widget_control, slidesliceid, set_value = 1 return,{ID:event.handler, TOP:event.top, HANDLER:0L $ , BOX:cw_domain_get_value(event.handler)} end ; ;+ ; ; @file_comments ; ; @categories ; Compound widget ; ; @param PARENT {in}{required} ; The widget ID of the parent widget. ; ; @keyword UVALUE ; The user value to be associated with the widget. ; ; @keyword UNAME ; The user name to be associated with the widget. ; ; @keyword STRICT ; ; @keyword UNZOOM ; ; @keyword BOXZOOM ; Vector indicating the geographic zone on which we want to cut the map. ; If BOXZOOM has : ; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]] ; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]] ; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])] ; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]] ; 6 elements: The extraction is made on Boxzoom ; Where lon1, lon2,lat1,lat2 are global variables defined at the last ; domdef! ; ; @keyword _EXTRA ; Used to pass keywords ; ; @returns ; ; @uses ; ; @restrictions ; ; @examples ; ; @history ; ; @version ; $Id$ ; ; @todo ; seb: Documenter ; ;- FUNCTION cw_domain, parent, BOXZOOM=boxzoom, STRICT=strict $ , UVALUE=uvalue, UNAME=uname, UNZOOM=unzoom, _EXTRA=ex ; ; compile_opt idl2, strictarrsubs ; @cm_4mesh @cm_4data ; ; Definition of the boxzoom Case N_Elements(Boxzoom) OF 0:boxzoom = [lon1, lon2, lat1, lat2 $ , min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]]) ] 1:boxzoom = [lon1, lon2, lat1, lat2, 0., boxzoom[0]] 2:boxzoom = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]] 4:boxzoom = [Boxzoom, vert1, vert2] 5:boxzoom = [Boxzoom[0:3], 0, Boxzoom[4]] 6: Else: return, report('Mauvaise Definition de Boxzoom') ENDCASE IF total(Boxzoom) EQ 0 THEN $ boxzoom = [lon1, lon2, lat1, lat2, min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]])] ; boxzoom[0] = floor(boxzoom[0]) boxzoom[1] = ceil(boxzoom[1]) boxzoom[2] = floor(boxzoom[2]) boxzoom[3] = ceil(boxzoom[3]) boxzoom[4] = floor(boxzoom[4]) boxzoom[5] = ceil(boxzoom[5]) ;------------------------------------------------ if NOT keyword_set(uvalue) then uvalue = '' if NOT keyword_set(uname) then uname = '' base = widget_base(parent, row = 2, space = 0 $ , EVENT_FUNC = 'cw_domain_event' $ , FUNC_GET_VALUE = 'cw_domain_get_value' $ , PRO_SET_VALUE = 'cw_domain_set_value' $ , UVALUE = uvalue, UNAME = uname, _extra = ex) ;------------------------------------------------ baseh = widget_base(base, column = 1+keyword_set(unzoom), space = 0) ;------------------------------------------------ baseh1 = widget_base(baseh, row = 2, space = 0) ;-------------longitude--------------------------- min = floor(min([glamt, glamf], max = max)) max = ceil(max) IF max-min GT 360 AND keyword_set(key_periodic) THEN max = min+360 lonbase = widget_base(baseh1, column = 2, space = 0, uname = 'lonbase', uvalue = {name:'geographic'}) lon1id = cw_slider_pm(lonbase, value = min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $ , uvalue = {name:'lon1', strict:keyword_set(strict)}, uname = 'lon1' $ , title = 'lon1', minimum = min $ , maximum = (boxzoom[1] < max)-keyword_set(strict)) lon2id = cw_slider_pm(lonbase, value = ((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $ , uvalue = {name:'lon2', strict:keyword_set(strict)} $ , uname = 'lon2', title = 'lon2', maximum = max $ , minimum = (min > boxzoom[0])+keyword_set(strict)) ;---------------latitude------------------------- min = floor(min([gphit, gphif], max = max)) max = ceil(max) latbase = widget_base(baseh1, column = 2, space = 0, uname = 'latbase', uvalue = {name:'geographic'}) lat1id = cw_slider_pm(latbase, value = min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $ , uvalue = {name:'lat1', strict:keyword_set(strict)}, uname = 'lat1' $ , title = 'lat1', minimum = min $ , maximum = ((boxzoom[3] < max)-keyword_set(strict))) lat2id = cw_slider_pm(latbase, value = ((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $ , uvalue = {name:'lat2', strict:keyword_set(strict)} $ , uname = 'lat2', title = 'lat2', maximum = max $ , minimum = (min > boxzoom[2])+keyword_set(strict)) ;----------------unzoom------------------------ if keyword_set(unzoom) then rien = widget_button(baseh, value = 'unzoom', uvalue = {name:'unzoom'}, xsize = 60, ysize = 110) ;----------------depth------------------------ basez = widget_base(base, column = 3, space = 0, /base_align_center) ;------------------------------------------------ basezdrp = widget_base(basez, row = 2, space = 0) ; if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept gdep1 = floor(gdep) gdep2 = ceil(gdep) ;; same = where(gdep2-gdep1 EQ 0) ;; if same[0] NE -1 then gdep2[same] = gdep2[same] +1 sgdep1 = strtrim(gdep1, 1) sgdep2 = strtrim(gdep2, 1) ; dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep1, uvalue = {name:'dthlv1', grid_t:strupcase(vargrid) NE 'W'}, uname = 'dthlv1') rien = where(gdep1 LT boxzoom[4], indice1) indice1 = indice1 < (jpk-1) widget_control, dephtid, set_value = {combobox_select:indice1} ; dephtid = cw_combobox_pm(basezdrp, value = ''+sgdep2, uvalue = {name:'dthlv2'}, uname = 'dthlv2') rien = where(gdep2 LE boxzoom[5], indice2) indice2 = indice1 > (indice2-1) widget_control, dephtid, set_value = {combobox_select:indice2} ; ;------ ; basedepthslid = widget_base(base, column = 2, space = 0) strminlen = max(strlen(strtrim(round([gdept, gdepw]), 1))) ; if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1] max1 = (min1+1) > gdep1[indice2] rien = cw_slider_pm(basez, value = min1 > boxzoom[4] < (boxzoom[5] < max1) $ , uvalue = {name:'depth1'}, uname = 'depth1', strminlen = strminlen $ , title = 'z1', minimum = min1, maximum = max1) ; min2 = gdep2[indice1] if indice2 EQ jpk-1 then max2 = ceil(max([gdept, gdepw])) $ ELSE max2 = gdep1[indice2+1] if floor(max2) LE floor(min2) then max2 = min2+1 rien = cw_slider_pm(basez, value = (min2 > boxzoom[4]) > boxzoom[5] < max2 $ , uvalue = {name:'depth2'}, minimum = min2, maximum = max2 $ , uname = 'depth2', title = 'z2', strminlen = strminlen) ;-------------------------------------------- ; return, base end