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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 28.10.2006, 16:40   #1  
Blog bot is offline
Blog bot
Участник
 
25,505 / 847 (80) +++++++
Регистрация: 28.10.2006
Fred Shen: Create a new method in runtime
Источник: http://fredshen.spaces.live.com/Blog...E4E3!172.entry
==============
Some one may need to use codes to create or edit a method in Axapta.
Here is an example to show how to create a lookup method for a form's field in runtime.

    static void CreateFieldMethod(Args _args)
    {

        TreeNode tn1,tnAddr, methodsNode;
        MemberFunction memberFunction;
        str source;
        ;

 
        //Thanks for Max Belugin's comments,
        //it is really good to use Verbatim String as well.
        //The reason why I use escape characters here is
        //because this line of code is copied from standard Axapta application :)
        tn1 = infolog.findNode(
"\Forms\Address\Data Sources\Address\Fields\AddrRecId");

        tnAddr = infolog.findNode( "
\Forms\Address" );
        methodsNode = tn1.AOTfindChild( 'Methods' );
        methodsNode.AOTadd('lookup');
        memberFunction = methodsNode.AOTfindChild( 'lookup' );
        source =
@"public void lookup(FormControl _formControl, str _filterStr)
                         {
                                super(_formControl, _filterStr);
                         }" ;

        memberFunction.AOTsetSource(source, false);
        memberFunction.AOTsave();
        methodsNode.AOTsave();
        tnAddr.AOTcompile();

    }




==============
Источник: http://fredshen.spaces.live.com/Blog...E4E3!172.entry
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Fred Shen: Failed to create COM objects on AX 4 AOS Blog bot DAX Blogs 0 08.12.2006 19:14
Fred Shen: Change the combobox options in RunbaseBatch class Blog bot DAX Blogs 0 28.10.2006 16:40
Fred Shen: Limited sessions in Axapta Blog bot DAX Blogs 0 28.10.2006 16:40
Fred Shen: Development Features of Dynamics Ax (Axapta) 4.0 Blog bot DAX Blogs 0 28.10.2006 16:40
Fred Shen: Access a method of formDataSource's field Blog bot DAX Blogs 0 28.10.2006 16:40

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 05:43.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.