Actually you should put your code in the canClose method, because even with super commented out on the close the form will close,  override the canclose method to look like this

 

public boolean canClose()

{

    boolean ret;

 

    ret = super();

    if(ret)

        winapi::forceMinimizeWindow(element.hWnd());

   

    return false;

}

 

Then if the conditions exist that the form would be allowed to close it will be minimized, if the conditions are false for the form to close, then the form will stay open, and what ever standard messages will be displayed.

 

-Preston

 

 


From: Varden Morris [mailto:[EMAIL PROTECTED]
Sent: Friday, January 21, 2005 6:40 AM
To: [email protected]
Subject: Re: RE : [Axapta-Knowledge-Village] Does anybody know how I can prevent a form from closing but should minimize

 

I think this way is a smart way of doing it. In order for it to work you will have to override the canClose method instead of the close method. As steeve said, you only need the code for SC_MINIMIZE.

Varden Morris

 

J. Wray & Nephew Ltd. - Group I.S.

234 Spanish Town Road

Kingston 11, Jamaica, W.I.

 

Phone:  (876) - 923 - 6141 Ext. 2226
Fax:      (876) - 923 - 5372

Cell:      (876) - 3833566
Email:   [EMAIL PROTECTED]

            [EMAIL PROTECTED]  



Steeve Gilbert <[EMAIL PROTECTED]> wrote:

Override close() and comment the super() line and write that :

 

//Taken from technet

    #define.SC_MAXIMIZE        (61488)
    #define.WM_SYSCOMMAND      (0x0112)

    WinAPI::SendMessage(element.hWnd(), #WM_SYSCOMMAND, #SC_MAXIMIZE, '');

 

Now you just need the SC_MINIMIZE code. ;-)

 

Steeve...

 

-----Message d'origine-----
De : Myrl Stadnick [mailto:[EMAIL PROTECTED]
Envoyi : 20 janvier 2005 15:34
@ : [email protected]
Objet : [Axapta-Knowledge-Village] Does anybody know how I can prevent a form from closing but should minimize

 

 

 

Does anybody know how I can prevent a form from closing but should minimize when the close button on the upper right is clicked?

 

Regards,
Myrl Stadnick

 



Sharing the knowledge on Axapta.



Sharing the knowledge on Axapta.


Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'

Sharing the knowledge on Axapta.




Sharing the knowledge on Axapta.



Yahoo! Groups Links

Reply via email to