浏览代码

Update whatsnew. Add TWizardForm.AdjustLinkLabelHeight. Make it turn off AutoSize automatically if it's accidentally still on when called, same for AdjustLabelHeight.

Martijn Laan 1 年之前
父节点
当前提交
fb13e8ea53
共有 6 个文件被更改,包括 24 次插入3 次删除
  1. 12 1
      Components/BidiCtrls.pas
  2. 1 0
      Projects/Src/ScriptClasses_C.pas
  3. 1 1
      Projects/Src/ScriptClasses_R.pas
  4. 8 0
      Projects/Src/Wizard.pas
  5. 0 1
      iscrypt.iss
  6. 2 0
      whatsnew.htm

+ 12 - 1
Components/BidiCtrls.pas

@@ -54,6 +54,8 @@ type
   TNewLinkLabel = class(TLinkLabel)
   protected
     procedure CreateParams(var Params: TCreateParams); override;
+  public
+    function AdjustHeight: Integer;
   end;
 
 procedure Register;
@@ -61,7 +63,7 @@ procedure Register;
 implementation
 
 uses
-  BidiUtils;
+  CommCtrl, BidiUtils;
 
 procedure Register;
 begin
@@ -134,4 +136,13 @@ begin
   SetBiDiStyles(Self, Params);
 end;
 
+function TNewLinkLabel.AdjustHeight: Integer;
+begin
+  var OldHeight := Height;
+  var IdealSize: TSize;
+  SendMessage(Handle, LM_GETIDEALSIZE, Width, LPARAM(@IdealSize));
+  Height := IdealSize.cy;
+  Result := Height - OldHeight;
+end;
+
 end.

+ 1 - 0
Projects/Src/ScriptClasses_C.pas

@@ -403,6 +403,7 @@ begin
     RegisterProperty('PreparingMemo', 'TNewMemo', iptr);
     RegisterProperty('CurPageID', 'Integer', iptr);
     RegisterMethod('function AdjustLabelHeight(ALabel: TNewStaticText): Integer');
+    RegisterMethod('function AdjustLinkLabelHeight(ALinkLabel: TNewLinkLabel): Integer');
     RegisterMethod('procedure IncTopDecHeight(AControl: TControl; Amount: Integer)');
     RegisterProperty('PrevAppDir', 'String', iptr);
   end;

+ 1 - 1
Projects/Src/ScriptClasses_R.pas

@@ -211,8 +211,8 @@ procedure RegisterWizardForm_R(Cl: TPSRuntimeClassImporter);
 begin
   with Cl.Add(TWizardForm) do
   begin
-
     RegisterMethod(@TWizardForm.AdjustLabelHeight, 'AdjustLabelHeight');
+    RegisterMethod(@TWizardForm.AdjustLinkLabelHeight, 'AdjustLinkLabelHeight');
     RegisterMethod(@TWizardForm.IncTopDecHeight, 'IncTopDecHeight');
   end;
 end;

+ 8 - 0
Projects/Src/Wizard.pas

@@ -219,6 +219,7 @@ type
     destructor Destroy; override;
     procedure AddPage(const APage: TWizardPage; const AfterID: Integer);
     function AdjustLabelHeight(const ALabel: TNewStaticText): Integer;
+    function AdjustLinkLabelHeight(const ALinkLabel: TNewLinkLabel): Integer;
     procedure CallCancelButtonClick(var ACancel, AConfirm: Boolean);
     procedure ChangeFinishedLabel(const S: String);
     procedure ClickToStartPage;
@@ -541,9 +542,16 @@ function TWizardForm.AdjustLabelHeight(const ALabel: TNewStaticText): Integer;
 { Increases or decreases a label's height so that all text fits.
   Returns the difference in height. }
 begin
+  ALabel.AutoSize := False;
   Result := ALabel.AdjustHeight;
 end;
 
+function TWizardForm.AdjustLinkLabelHeight(const ALinkLabel: TNewLinkLabel): Integer;
+begin
+  ALinkLabel.AutoSize := False;
+  Result := ALinkLabel.AdjustHeight;
+end;
+
 procedure TWizardForm.IncTopDecHeight(const AControl: TControl; const Amount: Integer);
 begin
   AControl.SetBounds(AControl.Left, AControl.Top + Amount,

+ 0 - 1
iscrypt.iss

@@ -59,7 +59,6 @@ begin
 
   Label1 := TNewStaticText.Create(Page);
   with Label1 do begin
-    AutoSize := False;
     Left := WizardForm.SelectDirLabel.Left;
     Width := Page.SurfaceWidth - Left;
     Anchors := [akLeft, akTop, akRight];

+ 2 - 0
whatsnew.htm

@@ -145,6 +145,8 @@ end;</pre>
   <li>Pascal Scripting changes: 
     <ul>
     <li>Added support functions <tt>UTF8Encode</tt> and <tt>UTF8Decode</tt> to encode a Unicode string into a UTF-8 encoded ANSI string and vice versa.</li>
+    <li>Added support class <tt>TNewLinkLabel</tt> which can display text with embedded links and internally uses a Windows SysLink control. See the <i>CodeClasses.iss</i> example script for examples.</li>
+    <li><tt>TWizardForm</tt>: Added new <tt>AdjustLinkLabelHeight</tt> function.</li>
     <li>Type <tt>TShellFolderID</tt> was removed because it wasn't used by any support function.</li>
     </ul>
   </li>