Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Linux/Linux Processes
Function:
Required plugins for this example: MBS Linux Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Linux/Linux Processes
This example is the version from Sun, 1st Mar 2014.
Project "Linux Processes.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control PList Inherits Listbox
ControlInstance PList Inherits Listbox
EventHandler Sub Change() KillButton.Enabled = me.ListIndex >= 0 if me.ListIndex >= 0 then dim p as LinuxProcessMBS = me.RowTag(me.ListIndex) if p<>Nil then ShowProcess p Return end if end if clear End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control fName Inherits Label
ControlInstance fName Inherits Label
End Control
Control fPath Inherits Label
ControlInstance fPath Inherits Label
End Control
Control Label2 Inherits Label
ControlInstance Label2 Inherits Label
End Control
Control Label3 Inherits Label
ControlInstance Label3 Inherits Label
End Control
Control fCWD Inherits Label
ControlInstance fCWD Inherits Label
End Control
Control EList Inherits Listbox
ControlInstance EList Inherits Listbox
End Control
Control Label4 Inherits Label
ControlInstance Label4 Inherits Label
End Control
Control fCommandLine Inherits Label
ControlInstance fCommandLine Inherits Label
End Control
Control OList Inherits Listbox
ControlInstance OList Inherits Listbox
End Control
Control UpdateButton Inherits BevelButton
ControlInstance UpdateButton Inherits BevelButton
EventHandler Sub Action() update End EventHandler
End Control
Control KillButton Inherits BevelButton
ControlInstance KillButton Inherits BevelButton
EventHandler Sub Action() dim p as LinuxProcessMBS = plist.RowTag(plist.ListIndex) if p<>Nil then dim s as new shell s.Execute "kill "+str(p.ProcessID) MsgBox str(s.ErrorCode)+": "+s.Result end if End EventHandler
End Control
Control fStartTime Inherits Label
ControlInstance fStartTime Inherits Label
End Control
Control Label5 Inherits Label
ControlInstance Label5 Inherits Label
End Control
EventHandler Sub Open() update End EventHandler
Private Sub Clear() fPath.Text = "" fName.Text = "" fCWD.Text = "" fCommandLine.Text = "" fStartTime.Text = "" EList.DeleteAllRows End Sub
Private Sub ShowProcess(p as LinuxProcessMBS) dim d as Dictionary fPath.Text = p.Path fName.Text = p.Name fCWD.Text = p.CurrentWorkingDirectory fCommandLine.Text = p.CommandLine // environment EList.DeleteAllRows d = p.Environment if d<>Nil then for each key as Variant in d.keys dim value as Variant = d.Value(key) EList.AddRow key, value next end if // open files OList.DeleteAllRows d = p.OpenFiles if d<>Nil then for each key as Variant in d.keys dim value as Variant = d.Value(key) OList.AddRow key, value next end if dim da as date = p.StartTime if da<>Nil then fStartTime.Text = da.LongDate+" "+da.LongTime else fStartTime.Text = "" end if End Sub
Private Sub Update() PList.DeleteAllRows dim myPID as integer = LinuxProcessMBS.PID dim processes() as LinuxProcessMBS = LinuxProcessMBS.Processes for each p as LinuxProcessMBS in processes PList.AddRow str(p.ProcessID) PList.RowTag(PList.LastIndex) = p if p.ProcessID = myPID then PList.ListIndex = PList.LastIndex end if next PList.ColumnAlignment(0) = PList.AlignRight oList.ColumnAlignment(0) = oList.AlignRight End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Linux Plugin.





Links
MBS Xojo Chart Plugins