"Mastering Delphi 6" learning notes

zhaozj2021-02-11  215

CLX and other

"Mastering Delphi 6" mentioned that there is a TBITS class in Object Pascal to perform binary operations. I have seen this after this paragraph, and I found it in the Classes unit. This class's statement is quite simple, but I feel much after I have seen it. If you don't know the existence of this class, I will still write a big string code when I need to operate the binary bit (I have written a lot of code before, if you can know if you have this class earlier. How good! I believe that there may be many people like me, never know the existence of TBITS. Therefore, I decided to take a time later, browse the Classes and System these units; although it is not easy to read these files without how many documents, it is likely to find some useful things, thus avoiding Stupid things to reinvent the wheel.

I have passed that Delphi's help system has a big gap compared to MSDN. This time I found an opposite example. By browsing the Classes unit, I found an extractstrings function, which is very useful. Although the introduction of it is not found in the general textbook, it is indeed on its full description in online help. Try yourself for an example, and the usage of guess is not far. This reminds me of the MFC and there is also a similar AFXTractsubstring, equally useful, but huge MSDN can't find its help (in fact, similar AFX functions in the MFC, only a few part of the documentation, other It belongs to undocumented.) Although this small place cannot prove anything, at least the Borland is still interested in helping the system's integrity, which makes me a little positive impression on the Delphi Help system.

The topic of helping the system in Delphi 6 generally has two kinds of VCL Reference and Clx Reference. If you press F1, you will first pop up a dialog asking you to choose that one. It is very annoying for time. Here is a way to avoid: If you want to use the VCL, select Help-> Custom, remove all the items about the CLX in the list, then save the item (of course, it is best to back up the original settings first, left Restore it later.) Finally closed and then reopened Delphi.

Delphi 6 now supports both VCLs and CLX libraries. The CLX is based on QT based on QT. Some friends have not heard of its name, but the name of Qt on the Linux system is very loud. You can specify when new projects is used to use VCL Application or CLX Application, and the component panel will automatically change, only the components available to the current project. The CLX component and the VCL component are amazing from the appearance, of course, they are still very different behind. There are some interesting components in the CLX in the VCL, such as TextViewer and TextBrowser. Some components in the VCL have no correspondence in the CLX, mainly the components on the Win32 panel, but similar components in the CLX, although it is different. ("Mastering Delphi 6" mentioned that the WINDOWS system communicates with the WINDOWS system is different, and the higher-top object-oriented package is used in QT. For example, to operate a button, do not use the button to send messages, directly call the button. Method. You should also view the application framework, and this structure must be very worth learning. If you have a chance, you should look at it.) Although VCL and CLX have many good components, they are unable to use together. That is, there is no way to use the CLX component in the VCL Application and vice versa. There is a very wonderful example in "Mastering Delphi 6" to use the textViewer in the CLX. This component is characterized by HTML based on HTML, and it has a Text property and is compatible with MEMO. So, just create a CLX Application, put a MEMO and a TextViewer on the form, and modify the MEMO's onchange event:

Procedure TFORM1.MEMO1CHANGE (Sender: TOBJECT);

Begin

TextViewer1.text: = MEMO1.TEXT;

END;

A simple sentence, it is a very strong tool, you can write content in the HTML format in MEMO, such as " " can see the effect, very good HTML learning tool in TextViewer. However, it is that the display effect of TextViewer and the difference we usually see in IE, some web page effects are displayed. But even so, this program still makes me excited for a long time.

Due to the built-in functionality of QT and the customizable characteristics of Linux, the appearance of the CLX program can be ever-changing, which is more interesting than Windows's single appearance. An example of "Mastering Delphi 6". Create a CLX Application where you add a list box and some other common components. Add several entries in Listbox, which are Windows, Motif, Motif , CDE, SGI, Platinum, SystemDefault. Add an onDBLClick process for Listbox:

Procedure TFORM1.ListBox1dblclick (Sender: TOBJECT);

Begin

Case ListBox1.ItemIndex of

0: Application.style.defaultStyle: = dswindows;

1: Application.Style.defaultStyle: = dsmotif;

2: Application.Style.defaultStyle: = dsmotifplus; 3: Application.style.defaultStyle: = DSCDE;

4: Application.style.defaultStyle: = DSQTSGI;

5: Application.Style.defaultStyle: = dsplatinum;

6: Application.style.defaultStyle: = dssystemdefault;

END;

END;

You can see that the program displays a variety of appearances. In fact, these appearances are not very nice, but it is fun. If it is under Linux, you can generate more changes by customizing Window Manager, believe that it will not be lost to XP's super glare appearance.

转载请注明原文地址:https://www.9cbs.com/read-3845.html

New Post(0)