Okay, so the section I am working on is part of a MDI.
The user can run a query to search for a part and it displays some quick information into a string grid.
I have it set up so that the user can double click on a row in that grid, and it is supposed to basically take them through the process that they would go through to get to where they can edit that part.
It works like this:
It works just fine. I have tested it for all 3 needed scenarios and it works. Where it doesn't work, is if they don't close any of the forms, just go back to the Query form, and double click on a value of the same type.
(Example, there is scenario A, B, and C. They all work. If you have a type A double clicked through, and then do another search, and a type B shows up, then double click it, it will work right then. So A -> B or C, B -> A or C, etc. works, but not A->A , B->B, or C->C).
For each of these, the Query form basically just follows exactly how they would click and calls any needed button clicks, that way everything in the background that needs to happens still happens.
I have tried error trapping it down to a specific line it doesn't seem to want to be trapped.
The thing is, if I put in a [blue]ShowMessage[/blue] somewhere before it opens up the last form, after it has opened up the menu form, then it works fine. I can remove the [blue]ShowMessage[/blue] and it is broken again.
It doesn't matter which of the 3 scenarios it is, this happens. [blue]ShowMessage[/blue] and it works, no [blue]ShowMessage[/blue] and it doesn't.
What is Delphi doing that switching over to the tiny [blue]ShowMessage[/blue] dialog box allows it to just work smoothly?
I will also note that if they close the last form, be it the form corresponding to type A, B, or C, (even leaving open the menu screen) and then do the double click from query, it works just fine.
When the code selected the company and program, and then goes to the menu from there, that selector form already has in the called button click a section where it unmakes (release, free, set to nil) any children that are dependant on the menu form. That means that in the middle, even if they don't close the form specifically for A, B, or C, the forms poof anyways. Using the [blue]ShowMessage[/blue] has proven (at least by all I can tell) this by freezing the program when those forms do not exist.
The user can also click through these exact same processes manually an unlimited number of times without error.
The processes described above to create the error can also be repeated at least very many times with the error only occuring when mentioned.
I have no clue why.
Just in case, here is the code for an entire Scenario A:
Scenario B and C occur later if not exited.
I just don't understand how adding the [blue]ShowMessage[/blue] can make it work and removing it can break it. It is not even functional. And the forms are destroyed and created with or without it.
~
Give a man some fire, he will be warm for a day, Set a man on fire, he will be warm for the rest of his life.
The user can run a query to search for a part and it displays some quick information into a string grid.
I have it set up so that the user can double click on a row in that grid, and it is supposed to basically take them through the process that they would go through to get to where they can edit that part.
It works like this:
Code:
Form11.Show8(); // First select the program
Form11.Child8.ComboComp.Text := Form11.DBProgs[searchTrack].Company;
Form11.Child8.ComboCompSelect(Self);
Form11.Child8.ComboProg.Text := Form11.DBProgs[searchTrack].Name;
Form11.Child8.ComboProgSelect(Self);
It works just fine. I have tested it for all 3 needed scenarios and it works. Where it doesn't work, is if they don't close any of the forms, just go back to the Query form, and double click on a value of the same type.
(Example, there is scenario A, B, and C. They all work. If you have a type A double clicked through, and then do another search, and a type B shows up, then double click it, it will work right then. So A -> B or C, B -> A or C, etc. works, but not A->A , B->B, or C->C).
For each of these, the Query form basically just follows exactly how they would click and calls any needed button clicks, that way everything in the background that needs to happens still happens.
I have tried error trapping it down to a specific line it doesn't seem to want to be trapped.
The thing is, if I put in a [blue]ShowMessage[/blue] somewhere before it opens up the last form, after it has opened up the menu form, then it works fine. I can remove the [blue]ShowMessage[/blue] and it is broken again.
It doesn't matter which of the 3 scenarios it is, this happens. [blue]ShowMessage[/blue] and it works, no [blue]ShowMessage[/blue] and it doesn't.
What is Delphi doing that switching over to the tiny [blue]ShowMessage[/blue] dialog box allows it to just work smoothly?
I will also note that if they close the last form, be it the form corresponding to type A, B, or C, (even leaving open the menu screen) and then do the double click from query, it works just fine.
When the code selected the company and program, and then goes to the menu from there, that selector form already has in the called button click a section where it unmakes (release, free, set to nil) any children that are dependant on the menu form. That means that in the middle, even if they don't close the form specifically for A, B, or C, the forms poof anyways. Using the [blue]ShowMessage[/blue] has proven (at least by all I can tell) this by freezing the program when those forms do not exist.
The user can also click through these exact same processes manually an unlimited number of times without error.
The processes described above to create the error can also be repeated at least very many times with the error only occuring when mentioned.
I have no clue why.
Just in case, here is the code for an entire Scenario A:
Code:
Form11.Show8(); // First select the program
Form11.Child8.ComboComp.Text := Form11.DBProgs[searchTrack].Company;
Form11.Child8.ComboCompSelect(Self);
Form11.Child8.ComboProg.Text := Form11.DBProgs[searchTrack].Name;
Form11.Child8.ComboProgSelect(Self);
// Branch here if it is a Service part
[blue]if[/blue] (partIs.Caption = [green]'It is a Service part number'[/green]) [blue]then[/blue]
[blue]begin[/blue]
Form11.Child8.ButServ.Click;
[blue]for[/blue] i := 1 [blue]to[/blue] Form11.Child2.datagrid.RowCount - 1 [blue]do[/blue]
[blue]if[/blue] (QryGrid.Cells[3,QryGrid.Row] = Form11.Child2.datagrid.Cells[2,i]) [blue]then[/blue]
[blue]begin[/blue]
Form11.Child2.datagrid.Row := i;
Break;
[blue]end;[/blue]
Form11.Child2.ButDetail.Click;
Exit;
[blue]end;[/blue]
Scenario B and C occur later if not exited.
I just don't understand how adding the [blue]ShowMessage[/blue] can make it work and removing it can break it. It is not even functional. And the forms are destroyed and created with or without it.
~
Give a man some fire, he will be warm for a day, Set a man on fire, he will be warm for the rest of his life.