On 11/08/2012 07:28 AM, Timothy Groves wrote:
I have a program which allows you to edit records. This is done using a
dynamic array of records, with three strings in each record. I have
been using TEdits to allow the user to edit the records. The record is
updated during TEdit.OnChange.
Unfortunately, whenever I push the data *from* a selected record *to*
the form, TEdit.OnChange triggers, which tends to corrupt my data. I
tried disabling the TEdit, using TEdit.Enabled := false, but the event
still triggers.
Any suggestions?
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
You can temporarily un-assign the event handler.
{ remove event handler from all edits }
with MyForm do
for (i := 0 to Pred(Form.ComponentCount)) do
if (Components[i] is TEdit) then
begin
theEdit := TEdit(Components[i])
theEdit.OnChange := nil;
end;
PushMyData();
{ re-assign the event handler to all edit }
with MyForm do
for (i := 0 to Pred(ComponentCount)) do
if (Components[i] is TEdit) then
begin
theEdit := TEdit(Components[i])
theEdit.OnChange := @OnChange;
end;
I apologize if this double posts. I had some problem with the first attempt.
--
Regards,
Brian
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus