comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Progress Bar - Cancel button problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Progress Bar - Cancel button problem [message #85559] Thu, 15 August 2013 22:22 Go to next message
moxament is currently offline  moxament
Messages: 26
Registered: April 2008
Junior Member
Dear All,

I created my own progress bar in idl. The progress bar works perfectly and show progress! my problem is with the cancel button. During the progress of whatever process, the cancel button can not be pressed. I mean when I want to push/click the cancel button while the process is working, the button can not be clicked/pushed (it looks like freezing). The cancel button can be pressed only when the progress is finished (when became 100%).

I tried all the options of the widget_base, widget_button, etc. with no hope!

Can anyone help please?

Your help is appreciated.

MA
Re: Progress Bar - Cancel button problem [message #85560 is a reply to message #85559] Fri, 16 August 2013 05:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
MAhmad writes:

> I created my own progress bar in idl. The progress bar works perfectly and show progress! my problem is with the cancel button. During the progress of whatever process, the cancel button can not be pressed. I mean when I want to push/click the cancel button while the process is working, the button can not be clicked/pushed (it looks like freezing). The cancel button can be pressed only when the progress is finished (when became 100%).
>
> I tried all the options of the widget_base, widget_button, etc. with no hope!
>
> Can anyone help please?

The trick is to check for the button event yourself in your loop, using
Widget_Event with the NoWait keyword set:

event = Widget_Event(self.cancelID, /NoWait)

You can see how this is done in the CheckCancel method of this progress
bar:

http://www.idlcoyote.com/programs/cgprogressbar__define.pro

The code to use the bar, and check for the button events, looks like
this:

cgProgressBar = Obj_New("CGPROGRESSBAR", /Cancel)
cgProgressBar -> Start
FOR j=0,9 DO BEGIN
IF cgProgressBar -> CheckCancel() THEN BEGIN
ok = Dialog_Message('The user cancelled operation.')
RETURN
ENDIF
Wait, 0.5 ; Would probably be doing something ELSE here!
cgProgressBar -> Update, (j+1)*10
ENDFOR
cgProgressBar -> Destroy

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Progress Bar - Cancel button problem [message #85575 is a reply to message #85560] Sun, 18 August 2013 21:40 Go to previous message
moxament is currently offline  moxament
Messages: 26
Registered: April 2008
Junior Member
On Friday, August 16, 2013 8:09:58 AM UTC-4, David Fanning wrote:
> MAhmad writes:
>
>
>
>> I created my own progress bar in idl. The progress bar works perfectly and show progress! my problem is with the cancel button. During the progress of whatever process, the cancel button can not be pressed. I mean when I want to push/click the cancel button while the process is working, the button can not be clicked/pushed (it looks like freezing). The cancel button can be pressed only when the progress is finished (when became 100%).
>
>>
>
>> I tried all the options of the widget_base, widget_button, etc. with no hope!
>
>>
>
>> Can anyone help please?
>
>
>
> The trick is to check for the button event yourself in your loop, using
>
> Widget_Event with the NoWait keyword set:
>
>
>
> event = Widget_Event(self.cancelID, /NoWait)
>
>
>
> You can see how this is done in the CheckCancel method of this progress
>
> bar:
>
>
>
> http://www.idlcoyote.com/programs/cgprogressbar__define.pro
>
>
>
> The code to use the bar, and check for the button events, looks like
>
> this:
>
>
>
> cgProgressBar = Obj_New("CGPROGRESSBAR", /Cancel)
>
> cgProgressBar -> Start
>
> FOR j=0,9 DO BEGIN
>
> IF cgProgressBar -> CheckCancel() THEN BEGIN
>
> ok = Dialog_Message('The user cancelled operation.')
>
> RETURN
>
> ENDIF
>
> Wait, 0.5 ; Would probably be doing something ELSE here!
>
> cgProgressBar -> Update, (j+1)*10
>
> ENDFOR
>
> cgProgressBar -> Destroy
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Thank you David. I will try your hint and see what I can get.

Cheers,

MA
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem with tick marks
Next Topic: READ_CSV: just one data field (=one column)?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:48:52 PDT 2025

Total time taken to generate the page: 0.00636 seconds