Saturday, April 24, 2010

Preventing AX form to close

Friends although its very small thing and many of you might have done this multiple time but thought to put it here so that it can be useful for others. :-)

Override canClose method of that form, and call winAPI::minimizeWindow, whenthe form cannot be closed.

This is the sample code, but require new checkBox control (named"okToClose") with "autoDeclare" property is "Yes":

public boolean canClose()
{
boolean ret;
ret = super();
if (okToClose.value() == NoYes::Yes)
{
ret = true;
}
else
{
ret = false;
WinAPI::minimizeWindow(element.hWnd());
}
return ret;
}

No comments:

Post a Comment