Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/TimerMBS
This example is the version from Thu, 27th Aug 2014.
Project "TimerMBS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Close()
if x<>Nil then
x.l = nil
x = nil
end if
if p<>Nil then
p.l = nil
p = nil
end if
End EventHandler
EventHandler Sub Open()
p = new PluginTimer(5)
p.l = List
p.LastTime = Microseconds
x = new XojoTimer
x.l = List
x.LastTime = Microseconds
x.Period = 5
x.Mode = 2
End EventHandler
Property p As PluginTimer
Property x As XojoTimer
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 PluginTimer Inherits TimerMBS
EventHandler Sub Action()
c = c + 1
if c < 100 and l<>Nil then
dim m as Double = Microseconds
times.append m
deltas.append m-LastTime
LastTime = m
else
if not done then
done = true
dim u as integer = UBound(times)
for i as integer = 0 to u
l.AddRow "Plugin Timer "+str(i+1), str(times(i), "0"), str(deltas(i), "0")
next
end if
end if
End EventHandler
Property LastTime As double
Property c As Integer
Property deltas() As Double
Property done As Boolean
Property l As listbox
Property times() As Double
End Class
Class XojoTimer Inherits Timer
EventHandler Sub Action()
c = c + 1
if c < 100 and l<>Nil then
dim m as Double = Microseconds
times.append m
deltas.append m-LastTime
LastTime = m
else
if not done then
done = true
dim u as integer = UBound(times)
for i as integer = 0 to u
l.AddRow "Xojo Timer "+str(i+1), str(times(i), "0"), str(deltas(i), "0")
next
end if
end if
End EventHandler
Property LastTime As double
Property c As Integer
Property deltas() As Double
Property done As Boolean
Property l As listbox
Property times() As Double
End Class
End Project
The items on this page are in the following plugins: MBS Win Plugin.