Yesterday I did some tests to add and use a DesktopListbox at runtime on a dynamic created DesktopWindow at runtime. The problem seems very straightforward. However, I spent at least an hour looking into why the data in the ListBox was not showing. The fact that I didn’t add the DefaultRowHeight statement was the culprit. I want to share my experiments with all readers of this forum:
//Create new window from DestopWindow
Var w3 As DesktopWindow= new DeskTopWindow
w3.Type = DesktopWindow.Types.Document
w3.Title = "Test"
w3.Top = 200
w3.Left = 400
w3.Height = 500
w3.Width = 800
w3.Visible = True
//Create new Listbox
Var s As DesktopListbox = New DesktopListbox
s.Enabled = True
s.HasBorder = True
s.HasHeader = True
s.GridLineStyle = DesktopListbox.GridLineStyles.Both
s.Left = 20
s.Top = 20
s.Height = 200
s.Width = 600
s.ColumnCount = 2
s.DefaultRowHeight = 20 //Data will not be shown without this statement!
s.Visible = True
w3.AddControl(s) //Add Listbox to Window
//Add Data
s.HeaderAt(0) = "col0"
s.HeaderAt(1) = "col1"
var items() As String
items.add("test1")
items.add("test2")
s.AddRow(items)
items.RemoveAll
items.add("test3")
items.add("test4")
s.AddRow(items)
w3.Show
To save valuable time it would be very useful to provide, for each control, the list of properties that are required during the creation of a control at runtime.