Announcement

Collapse
No announcement yet.

SetProperties with Variable possible?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SetProperties with Variable possible?

    Hi there, is it possible to set properties with a variable?

    Have a Screen with 4 Checkboxes. On preload it should check whether files exist and activate a box (1 file = 1 box).

    Tryed this, but don´t work...

    Code:
    files = {"file1.exe","file2.exe","file3.exe","file4.exe"};
    boxes = {"CTRL_CHECK_BOX_01", "CTRL_CHECK_BOX_02", "CTRL_CHECK_BOX_03", "CTRL_CHECK_BOX_04"};
    
        for j,k in pairs(files) do
            if File.DoesExist(k) then
                DlgCheckBox.SetProperties(boxes[j], {Enabled = true, Checked=true});
            else
                DlgCheckBox.SetProperties(boxes[j], {Enabled = false, Checked=false});
            end
        end
    Code:
    --This works, but is to long...
    
    if File.DoesExist(files[1]) then
        DlgCheckBox.SetProperties(CTRL_CHECK_BOX_01, {Enabled = true, Checked=true});
    else
        DlgCheckBox.SetProperties(CTRL_CHECK_BOX_01, {Enabled = false, Checked=false});
    end
    
    if File.DoesExist(files[2]) then
        DlgCheckBox.SetProperties(CTRL_CHECK_BOX_02, {Enabled = true, Checked=true});
    else
        DlgCheckBox.SetProperties(CTRL_CHECK_BOX_02, {Enabled = false, Checked=false});
    end
    
    ---...
    Any other idea?

  • #2
    It might work if you remove the quotes from the boxes array, as CTRL_CHECK_BOX_01 is a number, not a string.

    Ulrich

    Comment


    • #3
      Can't believe that simple f*****g Quotes makes me crazy!

      Awesome Ulrich, many thanks!

      Comment

      Working...
      X