Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Components Writing > Re: How do I cl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 107 of 154
Post > Topic >>

Re: How do I close a Form programmatically?

by "Brett" <bgolson@[EMAIL PROTECTED] > Dec 15, 2004 at 07:04 AM

Michael Marsden wrote:
> In article <331392cf.5487980@[EMAIL PROTECTED]
>, Meikel Weber
> <m.weber@[EMAIL PROTECTED]
> writes
>
> >On 19 Feb 1997 03:07:00 GMT, "Steve Treesh" <streesh@[EMAIL PROTECTED]
>
> >wrote:
> >>....
> >>      Form1.close;    <--- this doesn't close the window
> >>
> >
> >Why not use "Close" alone without the "Form1." in front of it. But
in
> >fact I think this wouldn't help ...
> >
> >>I've tried using    ModalResult := mrCancel immediately before the
> >>close...no luck
> >>I've hooked an OnClose event...no luck.
> >>
> >
> >I experienced these problems some time ago. It is related to the
fact
> >that the form is not yet fully created and shown and somehow the
close
> >message is deleted somewhere (or ignored). I programmed around with
> >posting a user-defined message.
> >Instead of "Form1.Close" do a
> >PostMessage (Handle, WM_USER+101,0, 0);
> >
> >and then add a message handler
> >procedure WMUser101 (var Msg : TMessage); message WM_USER+101;
> >
> >procedure WMUser101;
> >begin
> >  Close
> >end;
> >
>
> Try using .Release instead - this basically executes .Close & then
..Free
> via a windows message.  Its much safer to use in FormCreate & events
> than .Close or .Free.
>
>                         -Mike
>
>
-----------------------------------------------------------------------
>  Michael Marsden   mikemars@[EMAIL PROTECTED]
>                    Home page -
http://www.webcom.com/mikemars/index.html
>                    Delphi -
http://www.webcom.com/mikemars/mikedelf.html
 




 1 Posts in Topic:
Re: How do I close a Form programmatically?
"Brett" <bgo  2004-12-15 07:04:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 6:04:14 CDT 2008.