B4J Question Simple ListView

Discussion in 'B4J Questions' started by ElliotHC, Aug 4, 2019.

  1. ElliotHC

    ElliotHC Active Member Licensed User

    I need to display a simple list which will have a time in seconds, then a name.

    I'd like to fill the list with times and then sort them numerically but I don't seem to even have any entries.

    I've created the ListView in the designer "ListView_Times"

    Here is my code:

    Code:
    Private ListView_Times as listview ' Created with 'generate Dim' in designer 

    ' On Start
    ListView_Times.Initialize("ListView_Times")
    ListView_Times.Enabled = 
    True

    ' Main code
    ListView_Times.ClearSelection

    ListView_Times.Items.Add(
    "1.040 Dave Smith")
    ListView_Times.Items.Add(
    "1.001 Paul Jones")

    My box is empty?
     
  2. DonManfred

    DonManfred Expert Licensed User

    So i expect you are loading this Layout.
    In this case you should NOT initialize the Listview. It is done once you loaded the layout.
    Code:
    Sub Process_Globals
        
    Private fx As JFX
        
    Private MainForm As Form
        
    Private ListView1 As ListView
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
        MainForm = Form1
        MainForm.RootPane.LoadLayout(
    "Layout1"'Load the layout file.
        ListView1.Items.Add("Test1")
        ListView1.Items.Add(
    "Test2")
        MainForm.Show
    End Sub
     

    Attached Files:

    Erel, ElliotHC and mangojack like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice