Alaska Software Inc. - Messagebox while downloading a file!
Username: Password:
AuthorTopic: Messagebox while downloading a file!
Marco MeyerMessagebox while downloading a file!
on Wed, 28 Jul 2004 20:38:21 +0200
Hello!

While downloading a file with oFtp:get(), I'd like to show the amount of
bytes, which are already downloaded. Is there a chance to do so?

Thanks
Marco
Phil Ide
Re: Messagebox while downloading a file!
on Thu, 29 Jul 2004 09:48:07 +0100
Marco,

> While downloading a file with oFtp:get(), I'd like to show the amount of
> bytes, which are already downloaded. Is there a chance to do so?

Which library are you using?  If you are using my XbFTP library, then yes
you can.  From the readme:

:sendFile( cLocalFilName, cRemoteFileName, xCallBack, nRetries )
:recvFile( cRemoteFileName, cLocalFilName, xCallBack, nRetries )

xCallback can be either:

 Code-block
        This is used as an asynchronous call-back.
        Part of the file is uploaded/downloaded and the callback is
        called.  File transfer does not continue until the callback
        function returns.

        The block must accept a single parameter, which then needs to be
        passed to the function nominated in the code-block.

        Example code block:

        {|a| MyCallBack(oDlg,a)}

  Dialog
        This is used for synchronous call-back.
        Part of the file is uploaded/downloaded and the status structure
        is posted to the dialog via the event queue.  File transfer
        continues immediately.  The dialog must be in another thread
        otherwise it will act synchronously (or not update at all).

        The dialog need not be an XbpDialog, it can be any Xbp* class.
        The important point is that the object inherits from
        XbpPartHandler, otherwise it will not respond to events sent
        to the event queue. So for example, you could use XbpStatic
        instead.

        The event sent is xbeP_XbFtp, and the status structure is passed
        as the first parameter (i.e. mp1).

        Example event handler method:

        METHOD TestGui:handleEvent( nEvent, mp1, mp2 )
           local i := AppName()
           do case
              case nEvent == xbeP_XbFtp
                 MyCallback( self, mp1 )
              otherwise
                 ::_TestGui:handleEvent( nEvent, mp1, mp2 )
           endcase
           return self

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Mercifully free of the ravages of intelligence.
Phil Ide
Re: Messagebox while downloading a file!
on Thu, 29 Jul 2004 09:51:31 +0100
Marco,

> While downloading a file with oFtp:get(), I'd like to show the amount of
> bytes, which are already downloaded. Is there a chance to do so?

Silly me - this is the ASINET NG, so I guess you ae using ASINET 

No, you cannot get an in-progress status during transfers.  You could look
at my library though if this functionality is important to you.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

Why do you park in a driveway, and drive on a parkway???