File: w_main.srw
Size: 8900
Date: Mon, 31 Dec 2018 21:14:39 +0100
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type st_5 from statictext within w_main
end type
type st_6 from statictext within w_main
end type
type dw_databases from datawindow within w_main
end type
type cb_connect from commandbutton within w_main
end type
type sle_password from singlelineedit within w_main
end type
type sle_userid from singlelineedit within w_main
end type
type sle_database from singlelineedit within w_main
end type
type sle_server from singlelineedit within w_main
end type
type st_4 from statictext within w_main
end type
type st_3 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_cancel from commandbutton within w_main
end type
end forward

global type w_main from window
integer width = 1623
integer height = 1164
boolean titlebar = true
string title = "SQL Azure Connection Test"
boolean controlmenu = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
st_5 st_5
st_6 st_6
dw_databases dw_databases
cb_connect cb_connect
sle_password sle_password
sle_userid sle_userid
sle_database sle_database
sle_server sle_server
st_4 st_4
st_3 st_3
st_2 st_2
st_1 st_1
cb_cancel cb_cancel
end type
global w_main w_main

on w_main.create
this.st_5=create st_5
this.st_6=create st_6
this.dw_databases=create dw_databases
this.cb_connect=create cb_connect
this.sle_password=create sle_password
this.sle_userid=create sle_userid
this.sle_database=create sle_database
this.sle_server=create sle_server
this.st_4=create st_4
this.st_3=create st_3
this.st_2=create st_2
this.st_1=create st_1
this.cb_cancel=create cb_cancel
this.Control[]={this.st_5,&
this.st_6,&
this.dw_databases,&
this.cb_connect,&
this.sle_password,&
this.sle_userid,&
this.sle_database,&
this.sle_server,&
this.st_4,&
this.st_3,&
this.st_2,&
this.st_1,&
this.cb_cancel}
end on

on w_main.destroy
destroy(this.st_5)
destroy(this.st_6)
destroy(this.dw_databases)
destroy(this.cb_connect)
destroy(this.sle_password)
destroy(this.sle_userid)
destroy(this.sle_database)
destroy(this.sle_server)
destroy(this.st_4)
destroy(this.st_3)
destroy(this.st_2)
destroy(this.st_1)
destroy(this.cb_cancel)
end on

event open;String ls_server, ls_database, ls_userid, ls_password, ls_dbparm

ls_server   = sqlca.of_RegistryGet("DBProfile", "Server", "")
ls_database = sqlca.of_RegistryGet("DBProfile", "Database", "")
ls_userid   = sqlca.of_RegistryGet("DBProfile", "Userid", "")
ls_password = sqlca.of_RegistryGet("DBProfile", "Password", "")

sle_server.text   = ls_server
sle_database.text = ls_database
sle_userid.text   = ls_userid
sle_password.text = ls_password

end event

event close;// disconnect
sqlca.of_dblogoff()

end event

type st_5 from statictext within w_main
integer x = 73
integer y = 64
integer width = 1467
integer height = 68
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 = "Connect to SQL Azure via SQL Server Native Client 11.0"
boolean focusrectangle = false
end type

type st_6 from statictext within w_main
integer x = 73
integer y = 604
integer width = 590
integer height = 64
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Databases on the server:"
boolean focusrectangle = false
end type

type dw_databases from datawindow within w_main
integer x = 73
integer y = 668
integer width = 1467
integer height = 360
integer taborder = 70
string title = "none"
string dataobject = "d_sysdatabases"
boolean vscrollbar = true
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event rowfocuschanged;this.SelectRow(0, False)
this.SelectRow(currentrow, True)

end event

type cb_connect from commandbutton within w_main
integer x = 1207
integer y = 160
integer width = 334
integer height = 100
integer taborder = 50
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Connect"
end type

event clicked;String ls_server, ls_database, ls_userid, ls_password, ls_dbparm

ls_server   = sle_server.text
ls_database = sle_database.text
ls_userid   = sle_userid.text
ls_password = sle_password.text

sqlca.of_RegistrySet("DBProfile", "Server", ls_server)
sqlca.of_RegistrySet("DBProfile", "Database", ls_database)
sqlca.of_RegistrySet("DBProfile", "Userid", ls_userid)
sqlca.of_RegistrySet("DBProfile", "Password", ls_password)

SetPointer(HourGlass!)

If sqlca.of_dblogon() Then
   dw_databases.SetTransObject(sqlca)
   dw_databases.Retrieve()
   MessageBox( "Database Logon", &
               "Connection Success!", Exclamation! )
End If

end event

type sle_password from singlelineedit within w_main
integer x = 329
integer y = 484
integer width = 626
integer height = 84
integer taborder = 40
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
boolean password = true
borderstyle borderstyle = stylelowered!
end type

type sle_userid from singlelineedit within w_main
integer x = 329
integer y = 376
integer width = 626
integer height = 84
integer taborder = 30
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

type sle_database from singlelineedit within w_main
integer x = 329
integer y = 268
integer width = 626
integer height = 84
integer taborder = 20
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

type sle_server from singlelineedit within w_main
integer x = 329
integer y = 160
integer width = 809
integer height = 84
integer taborder = 10
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
borderstyle borderstyle = stylelowered!
end type

type st_4 from statictext within w_main
integer x = 73
integer y = 492
integer width = 242
integer height = 64
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Password:"
boolean focusrectangle = false
end type

type st_3 from statictext within w_main
integer x = 73
integer y = 384
integer width = 169
integer height = 64
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Userid:"
boolean focusrectangle = false
end type

type st_2 from statictext within w_main
integer x = 73
integer y = 276
integer width = 242
integer height = 64
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Database:"
boolean focusrectangle = false
end type

type st_1 from statictext within w_main
integer x = 73
integer y = 168
integer width = 178
integer height = 64
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Server:"
boolean focusrectangle = false
end type

type cb_cancel from commandbutton within w_main
integer x = 1207
integer y = 480
integer width = 334
integer height = 100
integer taborder = 60
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