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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.12.2006, 12:50   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
casperkamal: Using Editor Scripts
Источник: http://casperkamal.spaces.live.com/B...CD63!186.entry
==============


Editor Scripts is the class that is responsible for displaying the scripts options and taking actions based on your selection. You can customize this Editorscripts class to add or change your customizations, and this would be the topic of this post…………..
Fig .1(refer to the image below) Scripts in X++ Editor Window.
Let us try to add an simple option to it, say a change log which will insert a comment line with the current user name and date stamp, something like this…….
//Modified by Kamal on 04/11/06
Let this appear as direct submenu of Scripts, all you need to do to add is create a new method in the editor scripts class. The name of the method has to be the name as you wanted it in the Scripts menu. An important aspect while creating your method is you must have a parameter of type editor. So the method should be typically like this…
Void modifyComment(editor e)
{
...
}
The parameter e received as parameter has several methods and functions to help you identify the current cursor position in the editor, the current line number ….. and much more. I leave it to you to explore further. For our case we have to insert the comment in the cursor position so all we have to do is form a string in the required pattern and then insert it. The code would look something like this…
void modifyComment(editor e)
{
str insertString;
UserInfo userInfo;
;
select firstonly name from userInfo where userInfo.id == curuserid();
insertString = '//Modified by ' + userInfo.name + ' on ' + date2str(systemdateget(), 123, 2, 3, 3, 3, 4);
e.insertLines(insertString);
}
Just compile and go ahead, our new scripts menu will list our option also along with the others available.
Note : if you want to get your option under any of the available option then you will have to prefix the submenu name with your method name using an underscore. Say we want to put our option under the already existing comment options then our method name would be something like this
void comments_modifyComment(editor e)
{

}
I have developed a simple editor script that will help to insert and remove block comments, something like
/* this…..
…………….. */
You can download it from Axapatapedia from the following link
http://www.axaptapedia.com/Image:Cla...s_modified.xpo
There is also one more article about editor scripts in Axaptapedia check out
http://www.axaptapedia.com/Editor_scripts_OpenInAOT

....................wow.






Источник: http://casperkamal.spaces.live.com/B...CD63!186.entry
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
casperkamal: A small addition to creation of Table throug x++ code in Dynamics Ax Blog bot DAX Blogs 0 03.04.2007 23:11
casperkamal: Creating custom Picking list in Dynamics - Part II Blog bot DAX Blogs 0 22.03.2007 21:41
casperkamal: Data XML Generation Wizard - Version 2.0 For Dynamics Ax Blog bot DAX Blogs 0 04.03.2007 23:04
casperkamal: Sending Emails from Ax Blog bot DAX Blogs 0 28.11.2006 14:10
casperkamal: Code Access security Blog bot DAX Blogs 0 10.11.2006 01:36

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

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

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