Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Changing the DataModule where the DataAware components are pointing to



Permlink Replies: 4 - Last Post: Jan 13, 2017 7:28 AM Last Post By: Patricio Cerda
Patricio Cerda

Posts: 122
Registered: 3/13/01
Changing the DataModule where the DataAware components are pointing to
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2017 9:51 AM
Hi,

My application has one "A" DataModule and many VCL Modules and DataAware components that point to this "A" DataModule.
Now, as part of the migration process from C++ Builder XE5 to Berlin 10.1, I added a new "B" DataModule and need to change some of those DataAware components to point to exactly the same DataSet's but that belongs to the new "B" DataModule.

How can I easily change their ListSources and DataSource property's?

For example, for an TDBLookupComboBox:
previous ListSource=A.DS_Empl
new ListSource=B.DS_Empl
and
previous DataSource=A.DS_Contr
new DataSource=B.DS_Contr

Is there a way to do that with the IDE?
Thanks in advance.

Best regards,
Patricio Cerda
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Changing the DataModule where the DataAware components are pointing to
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2017 12:03 PM   in response to: Patricio Cerda in response to: Patricio Cerda
Patricio wrote:

How can I easily change their ListSources and DataSource property's?

In short, you can't easily do this. You would have to change them individually,
either by hand at design-time, or in code at run-time.

Is there a way to do that with the IDE?

No.

--
Remy Lebeau (TeamB)
Patricio Cerda

Posts: 122
Registered: 3/13/01
Re: Changing the DataModule where the DataAware components are pointing to
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2017 7:28 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks Remy for your answer.

In short, you can't easily do this. You would have to change them individually,
either by hand at design-time, or in code at run-time.

Ok, so I decided to stay using the original DataModule, no matter the suggestions of the other guys to my previous post which I understood and thanks, but then I must resolve an error message that I couldn't manage yet. I hope you could help me again.

My goal was recreate the DataModule to solve the error message that I looked for and founded something on QualityCentral, and did the suggested workaround but without success:

RSP-15872
DBGrid: Option dgAlwaysShowEditor leads to "Argument Out Of Range" error
"This issue is major regression in Berlin 10.1 Update 1. The persistent fix will be included into Update 2 (time frame is not known at this moment). As a workaround at run-time please do the following:
open Vcl.DBGrids.pas
locate there TCustomDBGrid.CanEditShow method
replace it code with:
function TCustomDBGrid.CanEditShow: Boolean;
begin
Result := (LayoutLock = 0) and inherited CanEditShow;
end;
add path to <RAD Studio run-time sources path>\Data\vclctrls to your IDE Delphi Library Path. It is the path where Vcl.DBGrids.pas is located. Is it ?
recompile your application."

In relation with this workaround I'm not sure exactly where to add the path to Vcl.DBGrids.pas. I checked that on my C++ Builder Berlin 10.1 Update 1 it is effectively located on that path.

However, it seems that on my case the problem is different because the error message is: "Debugger Exception Notification Project VentasMovil_Client.exe raised exception class EArgumentOutOfRangeException with message 'Argument out of range'." and it is rises on the following line of code on my application:

  Form_Configuracion = new TForm_Configuracion(NULL);


and specifically on the following line of code on the Vcl.Forms.hpp file:

	/* TCustomForm.Create */ inline __fastcall virtual TForm(System::Classes::TComponent* AOwner) : TCustomForm(AOwner) { }


Does this error be related with RSP-15872?
If yes, where exactly on IDE must I add the path to the Vcl.DBGrids.pas?
If not, which could be an alternative workaround on my case?

Best regards,
Patricio Cerda
John MacDonald

Posts: 179
Registered: 3/22/98
Re: Changing the DataModule where the DataAware components are pointing to
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2017 5:31 PM   in response to: Patricio Cerda in response to: Patricio Cerda
Hello Patricio

I have been working with a few migration projects myself. There are some ways to make it easier.

The first is to pick the dataset components together with the shift key. Then use the drop down to change the common values. This is a way I have been moving many of our components from bde to firedac.

When working with code you can pick all the code at once in a .cpp and use the indicator on the side to change the same pointers or variables all at once.

To be clear I am still using Xe6. I can't imagine that this would become unavailable in later versions.

Good luck.

Ps> I am away from my computer so I'm sure I've missed the proper terminology.

John

Patricio Cerda wrote:
Hi,

My application has one "A" DataModule and many VCL Modules and DataAware components that point to this "A" DataModule.
Now, as part of the migration process from C++ Builder XE5 to Berlin 10.1, I added a new "B" DataModule and need to change some of those DataAware components to point to exactly the same DataSet's but that belongs to the new "B" DataModule.

How can I easily change their ListSources and DataSource property's?

For example, for an TDBLookupComboBox:
previous ListSource=A.DS_Empl
new ListSource=B.DS_Empl
and
previous DataSource=A.DS_Contr
new DataSource=B.DS_Contr

Is there a way to do that with the IDE?
Thanks in advance.

Best regards,
Patricio Cerda

--
JMAC out

Edited by: John MacDonald on Jan 12, 2017 8:32 PM
Jan Dijkstra

Posts: 206
Registered: 11/4/99
Re: Changing the DataModule where the DataAware components are pointing to
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2017 11:49 PM   in response to: Patricio Cerda in response to: Patricio Cerda
Patricio Cerda wrote:
Hi,

My application has one "A" DataModule and many VCL Modules and DataAware components that point to this "A" DataModule.
Now, as part of the migration process from C++ Builder XE5 to Berlin 10.1, I added a new "B" DataModule and need to change some of those DataAware components to point to exactly the same DataSet's but that belongs to the new "B" DataModule.

How can I easily change their ListSources and DataSource property's?

For example, for an TDBLookupComboBox:
previous ListSource=A.DS_Empl
new ListSource=B.DS_Empl
and
previous DataSource=A.DS_Contr
new DataSource=B.DS_Contr

Is there a way to do that with the IDE?
Thanks in advance.

Best regards,
Patricio Cerda

What I do when I have to do something like this, is to open the .dfm file with notepad, and edit in the changes (using find, or find/replace). Sometimes I need to change the class type of a component on a form, and then I do the same thing. Open dfm with notepad, and edit in the change (and then update the .h file to match).
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02