From c1ae646c098cc699c9fff99232f9afc5e6ea6533 Mon Sep 17 00:00:00 2001
From: the-Arioch <the_Arioch@nm.ru>
Date: Fri, 23 Aug 2013 13:14:21 +0400
Subject: [PATCH] Fixed runtime resizing with regards to Multiline and
 Separator

---
 jvcl/examples/JvListComb/ListBoxFormU.dfm |  9 ---------
 jvcl/run/JvListBox.pas                    | 18 +++++++++++-------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/jvcl/examples/JvListComb/ListBoxFormU.dfm b/jvcl/examples/JvListComb/ListBoxFormU.dfm
index cf6cfe7..ddab04a 100644
--- a/jvcl/examples/JvListComb/ListBoxFormU.dfm
+++ b/jvcl/examples/JvListComb/ListBoxFormU.dfm
@@ -219,17 +219,12 @@ object fmListBox: TfmListBox
     TabPosition = tpBottom
     object tsJVCL: TTabSheet
       Caption = 'JediVCL Listbox'
-      ExplicitLeft = 0
-      ExplicitTop = 0
-      ExplicitWidth = 0
-      ExplicitHeight = 0
       object lst1: TJvListBox
         Left = 0
         Top = 0
         Width = 395
         Height = 461
         Align = alClient
-        IntegralHeight = True
         Background.FillMode = bfmTile
         Background.Visible = False
         TabOrder = 0
@@ -238,10 +233,6 @@ object fmListBox: TfmListBox
     object tsVCL: TTabSheet
       Caption = 'Standard ListBox'
       ImageIndex = 1
-      ExplicitLeft = 0
-      ExplicitTop = 0
-      ExplicitWidth = 0
-      ExplicitHeight = 0
       object lst2: TListBox
         Left = 0
         Top = 0
diff --git a/jvcl/run/JvListBox.pas b/jvcl/run/JvListBox.pas
index b154eee..ab2b756 100644
--- a/jvcl/run/JvListBox.pas
+++ b/jvcl/run/JvListBox.pas
@@ -969,14 +969,18 @@ begin
     Style := Style and not (WS_HSCROLL or WS_VSCROLL) or ScrollBar[FScrollBars] or
       Sorted[FSorted];
   end;
-  if ItemsOfVariableHeight and (Style <> lbOwnerDrawVariable) then
+
+  if ItemsOfVariableHeight then
   begin
-    Params.Style := LBS_OWNERDRAWVARIABLE or
+    if Self.Style <> lbOwnerDrawVariable then
+       Params.Style := LBS_OWNERDRAWVARIABLE or
                      ( Params.Style and not LBS_OWNERDRAWFIXED);
-  end else
-    if ItemsDemandOwnerDraw then begin
-       Params.Style := Params.Style or LBS_OWNERDRAWFIXED;
-    end;
+  end else begin
+       // only when NOT ItemsOfVariableHeight
+    if ItemsDemandOwnerDraw then
+       Params.Style := LBS_OWNERDRAWFIXED or
+                     ( Params.Style and not LBS_OWNERDRAWVARIABLE);
+  end;
   if IsProviderSelected then
   begin
     Params.Style := Params.Style and not (LBS_SORT or LBS_HASSTRINGS or LBS_NODATA);
@@ -1939,7 +1943,7 @@ begin
   end;
   FItemsHeightValid := True;
 
-  // Remeasure might be caleld from inside painter
+  // Remeasure might be called from inside painter
   // So it will need to initiate another paint cycle with different heights
   If ItemsHeightChanged and HandleAllocated
      then InvalidateRect(Handle, nil, True);
-- 
1.8.3.msysgit.0

