Using a static Ass value in the Privilege Level value of a component?

I have opened a parameterised popup, preceding the WinNewAt function with:

```

Ass(-2, "DeviceName", sDeviceName, 0)
Ass(-2, "Privilege", iPrivilege, 0)

WinNewAt(sPopupName, 10, 10, 1 + 4 + 256 + 512)

```

I want to use the iPrivilege value as the Privilege Level of a component, but I'm getting a "Bad integer value" error...

How would I do this?

Parents
  • I solved this by ignoring the Privilege Level and setting the Disable condition to `NOT GetPriv(?Privilege?, 0)` because clearly that makes sense.

    However, I have a similar issue, where I can't use this when passing ?Privilege? into a Genie's params and using the same GetPriv function inside the genie components??

    In the runtime I see the dot matrix overlay and there are no privilege restrictions... I wish I knew what the error was that the dots are telling me...

  • To assign a constant you have to put the value between single quotes:

    Ass(-2, "DeviceName", "'" + sDeviceName + "'", 0);
    Ass(-2, "Privilege", "'" + IntToStr(iPrivilege) + "'", 0);

    And if it still not works as expected, you might want to make sure the object treats the assignment as an integer by using:

    ?INT Privilege? instead of ?Privilege?

    Also, the word "privilege" and/or "priv" might be reserved words, so you could try using something else.

Reply
  • To assign a constant you have to put the value between single quotes:

    Ass(-2, "DeviceName", "'" + sDeviceName + "'", 0);
    Ass(-2, "Privilege", "'" + IntToStr(iPrivilege) + "'", 0);

    And if it still not works as expected, you might want to make sure the object treats the assignment as an integer by using:

    ?INT Privilege? instead of ?Privilege?

    Also, the word "privilege" and/or "priv" might be reserved words, so you could try using something else.

Children
No Data