AV when editing dataview by clicking fields button
I created a simple descendant query designer that implements the following
in the OnCreate (as shown in the HideQDesignerTab.zip example)
EditOptions := [ppemPreview, ppemTables, ppemFields, ppemCalcs,ppemLink];
EnabledOptions := EditOptions;
however now when i click on the Fields button (in the tool window) to start
the query designer it gives me an access violation. if i click the tables
button it works OK. if i click the tables button and then switch to the
fields tab it works OK too....
While trying to find the error i entered the following "Showmessage" line
into the below procedure. With this line in the code it all works perfectly
well and no access violation when i click the fields button. As soon as i
remove this "showmessage" it errors again?????
procedure TdaQueryDesignerForm.ActivatePage;
begin
FEditPage := TdaEditPage(pgcDesigner.ActivePage.Tag);
showmessage('hi');
FEditPage.Activate;
end; {procedure, ActivatePage}
I am using RB 7.03
please help!
many thanks
Cameron Hart
in the OnCreate (as shown in the HideQDesignerTab.zip example)
EditOptions := [ppemPreview, ppemTables, ppemFields, ppemCalcs,ppemLink];
EnabledOptions := EditOptions;
however now when i click on the Fields button (in the tool window) to start
the query designer it gives me an access violation. if i click the tables
button it works OK. if i click the tables button and then switch to the
fields tab it works OK too....
While trying to find the error i entered the following "Showmessage" line
into the below procedure. With this line in the code it all works perfectly
well and no access violation when i click the fields button. As soon as i
remove this "showmessage" it errors again?????
procedure TdaQueryDesignerForm.ActivatePage;
begin
FEditPage := TdaEditPage(pgcDesigner.ActivePage.Tag);
showmessage('hi');
FEditPage.Activate;
end; {procedure, ActivatePage}
I am using RB 7.03
please help!
many thanks
Cameron Hart
This discussion has been closed.
Comments
no known problems. I'm using Delphi 5.
Ken
1. Windows UI is message based. There are hundreds of messages being sent to
active windows and dispatch to their child controls. Using ShowMessage
causes the the message dialog window to become activated, which interupts
the message flow. This can be an ineffective method of finding many types
of UI errors.
Using debug break points can sometimes be slightly better but still has the
problem of activating the debug environment and thus interrupting the normal
message flow.
The best method is to write messages to a log file. You can either write
your own log utiltiy or use something like CodeSide available from Raize
Software (http://www.raize.com/).
2. Another technique is to add some code that will can detect an invalid
state and raise an exception. For example, at the top of the
TdaQueryDesignerForm.ActivatePage add the following code:
if (pgcDesigner.ActivePage = nil) then
raise Exception.Create('TdaQueryDesignerForm.ActivatePage: Designer.Active
page is nil');
if (pgcDesigner.ActivePage.Tag = 0) then
raise Exception.Create('TdaQueryDesignerForm.ActivatePage:
Designer.Active.Tag is zero');
FEditPage := TdaEditPage(pgcDesigner.ActivePage.Tag);
3. Another technique to locate the exception is to use a try..except block:
try
FEditPage.Activate;
except
raise Exception.Create('TdaQueryDesignerForm.ActivatePage:
FEditPage.Activate call failed);
end;
3. Try placing a stop or adding similar state checks to the
TdaEditPage.Activate event.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
expected values. the activepage was set correctly and from looking at the
code it should all have worked OK, except i still got the error.
I reinstalled Delphi and RB and that fixed my problem so i believe i screwed
something up at some stage. It all works perfectly fine now, and im sitting
back relaxing now that ive finished that section.
thanks for you replys
cameron