Friday, 28 February 2014

when double click data should add in forms AX 2012:

when double click data should add:

When double clicking on the field what ever the data in that field  can be added in to text field for that one we have to write this method
mouseDblClick()


for example :
first create one table its having some fields as ex(TestEmail)
Value,CurDate,ID,Name,Body




Create one new form(TestEmailForm) with our table(TestEmail)



Here in that form design level u can change the field property  AutoDeclaration to YES
(Which field u want to double click it adds the data to other field text data)
Here in our form if we double click on Value field, Amount field, CurDate field, ID field, Name field
That field data is added the Body field data
As



For double clicking adding the data of field
We will write the method in design level of field as
Design-field(ID)-method-mouseDbCclick()

public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
{
    int ret;

    ret = super(_x, _y, _button, _Ctrl, _Shift);

    TestEmail_Body.pasteText(strFmt("%1",TestEmail_ID.valueStr()));
    return ret;
}


Here in this
TestEmail_ID is the design level name of ID field (this can added  in to Body field data)
    TestEmail_Body is the design level name of Body field data(here the other field data will be added )

Like for all the fields design level we can add mouseDbClick method as
Here in Nmae field:
public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
{
    int ret;

    ret = super(_x, _y, _button, _Ctrl, _Shift);
    TestEmail_Body.pasteText(strFmt("%1",TestEmail_Name.valueStr()));
    return ret;
}

Here in CurDate field:
public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
{
    int ret;

    ret = super(_x, _y, _button, _Ctrl, _Shift);
    TestEmail_Body.pasteText(strFmt("%1",TestEmail_CurDate.valueStr()));
    return ret;
}

Here in Value field:
public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
{
    int ret;

    ret = super(_x, _y, _button, _Ctrl, _Shift);
    TestEmail_Body.pasteText(strFmt("%1",TestEmail_Value.valueStr()));
    return ret;
}


No comments:

Post a Comment