Thanks. This has helped. I had 

[code]
  with frmDM.qryGeneral, frmWizard do
  begin
    try
        [some code]
      with SQL do
      begin
        Clear;
        Add('SELECT MAX(ID) FROM ' + sliSQL[0]);
      end;
      Open;
      if Fields[0].AsInteger >= 1 then
        sliSQL[1] := Fields[0].AsString
      else
        sliSQL[1] := '1';
      Close; // obviously this was the culprit!
        [some more code]
    except;
      Exit;
    end;
  end;
end;[/code]


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Peter Luijer
Sent: 20 October 2005 19:35
To: [email protected]
Subject: RE: [delphi-en] mysterious form behaviour


Very stange indeed, I've never seen that before in my applications.

You haven't used any "With XXX Do" code anywhere, did you? that's 
always the thing I check first when something unexpectedly happens...

Consider the following:
[code]
  With TStringList.Create Do // Just as an example class
    Try
      // Do some stuff
    Finally  // I made an error here: it should've been Free, NOT Close
      Close; // A TStringlist doesn't have a Close method, so the form's
    End;     // Close-method is called instead!              
[/code]

or 

[code]
  With TStringList.Create, MyForm Do
    Try
      // Do some stuff
    Finally // In this case MyForm should have been set first, because
      Free; // now MyForm will be freed here, NOT TStringList!
    End;
[/code]


Greetz,

Peter.

> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Brigitte Spatz
> Sent: Thursday, October 20, 2005 5:54 PM
> To: [email protected]
> Subject: [delphi-en] mysterious form behaviour
> 
> 
> I have a form that is created at runtime. It contains a page control 
> with four pages, one of which is a selection (radio group) where the 
> user selects which of the other three pages to display. The selection 
> page is displayed every time one of the other three has been shown and

> the user clicks the Continue button. There's also a Cancel button. Now

> for some completely mysterious reason the form closes when the 
> selection page is displayed after one specific page has been displayed

> but not after the other two have been displayed. There's nothing in 
> the code that would call Close or CancelButtonClick (which contains 
> Close, but I've put a breakpoint in there and as expected the method 
> wasn't executed), so I haven't got the faintest idea why on earth the 
> form closes at this specific instance. The selection page's OnShow 
> code is still exectued (I've put a ShowMessage in there).
>  
> Has anybody ever heard of anything like this?
>  
> TIA.
>  
> Brigitte




-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links



 







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to