29 July 2010

Loop through multiSelect grid selection

First of all the multiSelect property of the grid should be set to YES and if you need a button to process multiple grid selection you also should activcate the MultiSelect property of this button. Otherwise it won't be enabled.
To loop through the selected rows of the grid just use the following for statement:
void clicked()
{
    SalesLine salesLine;
    ;
    super();

    for (salesLine = SalesLine_ds.getFirst(true) ? 
                     SalesLine_ds.getFirst(true) : SalesLine_ds.cursor();
         salesLine;
         salesLine = SalesLine_ds.getNext())
    {
        salesLine.doSomethingVerySpecial(:-);
    }
    SalesLine_ds.research(true);
}

26 July 2010

SysImageRessources - Finding image ressource id

If you are looking for an Icon to display on a menuItem in an actionPane or whereever you'll need to find out the ressource id of an sysImage. To find out which images are available as ressources in Dynamics AX you should have a look at the Form SYSImageRessources Form (I always try to find it under tutorials). It shows the id, a preview of the image and the type of the image.