Graphical Indicators in AX(Analogmeters)

Graphical indicators(Analogmeters) are used to display the results of a query or statistics related to measurements.

For each graphical indicator, you need to define the following:

  • A starting and ending value for a segmented semi-circle
  • The maximum value for each segment, or area, of the semi-circle
  • A header and a unit for all values
  • A color for each segment, text, value, and background.

Here is a small job which will create form and analogmeter at runtime. Values(Min,Max,Pos etc)are hardcoded in the below example.You can change the code to take the values from the tables.

static void createAnalogMeter(Args _args)
{
    Form                           formBrowse;
    FormActivexControl      activex;
    FormRun                      formRun;
    Args                            args;

    TreeNode                treeNode;
    Object  waitObject = new Object();
    ;

    formBrowse = new Form(‘AnalogMeter Example’, true);

    formBrowse.design().width(500);
    formBrowse.design().height(500);
    formBrowse.design().caption(‘Analogmeter’);
    formBrowse.design().addControl(FormControlType::ActiveX, ‘Browser’);

    args = new Args(formBrowse.name());
    args.name(formBrowse.name());
    args.object(formBrowse);

    formRun = classFactory.formRunClass(args);
    formRun.init();

    activex = formRun.design().controlName(‘Browser’);
    activex.height(1,1);
    activex.width(1,1);
    activex.className(‘{706FF037-D46D-11D2-AB8D-0008C7631C69}’);
    activex.BackColor(winapi::RGB2int(255,255,236));
    activex.displayHotArea(true);
    activex._Caption(‘Analog meter Example’);
    activex.minValue(22000);
    activex.maxValue(40000);
    activex.addMarker(25000,255,"This is where i stand");
    activex.NeedleColor(winapi::RGB2int(0,128,0));
    activex.pos(25000);
    formRun.run();

    formRun.detach();

    while (activex.pos() != 40000)
    {

        waitObject.setTimeOut(‘Notify’, 1000);
        waitObject.wait();
        activex.pos(activex.pos() + 1000);
    }

}

This is how analogmeter looks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: