View Issue Details

IDProjectCategoryView StatusLast Update
0014061LazarusLCLpublic2009-10-23 00:40
ReporterHans-Peter Diettrich Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityrandom
Status closedResolutionfixed 
Product Version0.9.27 (SVN) 
Target Version1.0.0Fixed in Version0.9.27 (SVN) 
Summary0014061: TToolBar doesn't resize properly
DescriptionThese problems have been observed when a TToolBar is or should be resized:

1) A wrapable toolbar doesn't change in Height when buttons wrap.
2) ToolButtons can loose their (autosize) Width.

See Lazarus examples/dockmanager/toolbar/test1 demo project.
Additional Information[1] Wrapable only affects the visibility of wrapped buttons, but seems not to adjust the Height of the toolbar, nor the Top of wrapped buttons.

[2] Happens randomly with the win32 widgetset, seems not to occur with gtk2.
See Lazarus examples/dockmanager/easytree/easydocking demo project, try docking and undocking a notebook. The notebook can be dragged by dragging its toolbar.

Possibly related issue: programmatically added buttons are added *before* existing buttons, should be *after*. I found no way to rearrange the buttons programmatically.
TagsNo tags attached.
Fixed in Revision20849
LazTarget1.0
Widgetset
Attached Files

Activities

2009-06-27 11:14

 

ToolButtonLast.patch (903 bytes)   
Index: include/toolbutton.inc
===================================================================
--- include/toolbutton.inc	(revision 20748)
+++ include/toolbutton.inc	(working copy)
@@ -853,7 +853,7 @@
   FToolBar:=nil;
   if AParent is TToolBar then
   begin
-    if Style in [tbsButton,tbsDropDown,tbsCheck] then
+    if (Style in [tbsButton,tbsDropDown,tbsCheck]) and not AutoSize then
       NewWidth:=TToolBar(AParent).ButtonWidth
     else
       NewWidth:=Width;
@@ -869,8 +869,13 @@
   begin
     FToolBar:=TToolBar(Parent);
     i := Index;
-    if i < 0 then
+    if i < 0 then begin
+    //move button last
+      i := FToolBar.ButtonCount - 1;
+      if i >= 0 then
+        Left := FToolBar.Buttons[i].Left + FToolBar.Buttons[i].Width;
       FToolBar.AddButton(Self);
+    end;
     UpdateVisibleToolbar;
   end;
   //DebugLn(['TToolButton.SetParent A ',Name,' NewIndex=',Index]);
ToolButtonLast.patch (903 bytes)   

Hans-Peter Diettrich

2009-06-27 11:26

reporter   ~0028788

ToolButtonLast.patch adds new buttons to the right of the existing buttons.
This is achieved by initializing NewButton.Left to an value past lastbutton.right.

When an index is known for the new button, its Left value could be derived from the button[newindex-1].Left plus a small delta (+1?), to ensure that the new button is aligned after this button. (Just an idea)

I also tried to retain the current width when AutoSize is true, but this seems not to work :-(

Paul Ishenin

2009-07-13 10:26

manager   ~0029069

1. Is fixed in r20849
2. Needs a simplier example. Ideally 1 form + 1 toolbar + 1 button to generate wrong toolbar configuation.

And after all this are different issues. I would suggest to open separate bug report for the second issue.

And please test and close if the first issue is fixed now. To test you need to set ToolBar.AutoSize = True

Issue History

Date Modified Username Field Change
2009-06-26 13:06 Hans-Peter Diettrich New Issue
2009-06-27 11:14 Hans-Peter Diettrich File Added: ToolButtonLast.patch
2009-06-27 11:26 Hans-Peter Diettrich Note Added: 0028788
2009-06-28 19:55 Vincent Snijders LazTarget => 1.0
2009-06-28 19:55 Vincent Snijders Assigned To => Paul Ishenin
2009-06-28 19:55 Vincent Snijders Status new => assigned
2009-06-28 19:55 Vincent Snijders Target Version => 1.0.0
2009-07-13 10:26 Paul Ishenin Fixed in Revision => 20849
2009-07-13 10:26 Paul Ishenin Status assigned => resolved
2009-07-13 10:26 Paul Ishenin Fixed in Version => 0.9.27 (SVN)
2009-07-13 10:26 Paul Ishenin Resolution open => fixed
2009-07-13 10:26 Paul Ishenin Note Added: 0029069
2009-10-23 00:40 Marc Weustink Status resolved => closed