Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

Required plugins for this example:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/MovingGradientBar
This example is the version from Sun, 4th May 2019.
Project "MovingGradientBar.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) draw g End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() canvas1.Invalidate count=count+1 if count=1024 then count=0 End EventHandler
End Control
Protected Sub draw(g as Graphics) dim w as integer=g.Width-1 dim h as integer=g.Height-1 for x as integer=0 to w dim d as integer = (x+count) mod 1024 dim rr as integer dim gg as integer dim bb as integer if d<256 then rr=d elseif d<512 then rr=511-d end if if d<256 then gg=0 elseif d<512 then gg=d-256 elseif d<768 then gg=767-d end if if d<512 then bb=0 elseif d<768 then bb=d-512 elseif d<1024 then bb=1023-d end if g.ForeColor=rgb(rr,gg,bb) g.DrawLine x,0,x,h next End Sub
Property Protected count As Integer
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

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

MBS Xojo blog