none
LitDev Listview RRS feed

  • Question

  • Below is the code. Any idea why the data doesn't show in the listview, but does come out ok in textwindow? 

    Data[1]="That"
    Data[2]="Other"
    ArrayHeading[1]="Heading"
    MyListView=LDControls.AddListView(100,100,ArrayHeading)
    For x=1 To 2
      LDControls.ListViewSetRow(MyListView,x,Data[x])
      TextWindow.WriteLine(Data[x])
     


    JR

    Monday, January 30, 2017 1:00 AM
    Answerer

Answers

  • data[1] = "this"

    data = "1=this;"

    Both of these data is a 1D array - it holds variables with indices and values.

    data[1] is not an array it is just the value "this".

    Therefore i+"="+data[i] is an array (badly formed because it misses the last ; but interpreted by SB as an array)

    Monday, January 30, 2017 12:41 PM
    Moderator
  • There are different ways to handle arrays, Try to understasnd what happens in this program ;-)

    Data[1]="This"
    Data[2]="That"
    Data[9]="Those"
    Status=Array.IsArray(data)
    TextWindow.WriteLine(status)
    TextWindow.WriteLine(data)
    TextWindow.WriteLine(Data[2])
    Data=Data+"3=Final"
    TextWindow.WriteLine(data)
    


    Jan [ WhTurner ] The Netherlands

    Monday, January 30, 2017 4:03 PM
    Answerer

All replies

  • Data[1]="That"
    Data[2]="Other"
    ArrayHeading[1]="Heading"
    MyListView=LDControls.AddListView(100,100,ArrayHeading)
    For x=1 To 2
      LDControls.ListViewSetRow(MyListView,x,x+"="+Data[x])  '  values are array  
      TextWindow.WriteLine(Data[x])
    EndFor

    see here  .  Litdev already shown a sample program.

    https://social.msdn.microsoft.com/Forums/en-US/d0a66d88-231f-4373-9c7b-66b44551b5d5/litdev-extension-listview-control?forum=smallbasic

    Monday, January 30, 2017 2:29 AM
    Answerer
  • NaochanON,

    I know that if I do an append in front of the array that it will work. Also, if I do the code below it will work. If I change the = sign to ; it will work. By doing this though in the listview neither the = or the ; show, but what happens is in the listview what is shown is indented by 1 character. Also, if I get rid of the space before the = it won't work.

    So, my question is why do you even have to append anything to the array? The intellisense only says to use an array. It doesn't say to use an array and append " =" to the front of each value. To me it doesn't make sense to have to do that. So, I think the function isn't working quite right.

    Data[1]="This"
    Data[2]="Other"
    ArrayHeading[1]="Heading"
    MyListView=LDControls.AddListView(200,100,ArrayHeading)
    For i=1 To 2
      LDControls.ListViewsetRow(MyListView,i," ="+Data[i])
       TextWindow.WriteLine(" ;"+Data[i])
    endfor


    JR

    Monday, January 30, 2017 11:36 AM
    Answerer
  • According to the Intellisense the last parameter in ViewsetRow should be an array. See what the following program does:

    Data[1]="This"
    Data[2]="Other"
    ArrayHeading[1]="Heading     "
    ArrayHeading[2]="second"
    MyListView=LDControls.AddListView(200,100,ArrayHeading)
    For i=1 To 2
      LDControls.ListViewsetRow(MyListView,i,Data)
      '' TextWindow.WriteLine(" ;"+Data[i])
      Data[1]="book"
    endfor


    Jan [ WhTurner ] The Netherlands

    Monday, January 30, 2017 12:32 PM
    Answerer
  • data[1] = "this"

    data = "1=this;"

    Both of these data is a 1D array - it holds variables with indices and values.

    data[1] is not an array it is just the value "this".

    Therefore i+"="+data[i] is an array (badly formed because it misses the last ; but interpreted by SB as an array)

    Monday, January 30, 2017 12:41 PM
    Moderator
  • LitDev,

    Sorry, I don't get it. If I do the below the Array.IsArray says "True". Then if I print  Data out it looks just like data="1=this;" which is just like what your calling an array. What am I missing or not understanding? Seems like Small Basic sees it as an Array, but for some reason the Listview doesn't?

    Data[1]="This"
    Status=Array.IsArray(data)
    TextWindow.WriteLine(status)
    TextWindow.WriteLine(data)

    Thanks,


    JR



    Monday, January 30, 2017 3:31 PM
    Answerer
  • There are different ways to handle arrays, Try to understasnd what happens in this program ;-)

    Data[1]="This"
    Data[2]="That"
    Data[9]="Those"
    Status=Array.IsArray(data)
    TextWindow.WriteLine(status)
    TextWindow.WriteLine(data)
    TextWindow.WriteLine(Data[2])
    Data=Data+"3=Final"
    TextWindow.WriteLine(data)
    


    Jan [ WhTurner ] The Netherlands

    Monday, January 30, 2017 4:03 PM
    Answerer
  • OK. Got it. So, the data needs to be in array format which is "1=this;" or can be in array format which is data[1]="This". Before I just did the appending and knew that it worked, but then I got to thinking...why?

    Thanks to all,

     

    JR

    Monday, January 30, 2017 8:53 PM
    Answerer