Posts tonen met het label Values. Alle posts tonen
Posts tonen met het label Values. Alle posts tonen

dinsdag 4 mei 2010

Detecting default values

Use the int prmIsDefault(anytype argument) function.

See: http://sysdictcoder.com/blog/detecting-default-values/

Example:
static void ADU_BMS_prmIsDefault(Args _args)
{
    container   myCon;
                
    str prmIsDefaultTest(container _con = myCon)
    {
        ;
        if (prmIsDefault(_con))
        {
            return "parameter was not provided, using default";
        }
        else
        {
            return "parameter was provided, using provided parameter";
        }
    }
    ;

    info(strfmt("test without parameter: %1", prmIsDefaultTest()));
    info(strfmt("test with parameter: %1", prmIsDefaultTest(myCon)));

    // Infolog output:
    // test without parameter: parameter was not provided, using default
    // test with parameter: parameter was provided, using provided parameter
}

vrijdag 9 april 2010

Form Radiobutton values

Ever wondered where the values in a Form RadioButton come from?
The properties of the Radiobutton AOT-object only show one value.
Where's the rest?

As an example, I'm using the DEV_SysTableBrowser, which can be found on Axaptapedia.

The AOT of that project - folded out to the radiobutton - looks like this:


When we run the form, it looks like this:



The radiobutton is grouped in the "Show fields" group, and has 3 values:
  • All fields
  • Field group
  • User setup
The properties of that radiobutton are:


So, we know that there are 3 items, and that item 1 has the value (Text) "All fields".
But where are the other 2 values?
Actually, they are also there, and here's how to reveal them:

Step 1: Select the Item property



Step 2: Enter the number of the item for which you want to see or set the value


Step 3: Tab out of the Item property


Notice that the Text property still says "All fields" (Item 1), while we have indicated that we want to see Item 2.
This is due to a refresh issue.
The Text doesn't get refreshed when the Item property changes.
We'll have to do the refresh ourselves.

Step 4: Select the Text property


Step 5: Tab out of the Text property


And there you have the value of the second item :)

These values are actually stored in an array.
This is the part of the .XPO file that defines this RadioButton.
See the highlighted part.