3c8efd56e9
* NEW: Update chinese translations. [EXAMPLES] * NEW: Add screenshots, switch to 1.0 version, and publish. [INTERPRETER] * NEW: Allow WAIT to raise errors. [GB.DESKTOP] * NEW: DesktopWindow.Geometry is a new property that returns the geometry of the window inside as a rectangle. * NEW: DesktopWindow.Frame is a new property that returns the geometry of the window outside (with the frame) as a rectangle. * NEW: DesktopWindow.GetScreenshot() is a new method that returns a screenshot of a window, with or without the frame. * BUG: DesktopWindow X, Y, Width and Height properties return the window geometry without the frame. [GB.GTK] * NEW: Raise an error if WAIT is called during a keyboard event. [GB.GTK3] * NEW: Raise an error if WAIT is called during a keyboard event. [GB.QT4] * NEW: Raise an error if WAIT is called during a keyboard event. git-svn-id: svn://localhost/gambas/trunk@6746 867c0c6c-44f3-4631-809d-bfa615b0a4ec
105 lines
2.2 KiB
Text
105 lines
2.2 KiB
Text
' Gambas class file
|
|
|
|
Public P As HttpClient
|
|
|
|
Public Sub P_Error()
|
|
|
|
LblInfo.Text = ("Error ") & P.Status
|
|
|
|
End
|
|
|
|
|
|
Public Sub Form_Open()
|
|
|
|
TextArea1.Text = ""
|
|
P = New HttpClient As "P"
|
|
|
|
End
|
|
|
|
|
|
Public Sub P_Connect()
|
|
|
|
LblInfo.Text = ("Waiting for reply...")
|
|
|
|
End
|
|
|
|
|
|
|
|
Public Sub P_Finished()
|
|
|
|
Dim sBuf As String
|
|
Dim MyLoop As Integer
|
|
|
|
LblInfo.Text = "OK"
|
|
|
|
TextArea2.Insert(P.Headers.Join("\n") & "\n")
|
|
|
|
If Lof(P) Then
|
|
sBuf = Read #P, Lof(P)
|
|
TextArea1.Text = sBuf
|
|
Endif
|
|
|
|
If (InStr(sBuf, "<value><int>")) Then
|
|
sBuf = Mid(sBuf, InStr(sBuf, "<value><int>") + 12)
|
|
MyLoop = 1
|
|
Label6.Text = TextBox1.Text & " + " & TextBox2.Text & " = "
|
|
Do While Mid(sBuf, MyLoop, 1) <> "<"
|
|
Label6.Text = Label6.Text & Mid(sBuf, MyLoop, 1)
|
|
MyLoop = MyLoop + 1
|
|
Loop
|
|
If (InStr(sBuf, "<value><int>")) Then
|
|
sBuf = Mid(sBuf, InStr(sBuf, "<value><int>") + 12)
|
|
MyLoop = 1
|
|
Label7.Text = TextBox1.Text & " - " & TextBox2.Text & " = "
|
|
Do While Mid(sBuf, MyLoop, 1) <> "<"
|
|
Label7.Text = Label7.Text & Mid(sBuf, MyLoop, 1)
|
|
MyLoop = MyLoop + 1
|
|
Loop
|
|
Else
|
|
Message.Error("Error")
|
|
End If
|
|
Else
|
|
Message.Error("Error")
|
|
End If
|
|
|
|
|
|
End
|
|
|
|
|
|
Public Sub Button1_Click()
|
|
|
|
Dim sCad As String
|
|
LblInfo.Text = ("Connecting...")
|
|
TextBox1.Text = Val(Trim(TextBox1.Text))
|
|
TextBox2.Text = Val(Trim(TextBox2.Text))
|
|
Wait
|
|
TextArea1.Text = ""
|
|
sCad = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?>" & Chr(13) & Chr(10)
|
|
sCad = sCad & "<methodCall>" '& Chr(13) & Chr(10)
|
|
sCad = sCad & "<methodName>sample.sumAndDifference</methodName>" '& Chr(13) & Chr(10)
|
|
sCad = sCad & "<params>"
|
|
sCad = sCad & "<PARAM>"
|
|
sCad = sCad & "<value><i4>" & TextBox1.Text & "</i4></value>"
|
|
sCad = sCad & "</PARAM>"
|
|
sCad = sCad & "<PARAM>"
|
|
sCad = sCad & "<value><i4>" & TextBox2.Text & "</i4></value>"
|
|
sCad = sCad & "</PARAM>"
|
|
sCad = sCad & "</params>"
|
|
sCad = sCad & "</methodCall>"
|
|
If ChkProxy.Value Then
|
|
P.Proxy.Host = TxtProxy.Text
|
|
Else
|
|
P.Proxy.Host = ""
|
|
End If
|
|
P.URL = "xmlrpc-c.sourceforge.net/api/sample.php"
|
|
|
|
P.Post("text/xml", sCad)
|
|
|
|
End
|
|
|
|
|
|
Public Sub ChkProxy_Click()
|
|
|
|
TxtProxy.Enabled = ChkProxy.Value
|
|
|
|
End
|