This is a multi-part message in MIME format.
--------------734111EB4284
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Joseph M Zawodny wrote:
>
> So, now I tried to run my widget based programs. Well in brief, the
> new version broke all of my widgets. They either don't work, don't
> appear, or look completely different. Way to go - again! I am very
> seriously considering sticking to version 4 (which may fortunately
> coexist with version 5). So, I have to pay for annual maintainence
> so I can get software upgrades which then allow me to spend all my
> time "fixing" programs that used to work with the old version. Well
> since all the IDL code I write can only be used with IDL then in some
> sense my code is really a part of IDL and, therefore, should come under
> their software maintainence. Maybe I should just zip up all of my
> code and email it to RSI for repair!
>
> Am I the ONLY one whose code no longer works with Version 5.0?
Here is an example of a broken widget (at least under NT 4.0).
Compile the routines and then type
W_EDIT_EPHEM,req,pos=[300,200]
at the command line. In versions 3.6-4.0 you see what I want. Under
version 5 you get a microscopic widget with a black dot in it and a
partial (2 sided) frame. I have been fiddling with this for some
time now and I can force the root widget to have a finite size, but
the guts remain a black dot. Under version 5 you will have to kill
IDL to get rid of the widget.
First one to fix this can have a cookie.
--
Work: Dr. Joseph M. Zawodny Play: Joe Zawodny
NASA Langley Research Center KO4LW@amsat.org
E-mail: J.M.Zawodny@LaRC.NASA.gov zawodny@exis.net
(757) 864-2681 (757) 864-2671 FAX http://wwwp.exis.net/~zawodny
--------------734111EB4284
Content-Type: text/plain; charset=us-ascii; name="w_edit_e.pro"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="w_edit_e.pro"
function W_EDIT_EPHEM_EVENT,ev
;+
; V-2.1
; Event handling routine for W_EDIT_EPHEM widget
;
;-
child = widget_info(ev.top,/child)
widget_control,child,get_uvalue=req
widget_control,ev.top,get_uvalue=stat
type = tag_names(ev,/struct)
res = 0
; Was it a carriage return event
if(type eq 'WIDGET_TEXT_CH') then begin
if(ev.ch eq 10B) then begin
tid = stat.textid
case ev.id of
tid(0): widget_control,tid(1),/input_focus
tid(1): widget_control,tid(2),/input_focus
tid(2): widget_control,tid(3),/input_focus
tid(3): widget_control,tid(4),/input_focus
tid(4): widget_control,tid(5),/input_focus
tid(5): widget_control,tid(6),/input_focus
tid(6): widget_control,tid(7),/input_focus
ELSE: widget_control,stat.button(7),/input_focus
endcase
goto,SKIP
endif
endif
isit = strpos(type,'WIDGET_TEXT')
if(isit eq 0)then begin
; Check what the user is doing and manage the display
flag = chk_str(ev,vstr)
if (flag eq 0) then goto,SKIP
tid = stat.textid
case ev.id of
tid(0): req.name = vstr ; Name
tid(1): req.cur.orbit(0) = vstr ; Altitude
tid(2): req.cur.orbit(1) = vstr ; Inclination
tid(3): req.cur.orbit(3) = vstr ; Right Ascension
tid(4): req.cur.orbit(2) = vstr ; Eccentricity
tid(5): req.cur.orbit(4) = vstr ; Argument of Perogee
tid(6): req.cur.orbit(5) = vstr ; Mean Anomoly
ELSE: begin ; Ephemeris Date
flag = parse_date(vstr,ostr,date)
if(flag ne 0) then req.cur.dateorb = date
end
endcase
endif
; Was it a BUTTON event
if(type eq 'WIDGET_BUTTON')then begin
widget_control,ev.id,get_value=value
vstr = strupcase(strtrim(value,2))
case vstr of
'LEARN': begin
end
'QUIT': begin
req = stat.orig
res = 1
end
'SUN SYNCHRONOUS': begin
widget_control,ev.id,get_uvalue=uv,/no_copy
req.cur.sync = ev.select
widget_control,uv.inc(0),sens=1-ev.select
widget_control,uv.inc(1),sens=1-ev.select
widget_control,uv.inc(2),sens=1-ev.select
widget_control,uv.inc(1),get_value=curinc
vs = string(uv.oinc,form='(f8.2)')
widget_control,uv.inc(1),set_value=vs
widget_control,uv.inc(1),set_uvalue={value:vs,off:0}
uv.oinc = float(curinc(0))
; Swap values
t = uv.ra(1)
widget_control,t,get_value=curra
vs = string(uv.ora,form='(f8.2)')
widget_control,t,set_value=vs
widget_control,t,set_uvalue={value:vs,off:0}
uv.ora = float(curra(0))
if(ev.select eq 1) then begin
widget_control,uv.ra(0),set_value='Asc Node Time'
widget_control,uv.ra(2),set_value='hrs'
endif else begin
widget_control,uv.ra(0),set_value='RA of Asc Node'
widget_control,uv.ra(2),set_value='deg'
endelse
widget_control,ev.id,set_uvalue=uv,/no_copy
widget_control,t,/input_focus
end
'ACTIVE': req.cur.active = ev.select
'SOLAR': begin
widget_control,ev.id,/set_button
req.cur.solar = 1 & req.cur.lunar = 0
end
'LUNAR': begin
;test widget_control,ev.id,/set_button
req.cur.solar = 0 & req.cur.lunar = 1
end
'BOTH': begin
;test widget_control,ev.id,/set_button
req.cur.solar = 1 & req.cur.lunar = 1
end
ELSE: res = 1
endcase
endif
SKIP: widget_control,ev.top,set_uvalue=stat
widget_control,child,set_uvalue=req
return,{err_msg,id:ev.id,top:ev.top,handler:ev.handler,resul t:res}
end
pro W_EDIT_EPHEM,req,pos=pos
; Routine to initialize the widget
!quiet = 1
tft = '(i4,"/",i2.2,"/",i2.2,":",i2.2,":",i2.2,":",f5.2)'
f104 = '(f10.4)'
asc = '(a10)'
if(n_elements(req) eq 0) then begin
print,'Using default values'
date = [1999.,1.,1.,0.,0.,0.]
orb = [100.,0.,0.,0.,0.,0.]
req = {name:'',cur:{orbit:orb,dateorb:date,solar:1,lunar:0 $
,sync:0,active:1,id:[0L,0L]}}
endif
s1 = string(req.cur.orbit(0),form=f104)
s2 = string(req.cur.orbit(1),form=f104)
s3 = string(req.cur.orbit(3),form=f104)
s4 = string(req.cur.orbit(2),form=f104)
s5 = string(req.cur.orbit(4),form=f104)
s6 = string(req.cur.orbit(5),form=f104)
s7 = string(fix(req.cur.dateorb(0:4)),req.cur.dateorb(5),form=tft )
if(n_elements(pos) ne 2) then pos=[0,0]
b = widget_base(title='Orbit Ephemeris',event_func='w_edit_ephem_event' $
,xoff=pos(0),yoff=pos(1),tlb_frame_attr=1+2+8)
r = widget_base(b,/column)
ra = widget_base(r,/column,/frame)
ra1 = widget_base(ra)
ra1a = widget_base(ra1,/row)
ra1a0 = widget_base(ra1a,/column,space=12,ypad=8)
ra1a0a = widget_label(ra1a0,valu='Spacecraft')
ra1a0b = widget_label(ra1a0,valu='Altitude')
ra1a0c = widget_label(ra1a0,valu='Inclination')
ra1a0d = widget_label(ra1a0,valu='RA of Asc Node')
ra1a0e = widget_label(ra1a0,valu='Eccentricity')
ra1a0f = widget_label(ra1a0,valu='Arg of Perogee')
ra1a0g = widget_label(ra1a0,valu='Mean Anomaly')
ra1a1 = widget_base(ra1a,/column,space=4,ypad=3)
t00 = widget_text(ra1a1,xsiz=10,/edit,/all,value=req.name)
t01 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s1)
t02 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s2)
t03 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s3)
t04 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s4)
t05 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s5)
t06 = widget_text(ra1a1,xsiz=10,/edit,/all,value=s6)
ra1a2 = widget_base(ra1a,/column,space=12,ypad=8)
ra1b2a = widget_label(ra1a2,valu=' ')
ra1a2b = widget_label(ra1a2,valu='km')
ra1a2c = widget_label(ra1a2,valu='deg')
ra1a2d = widget_label(ra1a2,valu='deg')
ra1b2e = widget_label(ra1a2,valu=' ')
ra1b2f = widget_label(ra1a2,valu='deg')
ra1b2g = widget_label(ra1a2,valu='deg')
ra2 = widget_base(ra,/row)
ra2a = widget_label(ra2,valu='Date')
t07 = widget_text (ra2,xsiz=22,/edit,/all,value=s7)
ra3 = widget_base(ra,/row)
ra3a = widget_base(ra3,/row,/nonexclusive)
b0 = widget_button(ra3a,value='Sun Synchronous')
b1 = widget_button(ra3a,value='Active')
ra4 = widget_base(ra,/row)
ra4a = widget_base(ra4,/row,/exclusive)
b2 = widget_button(ra4a,xsize=69,value='Solar')
b3 = widget_button(ra4a,xsize=69,value='Lunar')
b4 = widget_button(ra4a,xsize=69,value='Both')
ra5 = widget_base(ra,/row)
b5 = widget_button(ra5,xsize=70,value='Quit')
b6 = widget_button(ra5,xsize=70,value='Learn')
b7 = widget_button(ra5,xsize=70,value='OK')
; Set all the the fields to the initial values
widget_control,b0,set_button=req.cur.sync
widget_control,b1,set_button=req.cur.active
widget_control,b4,sens=0 & widget_control,b6,sens=0
widget_control,b2,set_button=req.cur.solar
widget_control,b3,set_button=req.cur.lunar
widget_control,b4,set_button=req.cur.solar*req.cur.lunar
widget_control,t00,set_uvalue={value:req.name,off:0}
widget_control,t01,set_uvalue={value:s1,off:0}
widget_control,t02,set_uvalue={value:s2,off:0}
widget_control,t03,set_uvalue={value:s3,off:0}
widget_control,t04,set_uvalue={value:s4,off:0}
widget_control,t05,set_uvalue={value:s5,off:0}
widget_control,t06,set_uvalue={value:s6,off:0}
widget_control,t07,set_uvalue={value:s7,off:0}
widget_control,r,/realize
status = {textid : [t00,t01,t02,t03,t04,t05,t06,t07] $
, textfmt: [asc,f104,f104,f104,f104,f104,f104,tft] $
, textmax: [ 10, 10, 10, 10, 10, 10, 10, 22] $
, textchr: [ 0, 2, 2, 2, 2, 2, 2, 3] $
, button : [ b0, b1, b2, b3, b4, b5, b6, b7], orig: req}
syncv = {inc:[ra1a0c,t02,ra1a2c],ra:[ra1a0d,t03,ra1a2d] $
,oinc:0.00,ora:0.00}
if(req.cur.sync ne 0) then begin
widget_control,syncv.inc(0),sens=0
widget_control,syncv.inc(1),sens=0
widget_control,syncv.inc(2),sens=0
widget_control,syncv.ra(0),set_value='Asc Node Time'
widget_control,syncv.ra(2),set_value='hrs'
endif
widget_control, b, set_uvalue=status,/no_copy
widget_control, r, set_uvalue=req,/no_copy
widget_control,b0,set_uval=syncv
; Wait for an event from the new widget
LOOP: wevent = widget_event(b)
if(wevent.result ne 1) then goto,LOOP
; Get the answer
widget_control, r, get_uvalue=req,/no_copy
; Destroy the widget
widget_control,b,/destroy
return
end
--------------734111EB4284--
|