View Issue Details

IDProjectCategoryView StatusLast Update
0018955LazarusWidgetsetpublic2012-03-12 15:56
ReportercobinesAssigned ToPaul Ishenin 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows XPOS VersionSP3
Product Version0.9.31 (SVN)Product Build29892 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0018955: Pages size not adjusted in TCustomNotebook with Multiline=True when changing caption of tabs
DescriptionWhen caption of a tab is changed and such change results in changing how many lines of tabs are visible then the pages sizes on each tab are not recalculated. For example changing a caption from a short one to a very long one and vice-versa.
Steps To Reproduce1. Run attached application. There is one line of tabs.
2. Click "Rename tab 3" button. There is two lines of tabs but the second line is not visible. (screenshot_2.png)
3. Maximize and Restore the window. Pages have now been resized.
4. Click "Rename tab 3" button. There is one line of tabs but there is additional space between the tabs and pages contents. (screenshot_4.png)
TagsNo tags attached.
Fixed in Revision35199
LazTarget0.99.0
WidgetsetWin32/Win64
Attached Files
  • multine_tabs_on_change_caption.zip (2,336 bytes)
  • screenshot_2.png (3,433 bytes)
    screenshot_2.png (3,433 bytes)
  • screenshot_4.png (2,610 bytes)
    screenshot_4.png (2,610 bytes)
  • multiline_tabs_on_change_caption.diff (1,125 bytes)
    Index: lcl/interfaces/win32/win32pagecontrol.inc
    ===================================================================
    --- lcl/interfaces/win32/win32pagecontrol.inc	(revision 33121)
    +++ lcl/interfaces/win32/win32pagecontrol.inc	(working copy)
    @@ -175,11 +175,13 @@
     var
       TCI: TC_ITEM;
       PageIndex, RealIndex: integer;
    +  Notebook: TCustomTabControl;
       NotebookHandle: HWND;
     begin
    +  Notebook := TCustomTabControl(AWinControl.Parent);
       PageIndex := TCustomPage(AWinControl).PageIndex;
    -  RealIndex := TCustomTabControl(AWinControl.Parent).PageToTabIndex(PageIndex);
    -  NotebookHandle := AWinControl.Parent.Handle;
    +  RealIndex := Notebook.PageToTabIndex(PageIndex);
    +  NotebookHandle := Notebook.Handle;
       // We can't set label of a page not yet added,
       // Check for valid page index
       if (RealIndex >= 0) and (RealIndex < Windows.SendMessage(NotebookHandle, TCM_GETITEMCOUNT, 0, 0)) then
    @@ -205,6 +207,7 @@
           TCI.pszText := PChar(AText);
           Windows.SendMessage(NotebookHandle, TCM_SETITEM, RealIndex, LPARAM(@TCI));
     {$endif}
    +      LCLControlSizeNeedsUpdate(Notebook, True);
         end;
       end;
     end;
    

Activities

2011-03-20 03:30

 

multine_tabs_on_change_caption.zip (2,336 bytes)

2011-03-20 03:31

 

screenshot_2.png (3,433 bytes)
screenshot_2.png (3,433 bytes)

2011-03-20 03:31

 

screenshot_4.png (2,610 bytes)
screenshot_4.png (2,610 bytes)

2011-10-27 23:43

 

multiline_tabs_on_change_caption.diff (1,125 bytes)
Index: lcl/interfaces/win32/win32pagecontrol.inc
===================================================================
--- lcl/interfaces/win32/win32pagecontrol.inc	(revision 33121)
+++ lcl/interfaces/win32/win32pagecontrol.inc	(working copy)
@@ -175,11 +175,13 @@
 var
   TCI: TC_ITEM;
   PageIndex, RealIndex: integer;
+  Notebook: TCustomTabControl;
   NotebookHandle: HWND;
 begin
+  Notebook := TCustomTabControl(AWinControl.Parent);
   PageIndex := TCustomPage(AWinControl).PageIndex;
-  RealIndex := TCustomTabControl(AWinControl.Parent).PageToTabIndex(PageIndex);
-  NotebookHandle := AWinControl.Parent.Handle;
+  RealIndex := Notebook.PageToTabIndex(PageIndex);
+  NotebookHandle := Notebook.Handle;
   // We can't set label of a page not yet added,
   // Check for valid page index
   if (RealIndex >= 0) and (RealIndex < Windows.SendMessage(NotebookHandle, TCM_GETITEMCOUNT, 0, 0)) then
@@ -205,6 +207,7 @@
       TCI.pszText := PChar(AText);
       Windows.SendMessage(NotebookHandle, TCM_SETITEM, RealIndex, LPARAM(@TCI));
 {$endif}
+      LCLControlSizeNeedsUpdate(Notebook, True);
     end;
   end;
 end;

cobines

2011-10-27 23:46

reporter   ~0053520

Uploaded a patch.

I added only:

  LCLControlSizeNeedsUpdate(ATabControl, True);

and not

  if LCLControlSizeNeedsUpdate(ATabControl, True) then
    AdjustSizeNotebookPages(ATabControl);

like it is in other places in that file because from my tests (Windows XP SP3) it was enough.

Paul Ishenin

2012-02-07 06:12

manager   ~0056607

Thanks, applied

Issue History

Date Modified Username Field Change
2011-03-20 03:30 cobines New Issue
2011-03-20 03:30 cobines File Added: multine_tabs_on_change_caption.zip
2011-03-20 03:30 cobines Widgetset => Win32/Win64
2011-03-20 03:31 cobines File Added: screenshot_2.png
2011-03-20 03:31 cobines File Added: screenshot_4.png
2011-03-30 23:00 Vincent Snijders LazTarget => 1.0
2011-03-30 23:00 Vincent Snijders Status new => acknowledged
2011-03-30 23:00 Vincent Snijders Target Version => 1.0.0
2011-04-04 05:36 Paul Ishenin LazTarget 1.0 => 0.99.0
2011-04-04 05:37 Paul Ishenin Target Version 1.0.0 => 0.99.0
2011-09-28 16:01 Felipe Monteiro de Carvalho LazTarget 0.99.0 => 1.0
2011-10-27 23:43 cobines File Added: multiline_tabs_on_change_caption.diff
2011-10-27 23:46 cobines Note Added: 0053520
2011-10-27 23:51 Vincent Snijders Status acknowledged => assigned
2011-10-27 23:51 Vincent Snijders Assigned To => Paul Ishenin
2011-10-27 23:51 Vincent Snijders LazTarget 1.0 => 0.99.0
2012-02-07 06:12 Paul Ishenin Fixed in Revision => 35199
2012-02-07 06:12 Paul Ishenin Status assigned => resolved
2012-02-07 06:12 Paul Ishenin Fixed in Version => 0.9.31 (SVN)
2012-02-07 06:12 Paul Ishenin Resolution open => fixed
2012-02-07 06:12 Paul Ishenin Note Added: 0056607
2012-03-12 15:56 cobines Status resolved => closed