I've never done this in an OnButtonClick, but I think this will work:

         self.release;
         self.close;

What I usually do to get a self-closing window is just add this line 
to the OnFormClose event:

         action := caFree;


At 04:51 AM 2/28/2006, Andre van Zuydam wrote:
>Hi Everyone
>
>I've made an application that creates little post it windows on the
>desktop. Each window has the FormStyle fsStayOnTop property set.
>
>I have a button which I'm using for testing purposes and this creates
>the windows.  Notice I have changed the parent window to the desktop
>window to stop the forms from disappearing when I minimize my main app.
>
>
>procedure TfrmMain.Button1Click(Sender: TObject);
>var
>   frmPostIt : TfrmPostIt;
>begin
>   frmPostIt := TfrmPostIt.Create (nil);
>   frmPostIt.ParentWindow := GetDesktopWindow;
>   frmPostIt.lblText.Caption := 'Hello';
>   frmPostIt.jvTran.Mask := frmPostIt.JvImage.Picture.Bitmap;
>   frmPostIt.jvTran.Active := True;
>   frmPostIt.Show;
>end;
>
>
>This is my question :
>
>If I click on a button on the post it form I want it to close the post
>it window.  (It is probably an API call or some message that needs to be
>sent to windows)  What code could I put in that button click event?
>
>procedure TfrmPostIt.sbCloseClick(Sender: TObject);
>begin
>    { Your code here  PS Self.Free does not work and I could use
>Self.Hide but I don't want this in Memory anymore! }
>
>
>end;
>
>
>
>Thanks in advance for any help submitted!
>
>
>Andre van Zuydam
>Spiceware Software
>
>
>
>
>
>
>__________________________________________________
>Delphi-Talk mailing list -> [email protected]
>http://www.elists.org/mailman/listinfo/delphi-talk

Regards,
Sid Gudes
PIA Systems Corporation
[EMAIL PROTECTED] 


__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to