DBGridEH installation method and instructions for use in Delphi7

Source: Internet
Author: User
The built-in DBGrid control of Delphi7 is weak in data control, so the popular DBGridEH control on the internet is particularly important. The installation method is downloaded.
It is still complicated. Therefore, I would like to write a description to facilitate reading by myself and those in the same path. By the way, DBGridEH is provided:
Http://www.51delphi.com/delphi/download? Num = 1. You must enter this address in IE. I cannot download the address from Firefox,
I don't know why.
//////////////////////////////////////// //////////////////////////////////////// ///////////////////////
(1) create a folder: Directory Ehlib under D: \ Program Files \ Borland \ Delphi7 \
(2) Add the directory in Tools> Environment Options> Library Path.
(3) copy the files in the Common and Delphi7 directories to the preceding directory.
(4) Open the runtime package-EhLib70.Dpk file and click "Compile" to Compile the package.
(5) Open and compile EhLibDataDrivers70.Dpk
(6) install DclEhLib70.BPL and DclEhLibDataDrivers70.BPL after compiling the run-time packages.
(Design-time packages) the into the IDE. BPL file is defined in your own: $ (DELPHI) \ Projects \ Bpl
(7) Open DclEhLib70.Dpk (design-time package) compilation, and then click "Install" to register EhLib
Components on the component palette.]
(8) Open and install the dclehlibdatadrivers70.dpk package.
//////////////////////////////////////// //////////////////////////////////////// //////////////////////
Dbgrideh usage instructions are as follows:
A. Custom title line
1. Create a complex title line
A title row can be set to a height greater than two rows, and a common parent title row can be created for multiple columns. To achieve this effect, you need to separate the parent and sub-titles with "|" in each column title attribute. For example, office supplies include code and name. The specific attribute settings are as follows:
Usemultititile = true;
Titlelines = 2
Dbgrideh. Columns [0]. Title. Caption: = Office Supplies | code;
Dbgrideh. Columns [1]. Title. Caption: = Office Supplies | Name;
2. display the image in the header line
Display the title line of the buyer in Figure 2. First, add an imagelist component img1 and add a group of BMP and ICO images. Then
Titleimages is set to img1. Finally, set the sequence number of the image in img1 to be displayed in the imageindex of the Column Title of the image to be displayed. Press f9 to execute the program,
Is it cool!
3. automatically display the title line's ascending/descending sort flag and sort it accordingly
The dbgrideh component allows you to display the ascending and descending order of small triangle flags in the cells in the row of the title. You can click the row of the title during operation. The images are automatically switched and sorted accordingly. The specific attribute settings are as follows:
Optionseh = dghautosortmarking
Column. title. titlebutton = true
Sortmarkedcolumns is the current sorting column that can be used at runtime.
Then add the code in the ontitleclick event of the column:
Procedure tform_query.dbgrideh1titlebtnclick (sender: tobject;
Acol: integer; column: tcolumneh );
Var
Sortstring: string; // sorting Column
Begin
// Sort
With column do
Begin
If fieldname = then
Exit;
Case title. sortmarker
Smnoneeh:
Begin
Title. sortmarker: = smdowneh;
Sortstring: = column. fieldname + asc;
End;
Smdowneh: sortstring: = column. fieldname + asc;
Smupeh: sortstring: = column. fieldname + desc;
End;
// Sort
Try
Dataset. sort: = sortstring // dataset indicates the actual dataset variable name.
Except
End;
End;
End;
Do not set the lookup field. Otherwise, an error is prompted.
In addition, I mentioned in the component manual that automatic sorting can be performed without coding, but I haven't found the Method for Automatic Sorting without coding. Please let me know if you know it! Let me also "lose weight" on the program code ".
 
B. Customize the summary statistical rows at the bottom of the table.
Dbgrideh
The component can display summary rows at the bottom of the table, such as the total number of records, column field accumulation, and other information. In footerrowcount, set the number of rows displayed at the bottom, and then in footers
Add one or more display columns to the editor. The display columns can be set types such as the sum of Field Values, total number of records, field values, or static files, it can be set in the valuetype attribute during design, or
Set footers [I]. valuetype at runtime to specify its type. The meanings are shown in the following table:
Attribute Value
Fvtsum
Fvtcount
Fvtfieldvalue
Fvtstatictext
Description
Field addition and
Total number of records
Field Value
Static text
Remember to set dbgrideh. sumlist. active to true to perform the summary statistics operation. Note that if the display type is not the accumulate sum of the current column, you need to specify the summary column in The fieldname attribute. If the type is other, this requirement is not required.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.