This article Reprinted from: http://blog.csdn.net/yushanddddfenghailin/article/details/17251041
Storage box
The storage box is also a typical window visualization component. Similar to the editing box, you can enter and display text. However, unlike the editing box, the editing box can only edit and display a single line of text, the storage box can operate on multiple lines of text. The class in the bucket is defined as follows: <xmlnamespace prefix = "O" NS = "urn: Schemas-Microsoft-com: Office: office"/>
Tmemo = Class (tcustommemo)
Property lines: tstrings; read write;
Property alignment: talignment; read write;
Property borderstyle: tborderstyle; read write;
Property color: tcolor; read write;
Property Font: tfont; read write;
Property hideselection: Boolean; read write;
Property maxlength: integer; read write;
Property readonly: Boolean; read write;
Property scrollbars: tscrollstyle; read write;
Property wantreturns: Boolean; read write;
Property wanttabs: Boolean; read write;
Property wordwrap: Boolean; read write;
Property onchange: tpolicyevent; read write;
Property onclick: tpolicyevent; read write;
Property ondblclick: tpolicyevent; read write;
Property onkeydown: tkeyevent; read write;
Property onkeypress: tkeypressevent; read write;
Property onkeyup: tkeyevent; read write;
End;
The hierarchical structure model is as follows:
The storage box, like the editing box, is inherited from the tcustomedit class, but there is also a tcustommemo class on tmemo, which adds a property: lines, that is, multi-line text operations.
The following code demonstrates the creation and properties of the edit box.
[Setup] Appname = test Appvername = test Defaultdirname = "E: \ test" Appversion = 1.0 [Files] Source: "F: \ Desktop \ Inno \ ipmsg.exe"; flags: dontcopy [Code] VaR Mypage: twizardpage; Radio1, redio2: tradiobutton; MM: tmemo; Procedure initializewizard (); Begin Mypage: = createcustompage (wpwelcome, 'title: Custom page', 'description: This is my custom page '); MM: = tmemo. Create (mypage ); Mm. Parent: = mypage. surface; Mm. Text: = 'Storage box test '; Mm. lines. Add ('this is a new line '); Mm. lines. insert (0, 'I am at the Front '); Mm. lines. Add ('delete me, row 4 '); Mm. lines. Delete (3 ); {The row number starts from row 0 and is inserted to the front} Mm. wordwrap: = true; {automatic line feed} Mm. wanttabs: = true; {accept the tab key} Mm. wantreturns: = true; {line feed} Mm. scrollbars: = ssvertical; {scroll bar} End; |
The running effect is as follows:
The following describes the attributes of the bucket.
Because many attributes of the bucket and the editing box are the same, I will not go into details here. I will mainly talk about several special attributes of the editing box. Scrollbar indicates the status of the scroll bar of the storage box. The optional values include ssboth, sshorizonal, ssnone, and ssvertical. The meanings are described as values. The wantreturns attribute determines whether to click the confirm button (the corresponding attribute value is false) or the storage box line feed (the corresponding attribute value is true) after pressing enter ), if you set this value to false and want to change the line in the editing box, you must press Ctrl + enter, which is the same as the sending message box of QQ. The wanttabs attribute determines whether to press the tab key to switch the focus of the component in the window (the corresponding attribute value is false) or move the cursor in the storage box (the corresponding attribute value is true ), if you set this value to false and want to move the cursor in the edit box, you must press Ctrl + TAB. The last attribute is wordwarp, which determines whether to wrap the text in the storage box. If the attribute value is true, the line feed is automatically generated. If the attribute value is false, the line feed cannot be automatically generated. Note: If the scrollbars attribute is set to ssboth or sshorizonal, the line feed is not automatically generated because the scroll bar automatically adjusts the width.
The other is the lines attribute. This attribute is actually a class and belongs to tstring. It is mainly used to operate a row of text in the bucket. Available functions include add, clear, delete, insert, and count.