Solved

Form Loading

Posted on 1999-01-13
5
166 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 190 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 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