[ Pobierz całość w formacie PDF ]
.However, accessing the visual control that displays thelist, we can obtain the value of the selected item.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c08.qxd 7/2/01 4:27 PM Page 319What s Next? 319What s Next?In this chapter, I ve introduced the use of actions, the actions list, and action manager archi-tectures.As you ve seen, this is an extremely powerful architecture to separate the user inter-face from the actual code of your applications, which uses and refers to the actions and notthe menu items or toolbar button related to them.The Delphi 6 extension of this architec-ture allows users of your programs to have a lot of control, and makes your applicationsresemble high-end programs without much effort on your part.The same architecture is alsovery handy to let you design the user interface of your program, regardless of whether yougive this ability to users.I ve also covered other user-interface techniques, such as docking toolbars and other con-trols.You can consider this chapter the first step toward building professional applications.We will take other steps in the following chapters; but you already know enough to makeyour programs similar to some best-selling Windows applications, which may be very impor-tant for your clients.Now that the elements of the main form of our programs are properly set up, we can con-sider adding secondary forms and dialog boxes.This is the topic of the next chapter, alongwith a general introduction to forms.The following chapter will then cover the overall struc-ture of a Delphi application.Copyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c09.qxd 7/2/01 4:25 PM Page 321CHAPTER 9Working with FormsForm styles, border styles, and border iconsMouse and keyboard inputPainting and special effectsPositioning, scaling, and scrolling formsCreating and closing formsModal and modeless dialog boxes and formsCreating secondary forms dynamicallyPredefined dialog boxesBuilding a splash screenCopyright ©2001 SYBEX, Inc., Alameda, CA www.sybex.com2874c09.qxd 7/2/01 4:25 PM Page 322322 Chapter 9 " Working with FormsIf you ve read the previous chapters, you should now be able to use Delphi s visual compo-nents to create the user interface of your applications.So let s turn our attention to anothercentral element of development in Delphi: forms.We have used forms since the initial chap-ters, but I ve never described in detail what you can do with a form, which properties you canuse, or which methods of the TForm class are particularly interesting.This chapter looks at some of the properties and styles of forms and at sizing and position-ing them.I ll also introduce applications with multiple forms, the use of dialog boxes (customand predefined ones), frames, and visual form inheritance.I ll also devote some time to inputon a form, both from the keyboard and the mouse.The TForm ClassForms in Delphi are defined by the TFormclass, included in the Forms unit of VCL.Of course,there is now a second definition of forms inside VisualCLX.Although I ll mainly refer to theVCL class in this chapter, I ll also try to highlight differences with the cross-platform versionprovided in CLX.The TFormclass is part of the windowed-controls hierarchy, which starts with the TWinControl(or TWidgetControl) class.Actually, TForm inherits from the almost complete TCustomForm,which in turn inherits from TScrollingWinControl (or TScrollingWidget).Having all of thefeatures of their many base classes, forms have a long series of methods, properties, andevents.For this reason, I won t try to list them here, but I d rather present some interestingtechniques related to forms throughout this chapter.I ll start by presenting a technique fornot defining the form of a program at design time, using the TForm class directly, and thenexplore a few interesting properties of the form class.Throughout the chapter, I ll point out a few differences between VCL forms and CLXforms.I ve actually built a CLX version for most of the examples of this chapter, so you canimmediately start experimenting with forms and dialog boxes in CLX, as well as VCL.As inpast chapters, the CLX version of each example is prefixed by the letter Q.Using Plain FormsGenerally, Delphi developers tend to create forms at design time, which implies deriving anew class from the base one, and build the content of the form visually.This is certainly areasonable standard practice, but it is not compulsory to create a descendant of the TFormclass to show a form, particularly if it is a simple one
[ Pobierz całość w formacie PDF ]