gspears060598
asked on
MDI Variables
I have an MDI application. This application has a window
of type TExplain_Graph. I will allow the user to open as many of these windows as they want. Each window will have a set of variables. For this example (see code below), assume one variable called StatusFlag. Any routine associated with this form needs to be able to access StatusFlag.
The problem I am running into is that EACH COPY OF THIS FORM will have it's own variables, with the same name, but with different values.
This is NOT the behavious that I am seeing.
Let's walk through a sample. I initially set the value of StatusFlag on FormCreate. When I first enter FormCreate, StatusFlag is null, or empty. I set the value in the routine.
If I then open a second copy of the window, then when I get to the FormCreate, the StatusFlag has the same value that was set by the First copy of the window. VARIABLES ARE BEING SHARED BETWEEN WINDOWS. This is not what I want.
Here's a copy of how I have the variable defined:
--------------------------
unit Explain_Graph_Form;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
...
type
TExplain_Graph = class(TForm)
...
private
{ Private declarations }
public
{ Public declarations }
end;
var {Global}
Explain_Graph: TExplain_Graph;
implementation
uses SQL_Form, Oracle_DataMod1, Main, DataModStuff;
var {Local}
StatusFlag : String;
{$R *.DFM}
procedure TExplain_Graph.FormCreate(
begin
StatusFlag := 'Level1';
end;
--------------------------
How do I define StatusFlag so that:
1). Within each COPY of a window, any routine can access the variable.
2). Each copy of the window has the same "set" of variables, but different values
Thanks
George Spears
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.