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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 18.04.2008, 20:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Ruslan Goncharov: Dynamic enabled() property for StringEdit and arrows
Источник: http://rusgon.blogspot.com/2008/04/d...tringedit.html
==============


Sometimes we need to enable or disable some field depending on value from another field.
The first way is using Group object where FrameOptionButton property is set to Check. For details see \Forms\tutorial_Form_groupOption
The second approach is setting enabled() property for StringEdit object.void enableControls(){ StringEdit_1.enabled(myTable.Field);}
Unfortunately we may notice that the arrow object of StringEdit doesn't work properly. Sometimes the arrow is vanish away from control.
The small modification should improve the arrow's behaviour.
In fact the arrow is the child window of StringEdit. The idea consists in managing state of parent and child window trough winApi.
All what we need to do is:
1. Add new enableWindow() method in WinApi class:// Created by GRRclient static boolean enableWindow(int _handle, boolean _value){ DLL _DLL = new DLL('USER32'); DLLFunction _enableWindow = new DLLFunction(_DLL, 'EnableWindow'); _enableWindow.returns(ExtTypes::DWord); _enableWindow.arg(ExtTypes::DWord); _enableWindow.arg(ExtTypes::DWord); return _enableWindow.call(_handle, _value);}
2. Rewrite our enableControls() method:void enableControls(){ void controlEnabled(FormControl control, boolean _value) { #WinApi int ctrlHwnd = control.hWnd(); int childHwnd = WinApi::getWindow(ctrlHwnd, #GW_CHILD); ; WinApi::showWindow(ctrlHwnd, #SW_SHOW); WinApi::showWindow(childHwnd, #SW_SHOW); WinApi::enableWindow(ctrlHwnd, _value); WinApi::enableWindow(childHwnd, _value); } ; controlEnabled(StringEdit_1, myTable.Field); controlEnabled(StringEdit_2, myTable.Field);}
AX 3.0 SP4

Источник: http://rusgon.blogspot.com/2008/04/d...tringedit.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


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

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

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