comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: cancel button to stop w/in an iterative loop?
items: Re: cancel button to stop w/in an iterative loop?

cancel button to stop w/in an iterative loop?
type: item
description: Hi. I'm trying to create a simple cancel button for my software. I slapped a GUI on an iterative function that processes alot of data files. I want a cancel button to appear just as the run enters the processing loop, and exit out of processing if the user pressed the button. Below is a file tGUI.pro to show one of the variations I've tried. I even tried to register the cancelBase base widget with xmanager, then destroy it in the cancelProcessing() callback, then check the value of xregistered in the outer loop to see if it's registered. No such luck. I'm obviously missing something here. Some of this code is strait outta my app so please forgive my coding style (e.g. the loop to create the widget buttons in the procedure tGUI). Oh, and global variables via a COMMON block is my LEAST favorite option. If that's the only way to go, I guess I'll have to do it, but that'll be my last option. Even so, I did try it with a common block, and I still couldn't get it to work. Thanks alot in advance IDL> print, !version { x86 Win32 Windows 5.2 Oct 30 1998} ;---CUT HERE----- ;/////////////////////////////////////////////////////////// //////////////// ///////////// function cancelProcessing_event, event widget_control, event.top, GET_VALUE=eventValue if eventValue EQ "CANCEL PROCESSING" then $ widget_control, event.id, SET_UVALUE = 2 return, 1 end ;/////////////////////////////////////////////////////////// //////////////// ///////////// ;/////////////////////////////////////////////////////////// //////////////// ///////////// function processData ;//Create my cancel button cancelBase = Widget_Base(UNAME='cancelBase',/ALIGN_CENTER,$ /GRID_LAYOUT ,TLB_FRAME_ATTR=9) cancelButton = Widget_Button(cancelBase, UNAME='cancelButton',$ /ALIGN_CENTER ,VALUE='CANCEL PROCESSING', $ EVENT_FUNC="cancelProcessing_event") Widget_Control, /REALIZE, cancelBase ;//Set something I can use to know it's been pressed widget_control, cancelBase, SET_UVALUE=0 ;//Create an outer and inner loop. I wanna…
creator: T Bowers
date: 1999-03-08T08:00:00-00:00

Re: cancel button to stop w/in an iterative loop?
type: item
description: Hi, an example is included. try x_slider_example. After you pressed break a breakpoint is set into the running script. It breaks then itself. R.Bauer ; Copyright (c) 1998, Forschungszentrum Juelich GmbH ICG-1 ; All rights reserved. ; Unauthorized reproduction prohibited. ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. ; ;+ ; NAME: ; x_slider ; ; PURPOSE: ; This widget function is used to place a slider in front to show steps of ; actions like an increment of a do loop. ; The break key is used to set if pressed a breakpoint into the source code. ; This widget don't use the xmanager ; ; CATEGORY: ; PROG_TOOLS/WIDGETS ; ; CALLING SEQUENCE: ; result=x_slider(minimum,maximum,[title=title],[/BREAK]) ; ; INPUTS: ; minimum: the start value ; maximum: the end value ; ; KEYWORD PARAMETERS: ; title: the title for the base ; break: if set the break key is defined - if pressed a breakpoint ; will be generated where x_slider_widget_event was started ; ; OUTPUTS: ; The result is a structure: ; base: the base id ; slider: the slider id ; ; EXAMPLE: ; result=x_slider(0,10000) ; widget_control,result.slider,set_val=100 ; widget_control,result.base,/destroy ; ; ; PRO x_slider_example ; result=x_slider(0,1000,title='CC',/break) ; FOR I=0,10 DO BEGIN ; WAIT,1 ; WIDGET_CONTROL,result.slider,set_val=100*I ; X_SLIDER_WIDGET_EVENT,result ; ENDFOR ; ; WIDGET_CONTROL,result.base,/destroy ; ; END ; ; MODIFICATION HISTORY: ; Written by: R.Bauer (ICG-1), 1998-Nov-18 ; 1998-12-02: keyword break added ;- PRO x_slider_example result=x_slider(0,1000,title='CC',/break) FOR I=0,10 DO BEGIN WAIT,1 WIDGET_CONTROL,result.slider,set_val=100*I X_SLIDER_WIDGET_EVENT,result ENDFOR WIDGET_CONTROL,result.base,/destroy END PRO x_slider_widget_event,x_slider_struct tagname=STRUPCASE('break') tags=TAG_NAMES(x_slider_struct) a=WHERE(ta…
creator: R.Bauer
date: 1999-03-10T08:00:00-00:00