Announcement

Collapse
No announcement yet.

Update Edit Field not working or erroring out

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

  • Update Edit Field not working or erroring out

    Hi,

    Can anyone help me understand why I can't update/show the result of Dialog.FileBrowse on a CTRL_EDIT_01 with DlgEditField.SetProperties? I have tried many configurations for this to work but its impossible (for me)

    I keep getting an error saying it must be a string or some times no errors but nothing happens.

    Code:
    ClientZIPLocation = Dialog.FileBrowse(true, "Locate File", _SourceFolder, "Client (Client*.zip)|Client*.zip|", "", "zip", false, true);
    DlgEditField.SetProperties(CTRL_EDIT_01, {Text = SessionVar.Expand(ClientZIPLocation)});
    Thanks for the help

  • #2
    The action Dialog.FileBrowse() returns a table as the result, containing the list of paths to the files that were selected. If only one file was selected, it will be stored at the index "1".

    DlgEditField.SetProperties() expects that you provide a string when you use the Text key.

    A table is not a string, even when the table contains only a single element, which happens to be a string, in the same manner as in different programming languages a matrix or vectors storing strings are also not strings themselves.

    Your code should look like this to work properly:

    Code:
    DlgEditField.SetProperties(CTRL_EDIT_01, { Text = SessionVar.Expand(ClientZIPLocation[1]) });
    Ulrich

    Comment


    • #3
      Hello Ulrich,

      Thank you very much for your help! I tried something similar before but I was using "0" instead of "1".

      Another question about the result of the action, I need the result to be used in a custom progress window, is this table/variable global already or I need to convert it to global?


      Anyway, thank you for the help!

      Comment


      • #4
        Unless you declare a variable explicitly as local, all variables in Lua are globals. If you define something on one screen or script, the content of that variable can be retrieved on another screen, nothing extra is required.

        Ulrich

        Comment

        Working...
        X