Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form Loading

Posted on 1999-01-13
5
Medium Priority
?
168 Views
Last Modified: 2010-04-06
I have a main form in my DB application which loads other forms from a toolbar, I use the

If Assigned( frInformation ) Then
                 frInformation.Show
    else
        begin
             frInformation := TfrInformation.CreateApplication);
             frInformation.Show;
        end;

which works great My problem is this in this form (frInformation) I have a bunch of data controls linked to a data source. The OnDataChange event on this data source I have a routine that draw on the form (frInformation). problem is as the form load the OnDataChange event is triggered, I cannot use the if assigned(frInformation) because it does not work(it works by not on loading but if run once the user has control it does not change what am I doing wrong) , so how can i tell if thoses control are ready to recieve data?
0
Comment
Question by:DeanSmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1356334
I'm not sure if I understood your problem...

How about adding an OnPaint event handler for the frInformation form. In this frInformation.FormPaint handler you could set a global variable to true.

var frInformationIsReady : boolean = false;

procedure frInformation.FormPaint(Sender: TObject);
begin
  frInformationIsReady:=true;
end;

And in the frInformation.FormClose handler you could set this variable to false again.

Now this variable tells you if the frInformation form is ready to receive data.

Does this help?

Regards, Madshi.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356335
Another approach might be to assign the OnDataChange event in the OnShow event of the form so that it is not triggered when you load the form. (ie: Do not assign this event at design time.

Cheers,

Raymond.
0
 
LVL 1

Expert Comment

by:martin_g
ID: 1356336
Another thing you could do is set:

DataSource.Enabled:=false {at design time}

then for rhe Information form:

frmInformation.OnShow (Sender);
begin
  DataSource.Enabled:=true;
end;

0
 

Author Comment

by:DeanSmith
ID: 1356337
maybe I can give you some more information

three files (datamodule, mainform, detailsform)
in datmodule I have query with a datasource
in mainform I have a button that lauches detialsform
in detailsform I have a status bar which displays if the datasource is in browse/insert/edit mode.

in the datamodule/datasource ondatachange event I have a routine that check to see what the state is and displays it on the statusbar of the details form.

problem is
if the detailsform is loading and a ondatachange event is triggered whether it is enabled in the detailsform.onshow or detailsform.Activated it still comes up with a access violation







0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 380 total points
ID: 1356338
Set the enabled property of the datasource component to false. When the details form shown (OnShow event) set the enabled property of the DataSource to true.

Cheers,

Raymond.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question