[ Pobierz całość w formacie PDF ]
.That book explains some of the differencesbetween Object Pascal and C++ in detail.Reusing FormsYou don't have to convert Delphi forms to C++ at all if you don't want to.Youcan use Delphi forms in C++Builder just as they are.Simply add the.PAS file forthe form directly to your C++Builder project.C++Builder will create a header forthe Delphi unit that you can use in any C++Builder units that reference the Delphiform.NOTE: Although you can add a Delphi form to a C++Builder project, you cannotedit the form with the C++Builder Form Designer.Any modifications that you wantto make to the form visually must be made from the Delphi IDE.You can, however,edit the form as text from within the C++Builder IDE.Choose the View As Text optionfrom the C++Builder Form Designer's context menu to edit the form in text format.SummaryDelphi and C++Builder are not so much competing products as they are complementary products.If you know how to program with C++Builder, learning Delphi is relatively easy.Moving from Delphi to C++Builder isn't quite as easy because of thecomplexity of the C++ language, but if you decide to move from Delphi to C++Builder, you can at least be assured that you won't have to learn a new framework.Without question, being proficient in both Delphi and C++Builder makes you a more valuableprogrammer.WorkshopThe Workshop contains quiz questions to help you solidify your understanding ofthe material covered and exercises to provide you with experience using what youhave learned.You can find the answers in Appendix A, "Answers to the Quiz Questions."Q&AQ Can I use Pascal units in a C++Builder project?A Yes.Add the Pascal unit to your project just as you would add a C++unit.Be sure to put the Pascal units above any C++ units that reference code inthe Pascal units in the Project Manager.Q Can I use C++ units in my Delphi projects?A No.You can use Pascal units in C++Builder but not the other way around.Q As a programmer, I'm curious about something: Are the Delphi and C++BuilderIDEs built from the same code base?A Yes.Although Delphi and C++Builder have obvious differences, they havemany similarities, so Borland uses a single code base for both IDEs.Q Why do my Delphi projects compile so much faster than my C++Builder projects?A Because Object Pascal is less complex than C++ and thus compiles faster.Q I have heard that if I know C++Builder, learning Delphi is simple.Is thattrue?A Not exactly, no.Despite stereotypes regarding Pascal, Delphi's ObjectPascal is relatively complex.Although going from C++Builder to Delphi is easierthan the reverse, it is still not something that should be approached lightly.Quiz1.Do Delphi and C++Builder project files have the same filename extension?2.Do Delphi and C++Builder form files have the same filename extension?3.Can you use packages from third-party component vendors in both Delphiand C++Builder?4.Can you open a Delphi form file in C++Builder?5.Can you edit a Delphi form file using the C++Builder Form Designer?6.Can you use a C++Builder source unit in Delphi?7.Which is better, Delphi or C++Builder?Exercises1.If you have C++Builder, take an example from the Delphi Demos directoryand convert it to C++Builder.2.Take an example in the C++Builder Examples directory and convert itto Delphi.3.Take a break, you've finished your 21st day!In ReviewThis was a pretty productive week, wasn't it? Unlike Visual Component Library(VCL) components, COM and ActiveX controls can be used by a wide variety of programmingenvironments.The good news is that Delphi gives you the fastest route to ActiveXcreation of any programming environment available today.You probably had no idea that database operations could be so easy.Easy is arelative thing.I wouldn't go so far as to say that database programming is eversimple, but Delphi certainly makes it easier than it would be in other programmingenvironments.On Day 19, you learned about dynamic link libraries (DLLs).Regardless of whetheryou decide to use DLLs right away, you can at least see their benefits and can makean informed decision regarding their use in your programs.If you plan on callingDelphi forms from programs not written in Delphi, you will have to use DLLs.DLLsare not difficult, but here again, a little experience goes a long way.On Day 20, you learned about creating your own components.You either loved itor you were left scratching your head.If the latter is the case, don't worry aboutit.You might never have to write your own components.There are plenty of sourcesfor good, commercial-quality components.(See Appendix B, "Delphi Internet Resources,"for a few.) Plus, you can always go back and tackle Day 20 again after you've accumulatedsome time in your Delphi log book.If you enjoyed learning about writing components,it was probably difficult for you to read the last chapter! I'd be willing to betthat at some time during Day 20 you could have been overheard saying, "Wow!"Writing your own components is rewarding--no question.I had time only to scratchthe surface of covering how to write components.There is a lot more to learn, andmuch of that can be learned by experience only.This chapter gives you enough toget you started.Finally, you learned about Delphi and C++Builder and how they can work together.Delphi and C++Builder are two great products.If you know how to use one of theseprogramming environments, learning the other is very easy.The more you know, themore valuable you are as a programmer.© Copyright, Macmillan Computer Publishing.Allrights reserved
[ Pobierz całość w formacie PDF ]