Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS CURL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/CURL URL Parser
This example is the version from Thu, 31th Oct 2018.
Project "CURL URL Parser.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control URLField Inherits TextArea
ControlInstance URLField Inherits TextArea
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.URL = me.Text
CheckError
URLtoFields
End EventHandler
End Control
Control SchemeField Inherits TextField
ControlInstance SchemeField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Scheme = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control UserField Inherits TextField
ControlInstance UserField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.User = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control PasswordField Inherits TextField
ControlInstance PasswordField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Password = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control OptionsField Inherits TextField
ControlInstance OptionsField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Options = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control HostField Inherits TextField
ControlInstance HostField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Host = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
Control PortField Inherits TextField
ControlInstance PortField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.port = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label6 Inherits Label
ControlInstance Label6 Inherits Label
End Control
Control PathField Inherits TextField
ControlInstance PathField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Path = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label7 Inherits Label
ControlInstance Label7 Inherits Label
End Control
Control QueryField Inherits TextField
ControlInstance QueryField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Query = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label8 Inherits Label
ControlInstance Label8 Inherits Label
End Control
Control FragmentField Inherits TextField
ControlInstance FragmentField Inherits TextField
EventHandler Sub TextChange()
if inside then return
dim inside as new InsideFlag
c.Fragment = me.Text
CheckError
URLField.Text = c.URL
End EventHandler
End Control
Control Label9 Inherits Label
ControlInstance Label9 Inherits Label
End Control
Control Label10 Inherits Label
ControlInstance Label10 Inherits Label
End Control
EventHandler Sub Open()
dim inside as new InsideFlag
c = new CURLSURLMBS
c.URL = URLField.Text
URLtoFields
End EventHandler
Sub CheckError()
if c.Lasterror <> 0 then
MsgBox "Error: "+str(c.Lasterror)
end if
End Sub
Sub URLtoFields()
FragmentField.Text = c.Fragment
HostField.Text = c.Host
OptionsField.Text = c.Options
PasswordField.Text = c.Password
PathField.Text = c.Path
QueryField.Text = c.Query
SchemeField.Text = c.Scheme
UserField.Text = c.User
if c.port = "0" then
PortField.Text = ""
else
PortField.Text = c.Port
end if
End Sub
Property Shared Inside As Boolean
Property c As CURLSURLMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class InsideFlag
Sub Constructor()
// turn on in constructor
MainWindow.Inside = true
End Sub
Sub Destructor()
// turn off automatically in destructor
MainWindow.Inside = false
End Sub
End Class
End Project
See also:
The items on this page are in the following plugins: MBS CURL Plugin.