Questions about release of dynamic windows and themeengine VCL Component Development and Application
Http://www.delphi2007.net/DelphiVCL/html/delphi_20061221110256226.html
First, the first question
I have a dynamic query window form3. When I press button1 in form1, I create form3 and return the query database result to stringgrid1 on form3, when I click the form3 button1 (modalresult = mrok of form3.button1), I want to return the result to form1.edit1. text, the specific statement is as follows:
If query. frmquery. showmodal = mrok then begin
Showmessage ('20140901 ');
Edit1.text: = trim (query. frmquery. stringgrid1.cell [GlobleJ-1, query. frmquery. stringgrid1.row]);
End;
If you do not write action: = cafree in the close action of form3, the preceding statement is okay. If you write action: = cafree;, remove showmessage, however, when showmessage is added, an error is reported, which is a bit confusing. I am always confused here. Please help me explain why.
2nd problems: the above query window does not use themeengine. If I replace all the forms with themeengine, an error will be reported. The error prompt is as follows: project project1.exe raised exception class elisterror with message 'list Index out of bounds (-1) 'process stoped use step or run to continue.
Why?
Use the message communication mechanism between the two dialogs to ensure security.
Or change showmessage to application. showmessage ();
The second is that the index is out of bounds. Check the list subscript reference.
When action: = cafree is added, the form is released immediately after it is closed. If the form is closed, use the content in it. It is recommended that you do not add a release statement.
Can I refer to the following below in the list to explain more?
If frmquery has been released, the objects in it cannot be referenced.
As long as the object is present, you can debug it and check whether the reference is out of the range.
The subscript index in the list is based on 0. For example, there are 5 elements in the list, and the subscript ranges from 0 to 4.
Solve the problem. Thank you for the two upstairs.