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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.01.2015, 01:16   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Entering a multi line control in a grid
Источник: http://www.agermark.com/2015/01/ente...l-in-grid.html
==============

If you add a multi line FormStringControl to a grid, and set it up to just show one line in order to keep the normal layout of the grid, you will find that the control behaves differently depending on how you enter it; by keyboard or mouse.

If you enter the control by keyboard, it behaves as expected setting the cursor on the first line of the text. But, if you enter the control using the mouse it starts out by clearing the field and making it blank. Only when you click the field again or use up and down arrows it will show the text.

Today I spent a couple of hours trying to figure out how to fix it, and all I could come up with was the following odd solution. So, I run some code when I release the mouse button after moving the cursor into the field. This helps, but doesn't quite fix the problem. To fix it entirely I have to call that exact same code again after a short wait.

So here is my code. Executed once, and then again after a short wait for 100 ms.
X++:
public int mouseUp(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)
{
    int ret;

    ret = super(_x, _y, _button, _Ctrl, _Shift);

    this.setLineFocus();

    // The same code needs to be called again after a short wait in order to make
    // the control show the right line and move the cursor to that line
    this.setTimeOut('setLineFocus', 100);

    return ret;
}

private void setLineFocus()
{
    element.lock();
    [formStringControl].lineIndex(1);
    [formDataSource]_ds.refresh();
    element.unLock(false);
}
If I remove any part of this code, the fix won't work. I don't have any good explanations about this behavior, but it works so I'm happy leaving it at that.

Источник: http://www.agermark.com/2015/01/ente...l-in-grid.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось mazzy; 12.01.2015 в 21:31.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Setup a Manged WPF control for drag 'n' drop Blog bot DAX Blogs 0 22.01.2014 21:11
Axilicious:Hosting custom WPF calendar control in AX 2012 Blog bot DAX Blogs 0 20.05.2013 18:11
emeadaxsupport: AX for Retail 2012 R2: Adding a Custom User Control to the POS Blog bot DAX Blogs 0 27.02.2013 07:14
mscrm4ever: CRM 4.0 Supported Multi Select (Picklist) Control Blog bot Dynamics CRM: Blogs 0 25.12.2008 15:05
axaptafreak: Copying one line of a grid to Excel Blog bot DAX Blogs 0 17.01.2008 15:40

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

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

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