Monday, July 11, 2011

Paint it black: How to color rows in Table form control

There a lot of answers on how to color grid lines and cells -- for example, this DisplayOption using from DAXGuy. However, my goal is to show how one can paint rows in Table form control. I use the standard tutorial form tutorial_Form_Table from AX2009.

On the table control, we need to change a bit EditControl method where we define in which color the current row will be painted. (Here, I provided you with a link where you can choose RGB colors to paint the hell at your own.)


// Color the active line in a table
FormControl editControl(int column, int row)
{
    #DEFINE.colorDarkTurkoise(112,147,219)                  // colors at your personal perception of hell
    #DEFINE.colorNeonBlue(77,77,255)
    #DEFINE.colorRosyBrown(255,193,193)
    #DEFINE.colorSaddleBrown(139,69,19)
    int oldStrColor = WinApi::RGB2int(#colorRosyBrown);     // colors for cells not in focus
    int oldIntColor = WinApi::RGB2int(#colorSaddleBrown);
    int newIntColor = WinApi::RGB2int(#colorNeonBlue);      // colors for the selected line
    int newStrColor = WinApi::RGB2int(#colorDarkTurkoise);
    ;
    // this is columns with int controls
    if ((column == 2) || (column == 4))
    {
        // not in the header
        if (row > 1)
        {
            // this is in the selected line
            if (row == table.row())
                intEdit.backgroundColor(newIntColor);
            else
                intEdit.backgroundColor(oldIntColor);
            return intEdit;
        }
        // this is the header
        else
        {
            if (row == table.row())
                editline.backgroundColor(newStrColor);
            else
                editline.backgroundColor(oldStrColor);
            return editline;
        }
    }
    else
    {
        if (row == table.row())
            editline.backgroundColor(newStrColor);
        else
            editline.backgroundColor(oldStrColor);
        return editline;
    }

}

So, when the user selects another row, all its controls change their color--it's your responsibility to return the correct form control: StringEdit, IntEdit and so on.

The second method where we redraw the form is activeCellChanged.


public void activeCellChanged()
{
    ;
    super();
    // do not forget to repaint the form!
    element.redraw();
}

Coloring can be realized much more complicated with different color scheme, calculated conditions etc.

Friday, May 13, 2011

Monday, May 2, 2011

How to find your object in AOT projects

This is a small but precious tool for AX developing.

Have you ever tried to find in which projects your objects are included? Yes, I have... Not so easy to search and look into each project.

Now, it is just a question of one click: this mighty LC Project Search will make the life easier. And good news, it is free. So, profit and enjoy!

There are three xpo-files with appropriate versions for AX 4.0, 2009, and 2012. (I have tested 2009 one). You can import it, then launch with the menu item, and this is ready to go.




Just type the name of any object you're looking for, optionally, you can choose the type of it, then press Search. Be patient, it takes some time to populate the result table.




Now, all projects contain the object are here.

Take a look at Loncar Technologies company web site: there you can get some more.

Friday, January 7, 2011

How to delete Pending Invoices

Still can't find how to kill your pending invoices? This new functionality made me crazy sometimes but now it's getting easier thanks to Raju Roy Chowdhurywho showed me this trick:

Go to
Accounts Payable --> Inquiries --> History --> Invoices

then find your invoices with Waiting status and delete them. Easy, eh?

Tuesday, November 16, 2010

Invitation to Advertise on LinkedIn

Who needs $100 USD free advertising on LinkedIn, drop me a line in comments

Friday, November 12, 2010

Quick User Manual On Outlook Rules (Epic Fail)

Sometimes, I have to send short manuals to my AX users. This is an excerpt (kinda epic fail...)

Friday, October 29, 2010

This seems to do nothing

I have been debugging new AX2009 to which we migrated recently, and sometimes it is a real fun!


if (numberOfTransOpen == 1 ||
            (numberOfTransOpen > 1 && !printPaymentSchedule))
        {
            // this seems to do nothing
            if (printPaymentSchedule)
            {
                select firstonly tmpCustVendTransOpen;
            }