File: w_main.srw
Size: 8232
Date: Tue, 19 Oct 2021 17:16:58 +0200
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type p_picture from picture within w_main
end type
type cb_get_gif from commandbutton within w_main
end type
type mle_response from multilineedit within w_main
end type
type st_4 from statictext within w_main
end type
type st_return from statictext within w_main
end type
type st_3 from statictext within w_main
end type
type st_status from statictext within w_main
end type
type st_statustext from statictext within w_main
end type
type st_2 from statictext within w_main
end type
type st_1 from statictext within w_main
end type
type cb_get_html from commandbutton within w_main
end type
type cb_cancel from commandbutton within w_main
end type
end forward

global type w_main from window
integer width = 2830
integer height = 1620
boolean titlebar = true
string title = "Microsoft XMLHTTP Object Demo"
boolean controlmenu = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
p_picture p_picture
cb_get_gif cb_get_gif
mle_response mle_response
st_4 st_4
st_return st_return
st_3 st_3
st_status st_status
st_statustext st_statustext
st_2 st_2
st_1 st_1
cb_get_html cb_get_html
cb_cancel cb_cancel
end type
global w_main w_main

type variables
n_xmlhttp in_http
String is_BaseUrl = "https://www.topwizprogramming.com/"

end variables
on w_main.create
this.p_picture=create p_picture
this.cb_get_gif=create cb_get_gif
this.mle_response=create mle_response
this.st_4=create st_4
this.st_return=create st_return
this.st_3=create st_3
this.st_status=create st_status
this.st_statustext=create st_statustext
this.st_2=create st_2
this.st_1=create st_1
this.cb_get_html=create cb_get_html
this.cb_cancel=create cb_cancel
this.Control[]={this.p_picture,&
this.cb_get_gif,&
this.mle_response,&
this.st_4,&
this.st_return,&
this.st_3,&
this.st_status,&
this.st_statustext,&
this.st_2,&
this.st_1,&
this.cb_get_html,&
this.cb_cancel}
end on

on w_main.destroy
destroy(this.p_picture)
destroy(this.cb_get_gif)
destroy(this.mle_response)
destroy(this.st_4)
destroy(this.st_return)
destroy(this.st_3)
destroy(this.st_status)
destroy(this.st_statustext)
destroy(this.st_2)
destroy(this.st_1)
destroy(this.cb_get_html)
destroy(this.cb_cancel)
end on

event open;mle_response.Visible = False
p_picture.Visible = False

end event

type p_picture from picture within w_main
integer x = 622
integer y = 512
integer width = 329
integer height = 176
boolean originalsize = true
boolean focusrectangle = false
end type

type cb_get_gif from commandbutton within w_main
integer x = 549
integer y = 64
integer width = 407
integer height = 100
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Get GIF File"
end type

event clicked;Boolean lb_Result
String ls_Method, ls_Url, ls_ContentType, ls_ImageFile

mle_response.Visible = False
p_picture.Visible = True

ls_ImageFile = in_http.of_GetTempDir() + "\dilbert.gif"

ls_Method = "GET"
ls_Url    = is_BaseUrl + "dilbert.gif"
ls_ContentType = in_http.Content-gif

lb_Result = in_http.of_HttpSend(ls_Method, ls_Url, ls_ContentType)
If lb_Result Then
   in_http.of_WriteFile(ls_ImageFile, in_http.responseBody)
   p_picture.PictureName = ls_ImageFile
End If

st_return.text     = String(lb_Result)
st_status.text     = String(in_http.httpstatus)
st_statustext.text = in_http.statusText

end event

type mle_response from multilineedit within w_main
integer x = 622
integer y = 512
integer width = 2126
integer height = 804
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
boolean hscrollbar = true
boolean vscrollbar = true
boolean displayonly = true
borderstyle borderstyle = stylelowered!
end type

type st_4 from statictext within w_main
integer x = 73
integer y = 516
integer width = 453
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "HTTP Response:"
boolean focusrectangle = false
end type

type st_return from statictext within w_main
integer x = 622
integer y = 228
integer width = 2126
integer height = 60
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
boolean focusrectangle = false
end type

type st_3 from statictext within w_main
integer x = 73
integer y = 228
integer width = 233
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Return:"
boolean focusrectangle = false
end type

type st_status from statictext within w_main
integer x = 622
integer y = 324
integer width = 2126
integer height = 60
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
boolean focusrectangle = false
end type

type st_statustext from statictext within w_main
integer x = 622
integer y = 420
integer width = 2126
integer height = 60
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
boolean focusrectangle = false
end type

type st_2 from statictext within w_main
integer x = 73
integer y = 420
integer width = 503
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "HTTP Status Text:"
boolean focusrectangle = false
end type

type st_1 from statictext within w_main
integer x = 73
integer y = 324
integer width = 370
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "HTTP Status:"
boolean focusrectangle = false
end type

type cb_get_html from commandbutton within w_main
integer x = 73
integer y = 64
integer width = 407
integer height = 100
integer taborder = 10
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Get HTML File"
end type

event clicked;Boolean lb_Result
String ls_Method, ls_Url, ls_ContentType

mle_response.Visible = True
p_picture.Visible = False

ls_Method = "GET"
ls_Url    = is_BaseUrl + "about.html"
ls_ContentType = in_http.Content-html

lb_Result = in_http.of_HttpSend(ls_Method, ls_Url, ls_ContentType)

st_return.text     = String(lb_Result)
st_status.text     = String(in_http.httpstatus)
st_statustext.text = in_http.statusText
mle_response.text  = in_http.responseText

end event

type cb_cancel from commandbutton within w_main
integer x = 2414
integer y = 1376
integer width = 334
integer height = 100
integer taborder = 40
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Cancel"
boolean cancel = true
end type

event clicked;Close(Parent)

end event