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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.07.2008, 22:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
Ruslan Goncharov: SysListSelect
Источник: http://rusgon.blogspot.com/2008/07/syslistselect.html
==============


In AX there is an easy tool for creating simple lists with following selection needed items called SysListSelect. In this form we may check/uncheck every item separately or whole list by clicking at Yes to All or No to All buttons.

Some information about SysListSelect we may find in MSDN SysListSelect class, but unfortunately description is very compact and it's hard even for experienced developer to understand how to fully use this tool. Following article is meant to fill this gap in knowledge.
To call SysListSelect form we don't need write any code. In Global class there is corresponding wrapper selectMultiple() method: /* Returns container with the status of how the form is closed plus the selected ids. */ static client container selectMultiple( Caption caption, str info, // An info text displayed in the top of the form container choices, container headers = conNull() // If null, the list view is used ) The first and second parameters are evident. There are form's caption and info respectively. At first glance third parameter is obvious too: choices container contains items we need to select. But be aware that each item consists from three fields:

label - (string) in fact this is an item we are selecting
id - (integer) item's identifier
set - (boolean) determines default state of item (checked\unchecked)

before passing choices into selectMultiple() we need to pack every item into container using sysListSelect::packChoice() static container packChoice( str label, int id, boolean set ) { return [label,id,set]; } Here we create our first row. con+=[sysListSelect::packChoice(label, id, set)]; The fourth parameter headers is used to show headers. That means that we may visualise more than one column. But how to pass these columns?
The answer is simple. If we need to pass some columns we just need to "divide" each label at columns by '\n' symbol:

label = column1+'\n'+column2+'\n'+...+columnN

Thats all. Now we are ready to launch SysListSelect form. static void sysListSelectSampleJob(Args _args) { container con; container ret; boolean ok; str label; int id; boolean set; ; label = 'label_11'+'\n'+'label_12'; id = 1; set = false; con+=[sysListSelect::packChoice(label, id, set)]; label = 'label_21'+'\n'+'label_22'; id = 2; set = true; con+=[sysListSelect::packChoice(label, id, set)]; [ok, ret] = selectMultiple('Caption','Info', con, ['First column', 'Second column']); conView(ret); }


I absolutely forgot to say that selectMultiple() returns container which first parameter is boolean (in our example this is ok) pointing whether was pressed OK button or not and container of selected id's.



Here we selected 2 elements.
And here we try to work with AX breakpoints (something similar with native SysBreakpoints form)static void sysListSelectBreakpointsJob(Args _args) { container con; container ret; boolean ok; str label; int id; boolean set; container breakpoints; int i, bpLen; ; breakpoints = infolog.breakpoint(); bpLen = conLen(breakpoints); for(i=2; i<span class="sy0">
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Ruslan Goncharov: A few words about sorting codes Blog bot DAX Blogs 0 18.02.2009 21:05
Ruslan Goncharov: Dynamic enabled() property for StringEdit and arrows Blog bot DAX Blogs 0 18.04.2008 20:05
Ruslan Goncharov: Scrolling in AX 3.0 without dll Blog bot DAX Blogs 0 09.03.2008 23:20
Ruslan Goncharov: Posting InventJournal from X++ Blog bot DAX Blogs 9 27.02.2008 13:12
Ruslan Goncharov: Sending message to user Blog bot DAX Blogs 0 26.01.2008 18:22

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

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

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