CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't close my form. Close() isn't doing it.



I did not read your question properly but perhaps you should be 
using:

     Action = caFree;

Barry


> Date:          Mon, 5 Oct 1998 10:10:47 -0500 (CDT)
> Reply-to:      cpb-thread@zdtips.com
> From:          Daniel Hallmark <dgh@scott.net>
> To:            cpb-thread@zdtips.com
> Subject:       Re: Can't close my form. Close() isn't doing it.

> On Sat, 3 Oct 1998, Aurora wrote:
> 
> > Now the pgm has no probs exitting if I close on a button event, but from
> > FormCreate it won't work... I have my theories... I need solutions... :(
> 
> 
> I don't know if this will work for you, but I ran into a similar problem.
> 
> First some background:
> I write a lot of console CGI applications to process user input and 
> return files/data/etc from my company's website.  The latest application 
> had to create some graphs based on the numeric data I retrieved.  I tried 
> to use dynamically allocated Teechart components, but at some point they 
> were throwing an exception because they needed a window handle and 
> didn't have one.
> 
> My next plan was to create a form with the charts on them.  I could then 
> dynamically create the form and call its OnShow event from insde the 
> console app.  In the form's OnShow event I built the charts and saved 
> the images to disk.  Then I called Close() at the bottom of the OnShow 
> event because I needed the form to close itself automatically without 
> requiring any manual intervention.
> 
> The problem I ran into was that when the webserver ran the app, it would 
> hang up.  After running the chart module thru the debugger I got an 
> EInvalidOperation exception that said you couldn't modify the Visible
> property (which Close() does) inside the OnShow event.
> 
> My final solution was to call form->Show and form->Close both from the 
> external console part of the application instead of trying to have the 
> form close itself.  I don't know if you can write some kind of a wrapper 
> for your form, but maybe that would let you close the form and then 
> terminate the app in a separate step.
> 
> Hope this helps :)
> Daniel Hallmark
> 
> original method:
> //inside console app
>   TfrmChart *chart = new TfrmChart(0);
>   chart->Show();
>   delete chart;
> //end of consol app
> //inside TfrmChart::OnShow
>   // build charts and save to disk
>   Close(); // automatically close form -- this raises exception
> //end of TfrmChart::OnShow
> 
> new method:
> //inside console app
>   TfrmChart *chart = new TfrmChart(0):
>   chart->Show();    // if you need user interaction here ShowModal()
>   chart->Close();
>   delete chart;
> //end console app
> 
> 
=============================
(w) barry@triton.co.za
(h) kingbar@gem.co.za



W Komornicki's Home Page | Main Index | Thread Index