Podstrony
- Strona startowa
- Steven Rosefielde, D. Quinn Mil Masters of Illusion, American L
- Masterton Graham Studnie piekiel (SCAN dal 736)
- Masterton Graham Wojownicy Nocy t.2 (SCAN dal 91
- Masterton Graham Nocna Plaga (SCAN dal 1062)
- Masterton Graham Dzinn (SCAN dal 1029) (3)
- Masterton Graham Podpalacze Ludzi t.1 (SCAN dal
- Masterton Graham Sfinks (SCAN dal 838)
- Masterton Graham Manitou (SCAN dal 826)
- Pullman Philip Mroczne materie 3 Bursztynowa luneta
- Stephen King Christine (2)
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- tohuwabohu.xlx.pl
[ Pobierz całość w formacie PDF ]
.A more powerful approach is to create a component template, which makes acopy of both the properties and the source code of the event handlers.As you paste the tem-plate into a new form, by selecting the pseudo-component from the palette, Delphi willreplicate the source code of the event handlers in the new form.To create a component template, select one or more components and issue the Component ¢'Create Component Template menu command.This opens the Component Template Informa-tion dialog box, where you enter the name of the template, the page of the ComponentPalette where it should appear, and an icon.By default, the template name is the name of the first component you ve selected followedby the word Template.The default template icon is the icon of the first component you veselected, but you can replace it with an icon file.The name you give to the component templatewill be used to describe it in the Component Palette (when Delphi displays the pop-up hint).Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 3030 Chapter 1 " The Delphi 6 IDEAll the information about component templates is stored in a single file, DELPHI32.DCT, butthere is apparently no way to retrieve this information and edit a template.What you can do,however, is place the component template in a brand-new form, edit it, and install it again asa component template using the same name.This way you can overwrite the previous definition.TIPA group of Delphi programmers can share component templates by storing them in a commondirectory, adding to the Registry the entry CCLibDir under the key \Software\Borland\Delphi\6.0\Component Templates.Component templates are handy when different forms need the same group of componentsand associated event handlers.The problem is that once you place an instance of the templatein a form, Delphi makes a copy of the components and their code, which is no longer relatedto the template.There is no way to modify the template definition itself, and it is certainly notpossible to make the same change effective in all the forms that use the template.Am I askingtoo much? Not at all.This is what the frames technology in Delphi does.A frame is a sort of panel you can work with at design time in a way similar to a form.Yousimply create a new frame, place some controls in it, and add code to the event handlers.Afterthe frame is ready, you can open a form, select the Frame pseudo-component from the Stan-dard page of the Component Palette, and choose one of the available frames (of the currentproject).After placing the frame in a form, you ll see it as if the components were copied to it.If you modify the original frame (in its own designer), the changes will be reflected in each ofthe instances of the frame.You can see a simple example, called Frames1, in Figure 1.8 (its code is available on thecompanion CD).A screen snapshot doesn t really mean much; you should open the programor rebuild a similar one if you want to start playing with frames.Like forms, frames defineclasses, so they fit within the VCL object-oriented model much more easily than componenttemplates.Chapter 4 provides an in-depth look at VCL and includes a more detailed descrip-tion of frames.As you might imagine from this short introduction, frames are a powerful newtechnique.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 31Managing Projects 31FI GURE 1.8:The Frames1 exampledemonstrates the use offrames.The frame (on theleft) and its instance insidea form (on the right) arekept in synch.Managing ProjectsDelphi s multitarget Project Manager (View ¢' Project Manager) works on a project group,which can have one or more projects under it.For example, a project group can include aDLL and an executable file, or multiple executable files.TIPIn Delphi 6, all open packages will show up as projects in the Project Manager view, even ifthey haven t been added to the project group.In Figure 1.9, you can see the Project Manager with the project group for the currentchapter.As you can see, the Project Manager is based on a tree view, which shows the hierar-chical structure of the project group, the projects, and all of the forms and units that make upeach project.You can use the simple toolbar and the more complex shortcut menus of theProject Manager to operate on it.The shortcut menu is context-sensitive; its options dependon the selected item.There are menu items to add a new or existing project to a projectgroup, to compile or build a specific project, or to open a unit.Of all the projects in the group, only one is active, and this is the project you operate uponwhen you select a command such as Project ¢' Compile.The Project pull-down of the mainmenu has two commands you can use to compile or build all the projects of the group.(Strangelyenough, these commands are not available in the shortcut menu of the Project Manager for theproject group.) When you have multiple projects to build, you can set a relative order by using theBuild Sooner and Build Later commands.These two commands basically rearrange the projectsin the list.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 3232 Chapter 1 " The Delphi 6 IDEFI GURE 1.9:Delphi s multitarget ProjectManagerAmong its advanced features, you can drag source code files from Windows folders or Win-dows Explorer onto a project in the Project Manager window to add them to that project.The Project Manager automatically selects as the current project the one you are workingwith for example, opening a file.You can easily see which project is selected and change itby using the combo box on the top of the form.TIPBesides adding Pascal files and projects, you can add Windows resource files to the ProjectManager; they are compiled along with the project.Simply move to a project, select the Addshortcut menu, and choose Resource File (*.rc) as the file type.This resource file will be auto-matically bound to the project, even without a corresponding $Rdirective.Delphi saves the project groups with the new.BPG extension, which stands for BorlandProject Group.This feature comes from C++Builder and from past Borland C++ compilers,a history that is clearly visible as you open the source code of a project group, which is basi-cally that of a makefile in a C/C++ development environment.Here is a simple example:# VERSION = BWS.01# !ifndef ROOTROOT = $(MAKEDIR)\.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c01.qxd 7/2/01 2:40 PM Page 33Managing Projects 33!endif# MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**DCC = $(ROOT)\bin\dcc32.exe $**BRCC = $(ROOT)\bin\brcc32.exe $**# PROJECTS = Project1.exe# default: $(PROJECTS)# Project1.exe: Project1
[ Pobierz całość w formacie PDF ]