Rapid-Q Documentation by Andreas Fink (c)2000  Appendix A: QDownload

QDownload Component

Offers an interface to download files from HTTP-Servers, either in the background or apparently, it has a sophisticated error diagnostic interface


QDownload Properties
Field Type R/W Default Support





Server STRING RW W
Port INTEGER RW 80 W
File STRING RW W
Outfile STRING RW W
Outvar STRING R W
Outdevice INTEGER RW 1 W
Statedevice INTEGER RW 1 W
State INTEGER R W
Size INTEGER R W
LastError INTEGER R W
LastStringError STRING R W
StateGauge QGAUGE RW .height=20; .width=200

QDownload Methods
Method Type Description Params Support





Leechfile FUNCTION Performs the Download, needs all settings to be made 0 W
Check FUNCTION Checks for an Internet Connection 0 W
Percent FUNCTION Calculates the current State in Percent 2 W

QDownload Events
Event Type Occurs when... Params Support





 None        

QDownload Examples

'Example for Qdownload usage

$TYPECHECK ON                           'Use these !!!!
$include "rapidq.inc"
$include "qdownload.inc"

dim download as qdownload               ' You should create an instance here
declare sub test

'That's all well known

create form as qform
 width = 220
 height = 260
 caption = "QDownload Example"
  create button as qbutton
   top = 10
   width = 80
   left = (form.clientwidth/2)-button.width/2
   Caption = "Download!"
   onclick  = test
  end create
  create edit1 as qedit
   top = 50
   text ="Server.com"
   left = (form.clientwidth/2)-edit1.width/2
  end create
  create edit2 as qedit
   top = 80
   text ="Path/Filename"
   left = (form.clientwidth/2)-edit2.width/2
  end create
  create edit3 as qedit
   top = 110
   text ="LocalDrive:/Localpath/Filename"
   left = (form.clientwidth/2)-edit2.width/2
  end create
  create checkbox1 as qcheckbox
   top = 140
   width = 160
   left = (form.clientwidth/2)-checkbox1.width/2
   caption = "Show Status in Gauge"
  end create
  create checkbox2 as qcheckbox
   top = 170
   width = 200
   left = (form.clientwidth/2)-checkbox2.width/2
   caption = "Save to file (X) or show using word ()"
   end create
end create

'Here you should determine the qgauge's appearance
download.stategauge.parent = form
download.stategauge.left = (form.clientwidth/2)-t.stategauge.width/2
download.stategauge.top = 200

form.showmodal


sub test
DIM Object AS QOLEOBJECT                  'This one is just for demonstrative issues


download.server =edit1.text               'The Server property is to be set, assuming the port is 80
download.file=edit2.text                  'The File property is set, i.e. the name of the file to be gotten
download.outfile=edit3.text               'The Outfile property is set, i.e. the file the downloaded file 
                                          'will be saved in  

select case checkbox2.checked
case True
  download.outdevice = 2                  'The Outdevice property is set, i.e. 1 = qdownload.outvar
end select                                '                                    2 = qdownload.outfile 


select case checkbox1.checked 
case True
  download.statedevice=2                  'The Statedevice property is set, i.e. 1 = qdownload.state
end select                                '                                      2 = qdownload.stategauge


if download.leechfile then                'And do it, if all works well leechfile returns True
 select case checkbox2.checked
 case False
   Object.CreateObject("word.basic") 
   Object.AppShow 
   Object.FileNew 
   Object.Insert(t.outvar) 
   Object.Free
 end select
else
 showmessage (download.laststringerror)   'and if not False, then qdownload.lasterror, .laststringerror are
end if                                    'interesting
end sub

Prev Component Contents
Hosted by uCoz