Example: /Util/Threads/Listbox InvalidateCell on Thread

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Util/Threads/Listbox InvalidateCell on Thread


Required plugins for this example: MBS Util Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/Threads/Listbox InvalidateCell on Thread

This example is the version from Thu, 9th Oct 2013.

Project "Listbox InvalidateCell on Thread.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Thread1 Inherits Thread
ControlInstance Thread1 Inherits Thread
EventHandler Sub Run() dim n as integer = 0 do me.Sleep(1000) colors(n) = rgb(rnd*256, rnd*256, rnd*256) Listbox1.InvalidateCellThreadSafeMBS n,0 n = n +1 if n = 10 then n = 0 loop End EventHandler
End Control
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
EventHandler Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean if row<=UBound(colors) then g.ForeColor = colors(row) g.FillRect 0, 0, g.Width, g.Height Return true end if End EventHandler
EventHandler Sub Open() for i as integer = 0 to 9 me.AddRow "" colors.Append rgb(rnd*256, rnd*256, rnd*256) next End EventHandler
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
EventHandler Sub Open() Thread1.run End EventHandler
Property colors() As color
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
End Project

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


💬 Ask a question or report a problem