Welcome, Guest
Username: Password: Remember me
General Purpose Components and Libraries, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

TDBLookupComboBox access violation 8 years 8 months ago #9242

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
Hi
Here attached a demo project.
It includes two forms:
- form1 used to refresh data and to showmodal form2,
- form2 containing a memdataset with two fields and a tdblookupcombobox
If you run in CT 5.7 you receive an access violation in TDBLookUp.FetchLookupData second time you push button1 to open form2.

Some informations:
1. if you change form2.showmodal with form2.show all works fine
2. this is just an example to reproduce the error: I found the problem using MSSQL tables-

All works fine in CT 5.4 and Lazarus 1.6.

PS: why breakpoints in lcl unit files is not working in debugging mode?

Regards
Luca
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Luca.

TDBLookupComboBox access violation 8 years 8 months ago #9246

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Thanks Sir
we will test and report
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

TDBLookupComboBox access violation 8 years 8 months ago #9248

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
I found a workround.
It seems the problem is linked to handle changing of form2 (see blogs.embarcadero.com/abauer/2004/02/10/295) when you click second time button1.
If I set (directly in Object Inspector),
form2.popumode=pmauto
the handle didn't change and all is fine.

What's really strange is that if you access the handle before showmodal (for example by showing its value) without changing popupmode to pmauto, the error disappears.
  showmessage(inttostr(form2.Handle)); 
  form2.SQLQuery1.Close;
  form2.SQLQuery1.Open;
  form2.ShowModal

Hope this help
Regards
Luca

Please Log in or Create an account to join the conversation.

Last edit: by Luca.

TDBLookupComboBox access violation 8 years 8 months ago #9249

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
Or
add to Form2 OnShow event:
procedure TForm2.FormShow(Sender: TObject);
begin
 MemDataset1.Close;
 MemDataset1.Open;
end;

and call from Form1 only
procedure TForm1.Button1Click(Sender: TObject);
begin
  form2.ShowModal;
end;         

PS: please don't forget CT-LCL is NOT the same with VCL
and never will be...
PilotLogic Architect and Core Programmer
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

TDBLookupComboBox access violation 8 years 8 months ago #9250

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
OK.
I forgot to say that After MemDataset1.Open and Before Form2.ShowModal, I initialized some controls in Form2. So I need to open MemDataset1 before show the form2.
I think to set pmAuto for modal forms.

Regards
Luca

Please Log in or Create an account to join the conversation.

TDBLookupComboBox access violation 8 years 8 months ago #9251

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
As you want
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Page:
  • 1