Long CW_PDMENUs [message #2965] |
Mon, 17 October 1994 16:18 |
bk
Messages: 1 Registered: October 1994
|
Junior Member |
|
|
Hello,
I am somewhat of a novice at IDL Widget Programming.
I am trying to make a Date button with a pulldown menu heirarchy that
looks like the following:
DATE
1994 -> Jan -> 1
2
.
31
Feb-> 1
.
28
1995 ->
1996 ->
etc. With all the Months followd by all the days of the month.
The following works, eventually...
However, it takes several minutes for the interface to popup. It
also takes a long time for the event proc for an item at the
TLB event procedure(ie the quit from the Menu Bar) to take effect.
Before I added the two date buttons the quit was instantaneous.
Afterwards, it takes about 20 seconds.
;----------------------------------------------------------- ----------
FUNCTION Build_date_menu
COMMON date_menu_desc
xx = { CW_PDMENU_S, flags:0, name:''}
date_menu_desc = replicate(xx, ( (3 * 12 * 31) + 100) )
days = [ $
'1','2','3','4','5','6','7','8','9','10', $
'11','12','13','14','15','16','17','18','19','20', $
'21','22','23','24','25','26','27','28','29','30', $
'31'$
]
months = [ $
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', $
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' $
]
date_menu_desc(0) = { CW_PDMENU_S, 1, 'Date'}
year = 1994
i = 1
WHILE (year LT 1997) DO BEGIN
date_menu_desc(i) = { CW_PDMENU_S, 1, STRING(year)}
i = i + 1
FOR m = 0,11,1 DO BEGIN
IF m EQ 11 THEN BEGIN $
date_menu_desc(i) = { CW_PDMENU_S, 3, months(m) }
ENDIF ELSE date_menu_desc(i) = { CW_PDMENU_S, 1, months(m) }
i = i + 1
FOR d = 0,30,1 DO BEGIN
IF m EQ 1 THEN BEGIN $ ; February ??
IF ( d ) EQ 27 THEN BEGIN $
date_menu_desc(i) = { CW_PDMENU_S, 2, days(d) }
d = 30
ENDIF ELSE date_menu_desc(i) = { CW_PDMENU_S, 0, days(d) }
ENDIF ELSE BEGIN
IF m EQ 3 OR m EQ 5 OR m EQ 8 OR M EQ 10 AND d EQ 29 THEN BEGIN $
date_menu_desc(i) = { CW_PDMENU_S, 2, days(d) }
d = 30
ENDIF ELSE BEGIN
IF d EQ 30 THEN BEGIN $
date_menu_desc(i) = { CW_PDMENU_S, 2, days(d) }
ENDIF ELSE date_menu_desc(i) = { CW_PDMENU_S, 0, days(d) }
ENDELSE
ENDELSE
i = i + 1
ENDFOR ; end day loop
ENDFOR ; end month loop
year = year + 1
ENDWHILE
return,i
END
;----------------------------------------------------------- ----------
FUNCTION Build_date_button, parent,xoff,yoff,menu_size
COMMON common_gui, fo_instr_label, fo_start_time, fo_end_time,date_menu_desc
menu = CW_PDMENU( parent, date_menu_desc(0:menu_size), /RETURN_FULL_NAME,$
FONT = '-b&h-lucidatypewriter-bold-r-normal-sans-0-120-75-75-m- 0-iso8859-1',$
XOFFSET = yoff,$
YOFFSET = xoff,$
UVALUE = 'DATE',$
DELIMITER = '&')
return,menu
END
;---------------------------
The main program looks something like:
build menu bar
build base for pulldown buttons
menu_size = Build_date_menu()
button1=Build_date_button( base,row2_offset,column2_offset,menu_size)
button2=Build_date_button( base,row2_offset,column2_offset,menu_size)
???????????????????????????????????????????????
Is there a faster better way to do this???
I really do want the GUI part of this to be a Pullright/Pulldown
menu.
I know explicitly handling XOFFSETs and YOFFSETS are not suggested
ways of handling placement, however, the rest of GUI for this
application is quite large and screen real estate is important.
Letting the positions default by using ROW or COLUMNs on the
base for the buttons is not acceptable in this case.
Any suggestions will be most welcome.
Thanks
bk@cirrus.lanl.gov
Becky King
505 665-5503
|
|
|