AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 25.07.2008, 03:08   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
casperkamal: Adding custom images for Treenode in Dynamics Ax
Источник: http://casperkamal.spaces.live.com/B...CD63!446.entry
==============


Tree node and Icons for tree nodes are inseparable. Right icons can make your tree look lot different.. Here is one tweak for getting the difference.

This article deals with displaying external images as tree node icons.

Images used in Treenode should be passed as Imagelist. Ax has set a predefined set of classes starting with ImageListAppl that helps to manage different sorts of ImageLists. ImageListAppl is the base classes of all such classes.

The most appropriate way to enable a strong support for external images in tree node would be through modifying the ImageListAppl class to load external images. (Currently they can load only resource numbers). The following code below when added to the base class helps you load images externally or through resource nodes.

X++:
public void addImage(int _idNo, FilePath _filePath)
{
    int imageNum;
    Image image = new Image();
    try
    {
        if (_filePath)
        {
            image.loadImage(_filePath);
            imageNum = imagelist.add(image);
            imageConvert.insert(_idNo, imageNum);
        }
    }
    catch
    {
        warning(strfmt("@SYS85977"));
    }
}
Now let’s see the usage of the method we added. Take a class like ImageListAppl_Sales for example. Override the build method and implement in the way as you seen below.

this.I4C_addImage(#ImageNewPic, SysResource::getImagePath('myimage'));

Every Image loaded has to be identified through some resource numbers. Generally it is better if the new resource number you assign is greater than the system defined resource number.To identify the Highest resource number always refer to the “SysImageResources” form. (4.0 users you can use the Tutorial_resources form).

Two things to note from the above line of code.

-> The new Resource numbers has to be defined as a macro in a new macro node or to an existing macro node like resappl (it contains the standard resource number).

-> In the above example i have used an image from the resource node, you can also use an external image which is stored in the computer. (Resource node is preferred, coz it is easy to distribute)

To use this image all you need to do is just load the same Image list class with your tree control and then just refer to the new resource number for the image that you wanted to display.

X++:
salesLineTree.setImagelist(imageList.imageList());
SysFormTreeControl::addTreeItem(salesLineTree, displaystring, 0, 0, #myImage);
That’s what it takes to our new image to the tree node. So now you can widen your image space for tree icons with all kind of images you like…

Keep reading… :)

Источник: http://casperkamal.spaces.live.com/B...CD63!446.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics AX: Microsoft's strategy and vision for Dynamics AX and SOA Blog bot DAX Blogs 0 05.03.2009 18:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Inside Dynamics AX 4.0: Usage Scenarios Blog bot DAX Blogs 0 04.10.2007 05:15
casperkamal: Adding a Table field through X++ code in Dynamics Ax Blog bot DAX Blogs 1 02.04.2007 17:05
Dynamics AX: Why Dynamics AX beats SAP Blog bot DAX Blogs 0 10.01.2007 23:15

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:17.