[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: widget_control from call_external

davidf@dfanning.com (David Fanning) writes:

> Well, this will be difficult unless your can call your
> C program in "chunks", or in some other way interrupt
> it. It might be easier if you just know, in general,
> how long it takes. Then you can set a "kitchen timer"
> sort of progress indicator. As long as the cake is
> baked by the time the timer goes off, no one seems
> to care. :-)

That sounds like a great idea. 
I tried to implement that, but the timer stops ticking!
Seems like xmanager doesn't accept events until the 
call_external returns... There's a t_test.pro for illustration.

Oh yes, the other thing I tried is to fire up a status line 
from within the C-code with IDL_ExecuteStr(). Works just fine
EXCEPT for the annoying messages:
% Temporary variables are still checked out - cleaning up...
for every IDL_ExecuteStr().

Did I miss something?

pro t_test_event, ev

  widget_control, ev.id,  get_uvalue=uval
  widget_control, ev.top, get_uvalue=struct

  stat = struct.status 
  curr = struct.current 
  evno = struct.t_evno
  case uval of
  'Done'   : widget_control, ev.top, /destroy
  'Run'    : begin
               JUNK = call_external('t_test.so','t_test', curr,/unload)
  'Timer'  : begin
               evno = evno +1     
               print,'Timer event no ', evno
               widget_control, ev.top, $
                 set_uvalue={status:stat, current:curr, t_evno:evno}

  else : begin ; should never happen
           widget_control, ev.id,  get_value=val
           print,'unknown event with value ',val
           widget_control, ev.top, /destroy

pro t_test

  old     = 0L
  current = 0L
  t_evno    = 0
  a = widget_base(/col)
  b = widget_button(a,value='Run',uval='Run',/frame)
  status = widget_label(a,value= $
    string(format='(A8,I3,1x,A1)','Status: ',0,'%'),uvalue='Timer')

  c= widget_button(a,value='Done',uval='Done',/frame)
  widget_control, a, /realize
  widget_control, a, $
    set_uvalue={status:status, current:current, t_evno:t_evno}
  xmanager, 't_test',a

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net