Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Timer Comparison
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /MacOSX/Timer Comparison
This example is the version from Tue, 18th Jan 2010.
Notes: Last modified: Tue, 18th Jan 2010
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class

Class Window1
Inherits Window
// Controls
ControlInstance
Sub Action() Handles Event
Canvas1.update

End Sub
End ControlInstance
ControlInstance
Sub ValueChanged() Handles Event
m.Period=me.Value
timer1.Period=me.Value

End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
End ControlInstance

// Properties
Dim m As mytimer

// Event implementations
Sub Open()
m=new MyTimer
m.Period=100
m.Mode=2


End Sub

// Methods
Private Sub draw()

End Sub
End Class

Class MyCanvas
Inherits Canvas
// Properties
Private Dim p As picture
Dim counter As Integer
Dim posr As Integer
Dim posg As Integer
Dim posb As Integer

// Event implementations
Sub Open()
p=NewPicture(me.Width,me.Height,32)

End Sub

// Methods
Sub update()
dim pos,w,r,g,b,i as integer

w=p.Width

p.Graphics.ForeColor=&c000000

counter=counter+4
posr=counter mod 512
posg=counter mod 512
posb=counter mod 512

for i=0 to w-1
posr=posr+4
posr=posr mod 512
if posr>255 then
r=511-posr
else
r=posr
end if

posg=posg+8
posg=posg mod 512
if posg>255 then
g=511-posg
else
g=posg
end if

posb=posb+16
posb=posb mod 512
if posb>255 then
b=511-posb
else
b=posb
end if
p.Graphics.ForeColor=rgb(r,g,b)

p.Graphics.DrawLine i,0,i,p.Height
next


Graphics.DrawPicture p,0,0
End Sub
End Class

Class MyTimer
Inherits CarbonEventsTimerMBS
// Event implementations
Sub Action()
window1.Canvas2.update

End Sub
End Class





Links
MBS Filemaker Plugins - Pfarrgemeinde Messdiener Nickenich