none
Program help with array and check box RRS feed

  • Question

  • I have the following code that gets the number of files in a directory and then adds a checkbox to them using Fremy extensions, then list them in a row in the graphics window. What I would like to do is limit the lenght of the row list to ten checkboxes then start a new row limiting each row to ten.

      'Gets the number of files in item folder
      NumSelectBox  = File.GetFiles(Path + "\Items\Items folder\")'this is a bunch of text files in this directory
      Itemcount =  Array.GetItemCount(NumSelectBox)

      For i = 1 To Itemcount
        SelectItemNum  = NumSelectBox[i]
        ItemNumber = File.ReadContents  (SelectItemNum  )'Reads each file to get the item name
        ItemtextBox[i] = FCControls.AddCheckBox(ItemNumber)
          Controls.Move(ItemtextBox[i], 4,50 + 23*i)' 23 dictates the spacing
      EndFor

    Any help is greatly appreciated,

    Thanks,

    Steve

    Tuesday, August 16, 2011 5:16 PM

Answers

  • You can use two variables, X and Y, then use an If statement:

    If x > this amout Then

     x=starting amount

    EndIf

    This code however may be better for you:

    maxRows=3

    maxCols=10

    y=0

    x=0

    For i = 1 to maxRows

      y=y+50

      For j = 1 to maxCols

        check[j][i]=FCControls.AddCheckbox("CB("+j+","+i+")")

        FCControls.Move(check[j][i], x, y)

        x=x+50

      EndFor

      x=0

    EndFor

     


    ~~AirWaves!!~~

    • Proposed as answer by AirWaves Tuesday, August 16, 2011 7:41 PM
    • Marked as answer by SFC-P33A Wednesday, August 17, 2011 3:14 PM
    Tuesday, August 16, 2011 7:39 PM

All replies

  • You can use two variables, X and Y, then use an If statement:

    If x > this amout Then

     x=starting amount

    EndIf

    This code however may be better for you:

    maxRows=3

    maxCols=10

    y=0

    x=0

    For i = 1 to maxRows

      y=y+50

      For j = 1 to maxCols

        check[j][i]=FCControls.AddCheckbox("CB("+j+","+i+")")

        FCControls.Move(check[j][i], x, y)

        x=x+50

      EndFor

      x=0

    EndFor

     


    ~~AirWaves!!~~

    • Proposed as answer by AirWaves Tuesday, August 16, 2011 7:41 PM
    • Marked as answer by SFC-P33A Wednesday, August 17, 2011 3:14 PM
    Tuesday, August 16, 2011 7:39 PM
  • thank you AirWaves, that is very helpfiul
    Wednesday, August 17, 2011 3:15 PM