Here we will introduce foldertreeview Class. Tfoldertreeview = Class (tcustomfoldertreeview) Property onchange: tyyevent; read write; property onrename: tfolderrenameevent; read write; end; tcustomfoldertreeview inherits from twincontrol, so there are many similar properties like other basic controls, which are not repeated here.
Post Code Section:
[Code]
Varmypage: twizardpage; FTV: tfoldertreeview; Procedure initializewizard (); begin mypage: = createcustompage (wpwelcome, 'title: Custom page', 'description: this is my custom page '); FTV: = tfoldertreeview. create (mypage); FTV. width: = mypage. surfacewidth; FTV. height: = mypage. surfaceheight; FTV. parent: = mypage. surface; FTV. directory: = expandconstant ('{win}'); end;
It is necessary to explain expandconstant. The function is prototype:
Function expandconstant (const S: string): string;
Description: changes all constants in S to their values. for example, expandconstant ('{srcexe}') is changed to the filename of setup. an exception will be raised if there was an error expanding the constants.
Expands a String constant as the path string. Common constants include {app}, {win}, {sys}, {SRC}, and {dotnet20}, avoiding the trouble of manual input.
The running effect is as follows:
In addition, this class supports an onchange event, which is triggered when the folder is modified. [Code] varmypage: twizardpage; FTV: tfoldertreeview; LBL: tlabel; Procedure changedir (Sender: tobject); begin LBL. caption: = FTV. directory; end; Procedure initializewizard (); begin mypage: = createcustompage (wpwelcome, 'title: Custom page', 'description: This is my custom page'); LBL: = tlabel. create (mypage); LBL. parent: = mypage. surface; FTV: = tfoldertreeview. create (mypage); FTV. top: = LBL. height + 5; FTV. width: = mypage. surfacewidth; FTV. height: = mypage. surfaceHeight-20; FTV. parent: = mypage. surface; FTV. directory: = expandconstant ('{win}'); FTV. onchange: = @ changedir; LBL. caption: = FTV. directory; end;
The running result is as follows:
The visible tag value is consistent with the folder value.
from: http://www.360doc.com/content/13/0327/14/4221543_274238588.shtml