[Gambas-user] Progress bar error while closing (Form_Close)

Sebastian Kulesz sebikul at ...626...
Mon Nov 5 16:04:49 CET 2012


On Mon, Nov 5, 2012 at 11:55 AM, J Sundar <sundarjeyachandran at ...626...> wrote:
> Please bear with me. I have not clearly understood as i have not tried this
> method earlier. The process "pFileCopy" is actually from other module. So i
> do not know how to implement your suggestion.
>
>
> On Mon, Nov 5, 2012 at 7:37 PM, Fabien Bodard <gambas.fr at ...626...> wrote:
>
>> you must to add a flag to test if th form can be closed
>>
>> if not bCanClose then
>>   Stop Event
>>   MakeCopy
>> endif
>>
>>
>>
>> 2012/11/5 J Sundar <sundarjeyachandran at ...626...>
>>
>> > I made a program which uses progress bar for removing and copying
>> > files/folder. For this I made a different form and calling it each time
>> > user remove/copy files. What i am trying to do is that when user click on
>> > close button (x) of progress bar i have tell user that "Please wait till
>> > process reach 100% and continue the process. Now i am getting is that my
>> > code displays the message correctly but closes the form immediately
>> > resulting in "in valid object" error. Here is the code i made for
>> > Form_Close () :-
>> >
>> > Public Sub Form_Close()
>> >
>> > If Var.pFileCopy.state = Process.Running Then
>> >     Message.Info("Please wait till process reach 100%")
>> >   Endif
>> >
>> > End
>> >
>> > Any help is appreciated.
>> >
>> >
>> ------------------------------------------------------------------------------
>> > LogMeIn Central: Instant, anywhere, Remote PC access and management.
>> > Stay in control, update software, and manage PCs from one command center
>> > Diagnose problems and improve visibility into emerging IT issues
>> > Automate, monitor and manage. Do more in less time with Central
>> > http://p.sf.net/sfu/logmein12331_d2d
>> > _______________________________________________
>> > Gambas-user mailing list
>> > Gambas-user at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>>
>>
>>
>> --
>> Fabien Bodard
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Central: Instant, anywhere, Remote PC access and management.
>> Stay in control, update software, and manage PCs from one command center
>> Diagnose problems and improve visibility into emerging IT issues
>> Automate, monitor and manage. Do more in less time with Central
>> http://p.sf.net/sfu/logmein12331_d2d
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

Here [0] you have a nice example on how to prevent the user from
closing the progress window.

If you look closely, you will see that at the Form_Close event, if the
user is not allowed to close the window ($bCanCancel == False)  then
the close event is stopped, and the operation continues. This variable
should be set when you start executing the process you need to inform
the user about.

Public Sub Form_Close()

  If Not $bCanCancel Then
    Stop Event
  Endif

End

Hope it helps!

[0] http://bazaar.launchpad.net/~sebikul/mundus/mundus-gb/view/head:/.src/fProgress.class




More information about the User mailing list