' Simple Syntax Hilighting example for Rapid-Q by William Yu
'
' QREdit        - Extension of QRichEdit with automatic syntax hilighting
'                 Not very complete, but you can handle all the special cases.
'
' NEW PROPERTIES:
'   HiLighColor - Color to use for hilighting keywords
'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 = 400
 height = 300
 caption = "Selettore aggiornamenti 1.02"
  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)-download.stategauge.width/2
download.stategauge.top = 200

form.showmodal


sub test
DIM Object AS QOLEOBJECT                  'This one is just for demonstrative issues


download.server ="www.holyguard.net"              'The Server property is to be set, assuming the port is 80
download.file="banners/hgw4.gif"                  'The File property is set, i.e. the name of the file to be gotten
download.outfile="c:/ftproot/image.gif"               '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(download.outvar) 
 '  Object.Free
 'end select
else
 showmessage (download.laststringerror)   'and if not False, then qdownload.lasterror, .laststringerror are
end if                                    'interesting
end sub
end struct
