Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread AV when reading editmask
Tue, Oct 9 2007 11:40 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Anyone

Interesting problem, almost certainly caused by my code but here goes. On a form I have the following

procedure TContactsForm.RefreshLinks(Qry: TDBISAMQuery);
begin
Qry.DisableControls;
Qry.Close;
if not Qry.Prepared then Qry.Prepare;
Qry.ParamByName('ContactID').AsInteger := Contacts_ID.AsInteger;
Qry.ExecSQL;
Qry.EnableControls;
end;

This is creating a dataset CareerSummary for the current contact

I also have a lookup component that is derived ultimately from TCustomMaskEdit

procedure TluXRef.DataChange(Sender: TObject);
begin
if csDestroying in ComponentState then Exit;
if FDataLink.Field <> nil then begin
 if FAlignment <> FDataLink.Field.Alignment then begin
  EditText := ''; //forces update
  FAlignment := FDataLink.Field.Alignment;
 end;
 EditMask := FDataLink.Field.EditMask;  <<<<<<<<<<<<<<< blows up here
....
....
....
end;


If I edit the main table (Contacts) and post the change RefreshLinks is called and everything works. If, however, I cancel the change then things blow up. To complicate the matter if I comment out the disable/enablecontrols the stupid thing works wether I post or cancel (so at least I have a workround).

I'd like to fix it properly. Anyone have an idea?

Roy Lambert
Wed, Oct 10 2007 8:38 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< If I edit the main table (Contacts) and post the change RefreshLinks is
called and everything works. If, however, I cancel the change then things
blow up. To complicate the matter if I comment out the
disable/enablecontrols the stupid thing works wether I post or cancel (so at
least I have a workround). >>

Are you using any TDBMemo controls ?  I believe there is an issue with that
control whereby it doesn't respect the EnableControls/DisableControls
methods.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Oct 10 2007 9:09 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


The sql in question doesn't generate any memo fields so I guess the answer is no Smiley


Roy Lambert
Image