Advertisement
Alken

Inno Setup custom component description

Nov 10th, 2014
3,237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Setup]
  2. AppName=My Program
  3. AppVerName=My Program version 1.5
  4. DefaultDirName={pf}\My Program
  5.  
  6. [Files]
  7. Source: Leeme1.rtf; Flags: dontcopy
  8. Source: Leeme2.rtf; Flags: dontcopy
  9. Source: Leeme3.rtf; Flags: dontcopy
  10. Source: Button1.bmp; Flags: dontcopy
  11. Source: Button2.bmp; Flags: dontcopy
  12. Source: Button3.bmp; Flags: dontcopy
  13. Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: {app}; Flags: ignoreversion; Check: CheckedBox(0)
  14. Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.chm"; DestDir: {app}; Flags: ignoreversion; Check: CheckedBox(1)
  15.  
  16. [Code]
  17. var
  18.   Page: TWizardPage;
  19.   ListBox: TNewCheckListBox;
  20.   Memo: TRichEditViewer;
  21.   CheckLabel: TLabel;
  22.   MouseY: integer;
  23.   BitmapImage: TBitmapImage;
  24.   InfoBmp: array of TBitmap;
  25.  
  26. function CheckedBox(ItemNumber: integer): Boolean;
  27. begin                                    
  28.   Result:= ListBox.Checked[ItemNumber];
  29. end;
  30. procedure CheckOnClick (Sender: TObject);
  31. begin
  32.   if MouseY < ListBox.Items.Count then
  33.     begin
  34.       ListBox.Checked[MouseY]:= Not(ListBox.Checked[MouseY]);
  35.     end;
  36. end;
  37.  
  38. procedure CheckMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  39. begin
  40.   MouseY:= Y/ScaleY(16);
  41.   if MouseY < ListBox.Items.Count then
  42.     begin
  43.       Memo.RTFText:= TStrings(ListBox.ItemObject[MouseY]).Text;
  44.       BitmapImage.Bitmap:= InfoBmp[MouseY];
  45.     end;
  46. end;
  47.  
  48. procedure InitializeWizard();
  49. var
  50.   i: integer;
  51. begin
  52.   ExtractTemporaryFile('Leeme1.rtf');
  53.   ExtractTemporaryFile('Leeme2.rtf');
  54.   ExtractTemporaryFile('Leeme3.rtf');
  55.   ExtractTemporaryFile('Button1.bmp');
  56.   ExtractTemporaryFile('Button2.bmp');
  57.   ExtractTemporaryFile('Button3.bmp');
  58.  
  59.   Page:=CreateCustomPage(wpWelcome, 'blabla1', 'blabla2, blabla 3')
  60.  
  61.   ListBox:= TNewCheckListBox.Create(Page);
  62.   with ListBox do
  63.     begin
  64.       Left   := 15
  65.       Top    := 0
  66.       Width  := 200
  67.       Height := 149
  68.       Parent := Page.Surface
  69.       AddCheckBox('blabla', '', 0, True, True, True, True, TStringList.Create);
  70.       AddCheckBox('blabla blabla', '', 1, True, True, False, True, TStringList.Create);
  71.       AddCheckBox('blabla f blabla', '', 1, True, True, False, True, TStringList.Create);
  72.  
  73.       TStrings(ItemObject[0]).LoadFromFile(ExpandConstant('{tmp}\Leeme1.rtf'));
  74.       TStrings(ItemObject[1]).LoadFromFile(ExpandConstant('{tmp}\Leeme2.rtf'));
  75.       TStrings(ItemObject[2]).LoadFromFile(ExpandConstant('{tmp}\Leeme3.rtf'));
  76.     end;
  77.  
  78.   Memo:= TRichEditViewer.Create(Page);
  79.   with Memo do
  80.     begin
  81.       Left        := ListBox.Left + ListBox.Width + 8;
  82.       Top         := ListBox.Top;
  83.       Width       := ListBox.Width;
  84.       Height      := ListBox.Height;
  85.       Color       := clBtnFace;
  86.       Enabled     := False;
  87.       BorderStyle := bsNone;
  88.       Parent      := Page.Surface;
  89.     end;
  90.  
  91.   CheckLabel:= TLabel.Create(Page);
  92.   with CheckLabel do
  93.     begin
  94.       Width       :=ListBox.Width;
  95.       Height      :=ListBox.Height;
  96.       Autosize    :=False;
  97.       Transparent :=True;
  98.       OnMouseMove :=@CheckMouseMove;
  99.       OnClick     :=@CheckOnClick;
  100.       Parent      :=ListBox;
  101.       Cursor      := 1;
  102.     end;
  103.  
  104.   BitmapImage := TBitmapImage.Create(Page);
  105.   with BitmapImage do                      
  106.     begin                                  
  107.       AutoSize := True;
  108.       Left        := ListBox.Left;
  109.       Top         := ListBox.Top + ListBox.Height + 8;
  110.       Width       := ListBox.Width;
  111.       Height      := 32;
  112.       Parent := Page.Surface;
  113.     end;
  114.  
  115.   for i:=0 to ListBox.Items.Count - 1 do
  116.     begin                                
  117.       SetArrayLength(InfoBmp, i+1);
  118.       InfoBmp[i]:= TBitmap.Create;
  119.     end;
  120.   InfoBmp[0].LoadFromFile(ExpandConstant('{tmp}\Button1.bmp'));
  121.   InfoBmp[1].LoadFromFile(ExpandConstant('{tmp}\Button2.bmp'));
  122.   InfoBmp[2].LoadFromFile(ExpandConstant('{tmp}\Button3.bmp'));
  123. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement