Lazarus
Programming => General => Topic started by: elidorio on March 07, 2016, 02:11:10 am
-
I was using the TDBDateTimePicker components, now I want to replace TDBZVDateTimePicker.
Replacing components of automatic way?
-
I was using the TDBDateTimePicker components, now I want to replace TDBDateTimePicker.
Replace with what?
-
ops!
Per TDBZVDateTimePicker
-
@elidorio
You need a find/replace tool(text crawler):
1. set your project folder
2. set the filters(*.pas; *.pp; *.lfm)
3. search for TDBDateTimePicker then replace with TDBZVDateTimePicker.
The whole process shouldn't take more then 5 minutes. After this you should manually change properties/methods there are no longer valid, because of the different component.
PS: Alternatively you can use the built-in Search/Find in files dialog(Shift+Ctrl+F).
-
There isn't any tool/addin that does that automatically you have to run a search and replace in both pas and lfm files either one by one or with an external text editor
-
@elidorio
You need a find/replace tool(text crawler):
1. set your project folder
2. set the filters(*.pas; *.pp; *.lfm)
3. search for TDBDateTimePicker then replace with TDBZVDateTimePicker.
3. should be "search for TDBZVDateTimePicker then replace with TDBDateTimePicker."
OR BETTER search for ZVDateTimePicker and replace with DateTimePicker (this will in one move replace all TZVDateTimePickers with TDateTimePickers and all TDBZVDateTimePickers with TDBDateTimePickers, and also will conveniently replace control names on your forms - eg. ZVDateTimePicker1 will become DateTimePicker1).
After this you should manually change properties/methods there are no longer valid, because of the different component.
There shouldn't be any.
Plus, open Project Inspector (Project->Project Inspector in main menu) and remove dependency of ZVDateTimeCtrls package. Then uninstall ZVDateTimeCtrls from the IDE, you will not need it any more.
-
@Zoran
3. should be "search for TDBZVDateTimePicker then replace with TDBDateTimePicker."
If I understood this correctly, he want to replace TDBDateTimePicker with TDBZVDateTimePicker. So he should search for TDBDateTimePicker.
-
@Zoran
3. should be "search for TDBZVDateTimePicker then replace with TDBDateTimePicker."
If I understood this correctly, he want to replace TDBDateTimePicker with TDBZVDateTimePicker. So he should search for TDBDateTimePicker.
That would be unwise, TDBDateTimePicker is TDBZVDateTimePicker merged in the lcl it self. I would think that TDBZVDateTimePicker development is halted at this time and every effort is targeted on TDBDateTimePicker.
-
@Zoran
3. should be "search for TDBZVDateTimePicker then replace with TDBDateTimePicker."
If I understood this correctly, he want to replace TDBDateTimePicker with TDBZVDateTimePicker. So he should search for TDBDateTimePicker.
Perhaps he said that, but then I believe he made mistake.
Anyway, I strongly recommend using controls from DateTimeCtrls package (http://wiki.freepascal.org/DateTimeCtrls_Package) over "ZV" controls (http://wiki.freepascal.org/ZVDateTimeControls_Package).
These are same controls, but when they got included in Lazarus distribution, the name was changed for Delphi compatibility. So, ZVDateTimeControls are no more updated and it is suggested to switch to DateTimeCtrls package which is included in Lazarus (the controls are automatically installed in component palette).
That would be unwise, TDBDateTimePicker is TDBZVDateTimePicker merged in the lcl it self. I would think that TDBZVDateTimePicker development is halted at this time and every effort is targeted on TDBDateTimePicker.
Exactly.
-
@Zoran
I'm not arguing about which component is better. I know you're the current maintainer of TDBDateTimePicker :), I'm also aware that you put a lot of effort lately to make it better(http://forum.lazarus.freepascal.org/index.php/topic,31679.msg203242.html#msg203242). But perhaps the OP has a good reason the switch back to an older, obsolete component, or maybe he has absolutely no idea what he is doing. I was only trying to help him to switch from one component to another...
Anyway, I believe hes has more then enough information know.
-
@Zoran
I'm not arguing about which component is better. I know you're the current maintainer of TDBDateTimePicker :), I'm also aware that you put a lot of effort lately to make it better(http://forum.lazarus.freepascal.org/index.php/topic,31679.msg203242.html#msg203242). But perhaps the OP has a good reason the switch back to an older, obsolete component, or maybe he has absolutely no idea what he is doing. I was only trying to help him to switch from one component to another...
I know :)
Anyway, I believe hes has more then enough information know.
Yes, I agree.
-
To work I had to click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePicker
-
To work I had to click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePicker
Couldn't you do what GetMem proposed? Even better, corrected with what I said here:
@elidorio
You need a find/replace tool(text crawler):
1. set your project folder
2. set the filters(*.pas; *.pp; *.lfm)
3. search for TDBDateTimePicker then replace with TDBZVDateTimePicker.
3. should be "search for TDBZVDateTimePicker then replace with TDBDateTimePicker."
OR BETTER search for ZVDateTimePicker and replace with DateTimePicker (this will in one move replace all TZVDateTimePickers with TDateTimePickers and all TDBZVDateTimePickers with TDBDateTimePickers, and also will conveniently replace control names on your forms - eg. ZVDateTimePicker1 will become DateTimePicker1).
After this you should manually change properties/methods there are no longer valid, because of the different component.
There shouldn't be any.
Plus, open Project Inspector (Project->Project Inspector in main menu) and remove dependency of ZVDateTimeCtrls package. Then uninstall ZVDateTimeCtrls from the IDE, you will not need it any more.
As GetMem said, it shouldn't take more than couple of minutes. Anyway, I am sorry for this inconvenience caused by name change, but it would be too much work for me to continue maintaining the same package with different name in parallel. I'll see if I can create a tool which will do this conversion.
-
To work I had to click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePicker
Couldn't you do what GetMem proposed?
What's wrong with it? That's the way for changing classes provided by Lazarus.
-
To work I had to click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePicker
Couldn't you do what GetMem proposed?
What's wrong with it? That's the way for changing classes provided by Lazarus.
it has to be done for each control instead of once for all.
-
1. Perform the procedures that GetMem propos.
2 - click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePick
Note: If I only procedure 1, still generating errors that TDBZVDateTimePicker class was not found.
You have to perform the procedure 2 for each component TDBZVDateTimePicker
-
1. Perform the procedures that GetMem propos.
2 - click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePick
Note: If I only procedure 1, still generating errors that TDBZVDateTimePicker class was not found.
You have to perform the procedure 2 for each component TDBZVDateTimePicker
you need to replace the type both in pas and lfm files.
-
1. Perform the procedures that GetMem propos.
2 - click on each TDBZDateTimePicker and Change class and switch to TDBDateTimePick
Note: If I only procedure 1, still generating errors that TDBZVDateTimePicker class was not found.
You have to perform the procedure 2 for each component TDBZVDateTimePicker
Of course, in procedure 1 you have to replace the unit TDBZVDateTimePicker (I don't know its name, it's in your uses list) with the one for TDBDateTimePicker (DBDateTimePicker). In procedure 2 this is done automatically.
-
I'll wait a few more days, perhaps @Zoran, create a tool to replace these components more easily. I have several projects to upgrade.
-
I'll wait a few more days, perhaps @Zoran, create a tool to replace these components more easily. I have several projects to upgrade.
Okay, I created this utility.
Here it is, attached to this post. Compile and run the application and please tell us if this solves the problem.
Note:
With this tool the conversion should run very smoothly if you don't have mixed old ZVDateTimeCtrls and new DateTimeCtrls dependencies in your project. However, if you have, you will encounter double references to DateTimeCtrls, which you should then correct manually.
Regards, Zoran.
-
Hello Zoran,
It worked perfectly for me, perform the replacement of components.
Thank you.
-
It worked perfectly for me too, thanks