1 | ; IDL> testwid,julday(1,1,1980)+lindgen(100)*5 |
---|
2 | ; |
---|
3 | ; PRO testwid_event, event |
---|
4 | ; ComboboxId = widget_info(event.top,find_by_uname = 'c''est lui') |
---|
5 | ; widget_control, event.id, get_uvalue=uval |
---|
6 | ; if n_elements(uval) EQ 0 then return |
---|
7 | ; case uval of |
---|
8 | ; 'done':widget_control, event.top, /destroy |
---|
9 | ; 'set':BEGIN |
---|
10 | ; widget_control, event.id, get_value = value |
---|
11 | ; widget_control, ComboboxId, set_value = value |
---|
12 | ; END |
---|
13 | ; 'get':BEGIN |
---|
14 | ; widget_control, ComboboxId, get_value = value |
---|
15 | ; help, value, /struct |
---|
16 | ; END |
---|
17 | ; ELSE: |
---|
18 | ; endcase |
---|
19 | ; return |
---|
20 | ; end |
---|
21 | ; PRO testwid, calendar, date0, _extra = ex |
---|
22 | ; base=widget_base(/COLUMN) |
---|
23 | ; print, 'base=', base |
---|
24 | ; nothing = widget_label(base, value = 'beginning of the test') |
---|
25 | ; ; |
---|
26 | ; nothing = cw_calendar(base,calendar, date0, _extra = ex, uname = 'c''est lui', uvalue = 'c''est lui' ) |
---|
27 | ; print, 'cw_calendar ID =', nothing |
---|
28 | ; ; |
---|
29 | ; nothing = widget_label(base, value = 'end of the test') |
---|
30 | ; nothing = widget_text(base, value = string(calendar[0]), uvalue = 'set', /editable) |
---|
31 | ; nothing = widget_button(base, value = 'get', uvalue = 'get') |
---|
32 | ; nothing = widget_button(base, value = 'done', uvalue = 'done') |
---|
33 | ; widget_control, base, /REALIZE |
---|
34 | ; xmanager,'testwid', base |
---|
35 | ; return |
---|
36 | ; END |
---|
37 | ; |
---|
38 | ; |
---|
39 | ;+ |
---|
40 | ; |
---|
41 | ; @file_comments |
---|
42 | ; |
---|
43 | ; @categories |
---|
44 | ; Compound widget |
---|
45 | ; |
---|
46 | ; @param ID |
---|
47 | ; |
---|
48 | ; @param VALUE |
---|
49 | ; It is the default tick mark value (a floating-point number). |
---|
50 | ; |
---|
51 | ; @returns |
---|
52 | ; |
---|
53 | ; @uses |
---|
54 | ; |
---|
55 | ; @restrictions |
---|
56 | ; |
---|
57 | ; @examples |
---|
58 | ; |
---|
59 | ; @history |
---|
60 | ; |
---|
61 | ; @version |
---|
62 | ; $Id$ |
---|
63 | ; |
---|
64 | ;- |
---|
65 | PRO cw_calendar_set_value, id, value |
---|
66 | ; |
---|
67 | compile_opt strictarr, strictarrsubs |
---|
68 | ; |
---|
69 | @cm_4cal |
---|
70 | ; get back the calendar and its related informations |
---|
71 | winfo_id = widget_info(id, find_by_uname = 'infocal') |
---|
72 | widget_control, winfo_id, get_uvalue = infowid |
---|
73 | key_caltype = infowid.caltype |
---|
74 | ; high freqeuncy calendar |
---|
75 | IF keyword_set(infowid.fakecal) THEN BEGIN |
---|
76 | value2 = date2jul(long(value)) - infowid.fakecal |
---|
77 | IF value2 LT n_elements(infowid.calendar) AND value2 GE 0 THEN BEGIN |
---|
78 | stepid = widget_info(id, find_by_uname = 'step') |
---|
79 | widget_control, stepid, set_value = {combobox_select:value2} |
---|
80 | infowid.date = jul2date(value2 + infowid.fakecal) |
---|
81 | widget_control, winfo_id, set_uvalue = infowid |
---|
82 | ENDIF |
---|
83 | ENDIF ELSE BEGIN |
---|
84 | jdval = date2jul(value) |
---|
85 | ; check that the date exists in the calendar |
---|
86 | if (where(abs(infowid.calendar - jdval) LT 1.d/86400.d))[0] EQ - 1 then return |
---|
87 | ; update the value of infocal |
---|
88 | infowid.date = value |
---|
89 | widget_control, winfo_id, set_uvalue = infowid |
---|
90 | ; update the combobox if needed... |
---|
91 | possiblecase = ['day', 'month', 'year'] |
---|
92 | for name = 2, 0, -1 do BEGIN |
---|
93 | ; call set_cal_combobox with out = 2 to specify that the call is coming |
---|
94 | ; from cw_calendar_set_value |
---|
95 | if widget_info(id, find_by_uname = possiblecase[name]) NE 0 then $ |
---|
96 | set_cal_combobox, {handler:id, out:2}, possiblecase[name], value |
---|
97 | ENDFOR |
---|
98 | ENDELSE |
---|
99 | ; |
---|
100 | return |
---|
101 | end |
---|
102 | ;---------------------------------------------------------------------- |
---|
103 | ;+ |
---|
104 | ; @file_comments |
---|
105 | ; |
---|
106 | ; |
---|
107 | ; @categories |
---|
108 | ; Compound widget |
---|
109 | ; |
---|
110 | ; @param ID |
---|
111 | ; |
---|
112 | ; |
---|
113 | ; @returns |
---|
114 | ; |
---|
115 | ; @uses |
---|
116 | ; |
---|
117 | ; @restrictions |
---|
118 | ; |
---|
119 | ; @examples |
---|
120 | ; |
---|
121 | ; @history |
---|
122 | ; |
---|
123 | ; @version |
---|
124 | ; $Id$ |
---|
125 | ; |
---|
126 | ;- |
---|
127 | FUNCTION cw_calendar_get_value, id |
---|
128 | ; |
---|
129 | compile_opt strictarr, strictarrsubs |
---|
130 | ; |
---|
131 | winfo_id = widget_info(id, find_by_uname = 'infocal') |
---|
132 | widget_control, winfo_id, get_uvalue = infowid |
---|
133 | return, infowid.date |
---|
134 | END |
---|
135 | ;---------------------------------------------------------------------- |
---|
136 | ;+ |
---|
137 | ; @file_comments |
---|
138 | ; |
---|
139 | ; |
---|
140 | ; @categories |
---|
141 | ; Compound widget |
---|
142 | ; |
---|
143 | ; @param ID |
---|
144 | ; |
---|
145 | ; |
---|
146 | ; @param WINFOID |
---|
147 | ; |
---|
148 | ; |
---|
149 | ; @returns |
---|
150 | ; |
---|
151 | ; @uses |
---|
152 | ; |
---|
153 | ; @restrictions |
---|
154 | ; |
---|
155 | ; @examples |
---|
156 | ; |
---|
157 | ; @history |
---|
158 | ; |
---|
159 | ; @version |
---|
160 | ; $Id$ |
---|
161 | ; |
---|
162 | ;- |
---|
163 | FUNCTION get_cal_value, id, winfoid |
---|
164 | ; |
---|
165 | compile_opt strictarr, strictarrsubs |
---|
166 | ; |
---|
167 | winfo_id = widget_info(id, find_by_uname = 'infocal') |
---|
168 | widget_control, winfo_id, get_uvalue = infowid |
---|
169 | oldate = infowid.date |
---|
170 | ;-------------day----------------- |
---|
171 | wid_id = widget_info(id, find_by_uname = 'day') |
---|
172 | if wid_id NE 0 then BEGIN |
---|
173 | widget_control, wid_id, get_value = wid_value |
---|
174 | widget_control, wid_id, get_uvalue = wid_uvalue |
---|
175 | date = double(wid_value.combobox_gettext) + wid_uvalue.hms[wid_value.combobox_index] |
---|
176 | ENDIF ELSE date = oldate MOD 100L |
---|
177 | ;-------------month--------------- |
---|
178 | wid_id = widget_info(id, find_by_uname = 'month') |
---|
179 | if wid_id NE 0 then BEGIN |
---|
180 | widget_control, wid_id, get_value = wid_value |
---|
181 | allmonths = string(format = '(C(CMoA))', 31*(indgen(12))) |
---|
182 | month = (where(allmonths EQ wid_value.combobox_gettext))[0] + 1 |
---|
183 | date = date + 100L * long(month) |
---|
184 | ENDIF ELSE date = date + (oldate MOD 10000L)/100L*100L |
---|
185 | ;-------------year---------------- |
---|
186 | wid_id = widget_info(id, find_by_uname = 'year') |
---|
187 | widget_control, wid_id, get_value = wid_value |
---|
188 | date = date + 10000L * long(wid_value.combobox_gettext) |
---|
189 | ; |
---|
190 | IF arg_present(winfoid) NE 0 THEN BEGIN |
---|
191 | winfoid = winfo_id |
---|
192 | infowid.date = date |
---|
193 | return, infowid |
---|
194 | ENDIF ELSE return, date |
---|
195 | end |
---|
196 | ;---------------------------------------------------------------------- |
---|
197 | ; redefine the value and index position of the combobox |
---|
198 | ;+ |
---|
199 | ; @file_comments |
---|
200 | ; |
---|
201 | ; |
---|
202 | ; @categories |
---|
203 | ; Compound widget |
---|
204 | ; |
---|
205 | ; @param EVENT |
---|
206 | ; |
---|
207 | ; |
---|
208 | ; @param CASENAME |
---|
209 | ; |
---|
210 | ; |
---|
211 | ; @param DATE0 |
---|
212 | ; |
---|
213 | ; |
---|
214 | ; @returns |
---|
215 | ; |
---|
216 | ; @uses |
---|
217 | ; |
---|
218 | ; @restrictions< |
---|
219 | ; |
---|
220 | ; @examples |
---|
221 | ; |
---|
222 | ; @history |
---|
223 | ; |
---|
224 | ; @version |
---|
225 | ; $Id$ |
---|
226 | ; |
---|
227 | ;- |
---|
228 | PRO set_cal_combobox, event, casename, date0 |
---|
229 | ; |
---|
230 | compile_opt strictarr, strictarrsubs |
---|
231 | ; |
---|
232 | ; casename: Which widget shall we move: 'day', 'month' or 'year' ? |
---|
233 | wid_id = widget_info(event.handler, find_by_uname = casename) |
---|
234 | ; we get back the calendar... |
---|
235 | winfo_id = widget_info(event.handler, find_by_uname = 'infocal') |
---|
236 | widget_control, winfo_id, get_uvalue = infowid |
---|
237 | caldat, infowid.calendar, monthcal, daycal, yearcal, hourcal, mincal, seccal |
---|
238 | ; ... and the current date |
---|
239 | IF n_elements(date0) EQ 0 then date0 = get_cal_value(event.handler) |
---|
240 | jdate0 = date2jul(date0, month = month0, day = day0, year = year0) |
---|
241 | ; index of days/months/years according to date0 |
---|
242 | case casename of |
---|
243 | 'day':BEGIN |
---|
244 | ; list of days corresponding to month0 and year0 |
---|
245 | index = where(monthcal EQ month0 AND yearcal EQ year0) |
---|
246 | current = daycal[index] |
---|
247 | hms = hourcal[index] / 24.0d0 + mincal[index]/1440.0d0 + seccal[index] / 86400.0d0 |
---|
248 | END |
---|
249 | 'month':BEGIN |
---|
250 | ; list of months corresponding to year0 |
---|
251 | index = where(yearcal EQ year0) |
---|
252 | current = monthcal[index] |
---|
253 | ; keep only the uniq values |
---|
254 | indexbis = uniq(current) |
---|
255 | index = index[indexbis] |
---|
256 | current = current[indexbis] |
---|
257 | END |
---|
258 | 'year':BEGIN |
---|
259 | ; keep only the uniq years |
---|
260 | index = uniq(yearcal) |
---|
261 | current = yearcal[index] |
---|
262 | END |
---|
263 | ENDCASE |
---|
264 | ; we update the uvalue of the widget |
---|
265 | IF casename EQ 'day' THEN widget_control, wid_id, set_uvalue = {name:casename, hms:hms} |
---|
266 | ; for event.out = 0, we store the previous position of the combobox to use |
---|
267 | ; it as the default position. |
---|
268 | IF event.out EQ 0 THEN widget_control, wid_id, get_value = oldselect |
---|
269 | ; we redefine the new list |
---|
270 | if casename EQ 'month' then begin |
---|
271 | widget_control, wid_id, set_value = string(format = '(C(CMoA))', 31*(current-1)) |
---|
272 | ENDIF ELSE BEGIN |
---|
273 | widget_control, wid_id, set_value = strtrim(current, 1) |
---|
274 | ENDELSE |
---|
275 | ; specify the index position within the new list of values. |
---|
276 | widget_control, wid_id, get_value = combobox |
---|
277 | CASE event.out OF |
---|
278 | ; -1: we put to the biggest position |
---|
279 | -1:selected = combobox.combobox_number - 1 |
---|
280 | ; 0: same as the previous position is the best choice... |
---|
281 | 0:selected = oldselect.combobox_index < (combobox.combobox_number - 1) |
---|
282 | ; 1: we put to the smallest position |
---|
283 | 1:selected = 0 |
---|
284 | ; 2: a new date has been specified... |
---|
285 | 2:BEGIN |
---|
286 | case casename of |
---|
287 | 'day':selected = (where(current EQ day0))[0] |
---|
288 | 'month':selected = (where(current EQ month0))[0] |
---|
289 | 'year':selected = (where(current EQ year0))[0] |
---|
290 | ENDCASE |
---|
291 | END |
---|
292 | ENDCASE |
---|
293 | widget_control, wid_id, set_value = {combobox_select:selected} |
---|
294 | ; update the date... |
---|
295 | infowid.date = get_cal_value(event.handler) |
---|
296 | widget_control, winfo_id, set_uvalue = infowid |
---|
297 | return |
---|
298 | end |
---|
299 | ;---------------------------------------------------------------------- |
---|
300 | ; move cyclically the calendar to the |
---|
301 | ; value 0 if event.out=1 or combobox_number-1 if event.out=-1 |
---|
302 | ;+ |
---|
303 | ; @file_comments |
---|
304 | ; |
---|
305 | ; |
---|
306 | ; @categories |
---|
307 | ; Compound widget |
---|
308 | ; |
---|
309 | ; @param EVENT |
---|
310 | ; |
---|
311 | ; |
---|
312 | ; @param CASENAME |
---|
313 | ; |
---|
314 | ; |
---|
315 | ; @returns |
---|
316 | ; |
---|
317 | ; @uses |
---|
318 | ; |
---|
319 | ; @restrictions |
---|
320 | ; |
---|
321 | ; @examples |
---|
322 | ; |
---|
323 | ; @history |
---|
324 | ; |
---|
325 | ; @version |
---|
326 | ; $Id$ |
---|
327 | ; |
---|
328 | ;- |
---|
329 | PRO cw_cal_move, event, casename |
---|
330 | ; |
---|
331 | compile_opt strictarr, strictarrsubs |
---|
332 | ; |
---|
333 | possiblecase = ['day', 'month', 'year', 'impossiblecase'] |
---|
334 | id = widget_info(event.handler, find_by_uname = casename) |
---|
335 | widget_control, id, get_value = wvalue |
---|
336 | ; we try to move but we are already at the beginning/end of the combobox |
---|
337 | ; wvalue.combobox_index EQ (wvalue.combobox_number-1) and event.out EQ 1 |
---|
338 | ; wvalue.combobox_index EQ 0 and event.out EQ -1 (move is not called when out eq 0) |
---|
339 | whichcase = (where(possiblecase EQ casename))[0] |
---|
340 | if wvalue.combobox_index EQ (wvalue.combobox_number-1)*(event.out EQ 1) THEN BEGIN |
---|
341 | if widget_info(event.handler, find_by_uname = possiblecase[whichcase+1]) EQ 0 then begin |
---|
342 | ; it is impossible to move the "next" combobox... |
---|
343 | widget_control, id, get_value = widvalue |
---|
344 | ; we set to "widvalue.combobox_number-1" when event.out EQ -1 |
---|
345 | ; and to 0 when event.out EQ 1 |
---|
346 | selected = (widvalue.combobox_number-1)*(event.out EQ -1) |
---|
347 | widget_control, id, set_value = {combobox_select:selected} |
---|
348 | ; we call move for the next combobox |
---|
349 | ENDIF ELSE cw_cal_move, event, possiblecase[whichcase+1] |
---|
350 | ; it is possible to move from +/- 1 |
---|
351 | ENDIF ELSE widget_control, id, set_value = {combobox_select:wvalue.combobox_index+event.out} |
---|
352 | set_cal_combobox, event, possiblecase[whichcase-1] |
---|
353 | return |
---|
354 | end |
---|
355 | ;---------------------------------------------------------------------- |
---|
356 | ;+ |
---|
357 | ; @file_comments |
---|
358 | ; |
---|
359 | ; |
---|
360 | ; @categories |
---|
361 | ; Compound widget |
---|
362 | ; |
---|
363 | ; @param EVENT |
---|
364 | ; |
---|
365 | ; |
---|
366 | ; @returns |
---|
367 | ; |
---|
368 | ; @uses |
---|
369 | ; |
---|
370 | ; @restrictions |
---|
371 | ; |
---|
372 | ; @examples |
---|
373 | ; |
---|
374 | ; @history |
---|
375 | ; |
---|
376 | ; @version |
---|
377 | ; $Id$ |
---|
378 | ; |
---|
379 | ;- |
---|
380 | FUNCTION cw_calendar_event, event |
---|
381 | ; |
---|
382 | @cm_4cal |
---|
383 | compile_opt strictarr, strictarrsubs |
---|
384 | ; |
---|
385 | winfo_id = widget_info(event.handler, find_by_uname = 'infocal') |
---|
386 | widget_control, winfo_id, get_uvalue = infowid |
---|
387 | key_caltype = infowid.caltype |
---|
388 | ; |
---|
389 | widget_control, event.id, get_uvalue = uval |
---|
390 | ; high frequency calendar |
---|
391 | IF uval.name EQ 'step' THEN BEGIN |
---|
392 | infowid.date = jul2date(event.index + infowid.fakecal) |
---|
393 | ENDIF ELSE BEGIN |
---|
394 | ; |
---|
395 | possiblecase = ['day', 'month', 'year', 'impossiblecase'] |
---|
396 | whichcase = (where(possiblecase EQ uval.name))[0] |
---|
397 | if event.out NE 0 then BEGIN ; we use the +/- button and we want to go out of the combobox: |
---|
398 | ; to index = -1 (event.out=-1) or to index = combobox_number (event.out=1) |
---|
399 | ; we try to move the combobox just right, with name: possiblecase[whichcase+1] |
---|
400 | if widget_info(event.handler, find_by_uname = possiblecase[whichcase+1]) EQ 0 then BEGIN |
---|
401 | ; this widget do not exist we set cyclically the current widget to the |
---|
402 | ; value 0 if event.out=1 or combobox_number-1 if event.out=-1 |
---|
403 | widget_control, event.id, get_value = widvalue |
---|
404 | selected = (widvalue.combobox_number-1)*(event.out EQ -1) |
---|
405 | widget_control, event.id, set_value = {combobox_select:selected} |
---|
406 | ENDIF ELSE cw_cal_move, event, possiblecase[whichcase+1] |
---|
407 | ENDIF |
---|
408 | ; if we changed month(year), we need to update the day (and month) list |
---|
409 | if uval.name NE 'day' then begin |
---|
410 | event.out = 0 |
---|
411 | for name = whichcase-1, 0, -1 do BEGIN |
---|
412 | if widget_info(event.handler, find_by_uname = possiblecase[name]) NE 0 then $ |
---|
413 | set_cal_combobox, event, possiblecase[name] |
---|
414 | endfor |
---|
415 | ENDIF |
---|
416 | ; we update the date |
---|
417 | infowid = get_cal_value(event.handler, winfo_id) |
---|
418 | ENDELSE |
---|
419 | ; |
---|
420 | widget_control, winfo_id, set_uvalue = infowid |
---|
421 | return, {CW_CALENDAR, ID:event.handler, TOP:event.top, HANDLER:0L $ |
---|
422 | , VALUE:infowid.date, FAKECAL: infowid.fakecal} |
---|
423 | end |
---|
424 | ;---------------------------------------------------------------------- |
---|
425 | ;---------------------------------------------------------------------- |
---|
426 | ;+ |
---|
427 | ; @file_comments |
---|
428 | ; |
---|
429 | ; |
---|
430 | ; @categories |
---|
431 | ; Compound widget |
---|
432 | ; |
---|
433 | ; @param PARENT {in}{required} |
---|
434 | ; The widget ID of the parent widget. |
---|
435 | ; |
---|
436 | ; @param CALENDAR |
---|
437 | ; |
---|
438 | ; |
---|
439 | ; @param JDATE0 |
---|
440 | ; |
---|
441 | ; @keyword CALTYPE |
---|
442 | ; |
---|
443 | ; @keyword FAKECAL |
---|
444 | ; |
---|
445 | ; |
---|
446 | ; @keyword UVALUE |
---|
447 | ; |
---|
448 | ; @keyword UNAME |
---|
449 | ; |
---|
450 | ; |
---|
451 | ; @keyword _EXTRA |
---|
452 | ; Used to pass keywords |
---|
453 | ; |
---|
454 | ; @returns |
---|
455 | ; |
---|
456 | ; @uses |
---|
457 | ; |
---|
458 | ; @restrictions |
---|
459 | ; |
---|
460 | ; @examples |
---|
461 | ; |
---|
462 | ; @history |
---|
463 | ; |
---|
464 | ; @version |
---|
465 | ; $Id$ |
---|
466 | ; |
---|
467 | ; @todo |
---|
468 | ; seb |
---|
469 | ; |
---|
470 | ;- |
---|
471 | FUNCTION cw_calendar, parent, calendar, jdate0, CALTYPE = CALTYPE, FAKECAL = fakecal, UVALUE = uvalue, UNAME = uname, _EXTRA = ex |
---|
472 | ; |
---|
473 | @cm_4cal |
---|
474 | ; |
---|
475 | compile_opt strictarr, strictarrsubs |
---|
476 | ; |
---|
477 | if keyword_set(caltype) then key_caltype = caltype |
---|
478 | ; months days years found in the calendar |
---|
479 | caldat, calendar, monthcal, daycal, yearcal, hourcal, mincal, seccal |
---|
480 | hmscal = hourcal / 24.0d0 + mincal/1440.0d0 + seccal / 86400.0d0 |
---|
481 | ; starting date |
---|
482 | if n_elements(jdate0) EQ 0 then jdate0 = calendar[0] |
---|
483 | if (where(calendar EQ jdate0))[0] EQ -1 then jdate0 = calendar[0] |
---|
484 | ; |
---|
485 | caldat, jdate0, month0, day0, year0 |
---|
486 | ; test the type of calendar |
---|
487 | if n_elements(calendar) GT 1 then BEGIN |
---|
488 | ; each day have the same value |
---|
489 | if n_elements(uniq(daycal, sort(daycal))) EQ 1 then monthly = 1 |
---|
490 | ; each month and each day have the same value |
---|
491 | if keyword_set(monthly) AND n_elements(uniq(monthcal, sort(monthcal))) EQ 1 then yearly = 1 |
---|
492 | endif |
---|
493 | ;--------------------------------------------------------------------------------------- |
---|
494 | if NOT keyword_set(uvalue) then uvalue = {dummy:''} |
---|
495 | if NOT keyword_set(uname) then uname = '' |
---|
496 | base0 = widget_base(parent, /ROW $ |
---|
497 | , EVENT_FUNC = 'cw_calendar_event' $ |
---|
498 | , FUNC_GET_VALUE = 'cw_calendar_get_value' $ |
---|
499 | , PRO_SET_VALUE = 'cw_calendar_set_value' $ |
---|
500 | , UVALUE = uvalue, UNAME = uname, space = 0, _extra = ex) |
---|
501 | ; |
---|
502 | |
---|
503 | if n_elements(fakecal) eq 0 then fakecal = 0 |
---|
504 | base = widget_base(base0, space = 0, uname = 'infocal' $ |
---|
505 | , uvalue = {calendar:calendar, date:jul2date(jdate0), fakecal:fakecal, caltype: key_caltype}) |
---|
506 | ; |
---|
507 | IF keyword_set(fakecal) THEN BEGIN |
---|
508 | cmbbid = cw_combobox_pm(base, UVALUE = {name:'step'}, UNAME = 'step' $ |
---|
509 | , value = strtrim(indgen(n_elements(calendar)), 1)) |
---|
510 | widget_control, cmbbid, set_value = {combobox_select:(where(calendar EQ jdate0))[0]} |
---|
511 | ENDIF ELSE BEGIN |
---|
512 | ; |
---|
513 | vallen = widget_info(base, string_size = 'm') |
---|
514 | ;-------------day----------------- |
---|
515 | if NOT keyword_set(monthly) then begin |
---|
516 | dayindex = where(monthcal EQ month0 AND yearcal EQ year0) |
---|
517 | currentday = daycal[dayindex] |
---|
518 | currentday = strtrim(currentday, 1) |
---|
519 | hms = hmscal[dayindex] |
---|
520 | cmbbid = cw_combobox_pm(base, UVALUE = {name:'day', hms:hms}, UNAME = 'day', value = currentday) |
---|
521 | widget_control, cmbbid, set_value = {combobox_select:(where(long(currentday) EQ day0))[0]} |
---|
522 | endif |
---|
523 | ;-------------month--------------- |
---|
524 | if NOT keyword_set(yearly) then BEGIN |
---|
525 | monthindex = where(yearcal EQ year0) |
---|
526 | currentmonth = long(monthcal[monthindex]) |
---|
527 | ; we suppress the repeted months |
---|
528 | monthindexbis = uniq(currentmonth, sort(currentmonth)) |
---|
529 | monthindex = monthindex[monthindexbis] |
---|
530 | currentmonth = currentmonth[monthindexbis] |
---|
531 | xoff = (34 + 2*vallen[0])*(1-keyword_set(monthly)) |
---|
532 | cmbbid = cw_combobox_pm(base, UVALUE = {name:'month'}, UNAME = 'month', value = string(format = '(C(CMoA))', 31*(currentmonth-1)), xoffset = xoff) |
---|
533 | widget_control, cmbbid, set_value = {combobox_select:(where(long(currentmonth) EQ month0))[0]} |
---|
534 | endif |
---|
535 | ;-------------year---------------- |
---|
536 | yearindex = uniq(yearcal, sort(yearcal)) |
---|
537 | currentyear = strtrim(yearcal[yearindex], 1) |
---|
538 | xoff = (34 + 2*vallen[0])*(1-keyword_set(monthly)) + (33 + 3*vallen[0])*(1-keyword_set(yearly)) |
---|
539 | cmbbid = cw_combobox_pm(base, UVALUE = {name:'year'}, UNAME = 'year', value = currentyear, xoffset = xoff) |
---|
540 | widget_control, cmbbid, set_value = {combobox_select:(where(long(currentyear) EQ year0))[0]} |
---|
541 | ;----------------------------- |
---|
542 | ENDELSE |
---|
543 | ; |
---|
544 | return, base |
---|
545 | end |
---|