Membuat Form Modal di Axapta 3.0
Untuk membuat Form Modal di axapta, yaitu dengan cara berikut :
Buatlah method baru di form :
void setFormModal( int _thisHWND, boolean _bModal)
{
DLL _winApiDLL;
DLLFunction _EnabledWindow;
DLLFunction _getTop;
DLLFunction _getNext;
DLLFunction _getParent;
void local_enableWHND( int _lHWND)
{
int lnextWnd;
lnextWnd = _getTop.call( _getParent. call(_lHWND) );
while (lnextWnd)
{
if (lnextWnd != _lHWND)
_enabledWindow. call(lnextWnd, (!_bModal));
lnextWnd = _getNext.call( lnextWnd, 2);
}
}
;
_winApiDLL = new DLL('user32' );
_getNext = new DLLFunction( _winApiDLL,
"GetWindow") ;
_EnabledWindow = new DLLFunction( _winApiDLL,
"EnableWindow" );
_getTop = new DLLFunction( _winApiDLL,
"GetTopWindow" );
_getParent = new DLLFunction( _winApiDLL,
"GetParent") ;
_getParent.returns( ExtTypes: : DWORD);
_getParent.arg( ExtTypes: : DWORD);
_EnabledWindow. returns(ExtTypes :: DWORD);
_EnabledWindow. arg(ExtTypes: : DWORD, ExtTypes:: DWORD);
_getTop.returns( ExtTypes: : DWORD);
_getTop.arg( ExtTypes: : DWORD);
_getNext.returns( ExtTypes: : DWORD);
_getNext.arg( ExtTypes: : DWORD, ExtTypes:: DWORD);
local_enableWHND( _thisHWND) ;
local_enableWHND( _getParent. call(_thisHWND) );
}
panggil fungsi ini pada method run:
public void run()
{
super();
this.setFormModal( this.hWnd( ), true);
}
dan pada method close :
public void close()
{
super();
this.setFormModal( this.hWnd( ), false);
}