Opened 8 years ago

Closed 6 months ago

Last modified 6 months ago

#3788 closed defect (fixed)

On MDIParent it is not possible to create a second toolbar

Reported by: oneeyeman Owned by:
Priority: normal Milestone:
Component: wxMSW Version: dev-latest
Keywords: wxToolbar size Cc: oneeyeman
Blocked By: Blocking:
Patch: yes

Description

Hi, ALL,
Happy New Year ;-)
Since nobody repled to my message on the wx-dev, I am assuming that it is a bug.

Attached please find the diff to the toolbar sample, and the screenshot that will display the incorrect behavior. The patch is to the 2.8.0 wxWidgets.

Originally the behavior was found on my local program and then confirmed with the sample.

wxGTK-2.8.0 does not have this problem. I tested it, and you can create both toolbars without any problems.

Attachments (6)

bug download (1.5 KB) - added by oneeyeman 8 years ago.
sample diff
bug.xpm.tar.gz download (17.4 KB) - added by oneeyeman 8 years ago.
screenshot of the MSW version
toolbar-v.png download (11.1 KB) - added by awi 6 months ago.
Screenshot of additional vertical toolbar.
toolbar-sizing.patch download (1.0 KB) - added by awi 6 months ago.
Patch to fix sizing of the tollbar.
main-toolbar-v.png download (37.5 KB) - added by awi 6 months ago.
Main toolbar in vertical orientation.
toolbar-sizing-2.patch download (855 bytes) - added by awi 6 months ago.
Additional patch to fix sizing of the tollbar.

Download all attachments as: .zip

Change History (14)

Changed 8 years ago by oneeyeman

sample diff

Changed 8 years ago by oneeyeman

screenshot of the MSW version

comment:1 Changed 8 years ago by oneeyeman

File Added: bug.xpm.tar.gz

Changed 6 months ago by awi

Screenshot of additional vertical toolbar.

Changed 6 months ago by awi

Patch to fix sizing of the tollbar.

comment:2 Changed 6 months ago by awi

  • Keywords wxToolbar size added
  • Patch set
  • Version set to dev-latest

In fact, reported issue is about wrong sizing of additional vertical toolbar and it is not related to wxMDIMparentFrame only but it can be even observed in the toolbar sample. When you enable another toolbar via Ctrl-A then you can see that vertical toolbar is truncated a bit.

Screenshot of additional vertical toolbar.

The reason of the issue is that toolbar size calculations done in wxToolBar::HandleSize() are based on the size of the first toolbar item (it is assumed that all items are of the same size). Any item bigger (wider) then the first one is truncated.
When the biggest toolbar item is taken into account in calculations then everything looks OK.
Patch attached.

comment:3 Changed 6 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [76034]) Fix calculating the size of vertical toolbar in wxMSW.

Use the width of the largest toolbar item as the toolbar width, not the width
of the first one. The implicit assumption that all items had the same width
was wrong and resulted in items wider than the first one being truncated.

Closes #3788.

comment:4 Changed 6 months ago by VZ

(In [76035]) Fix calculating the size of vertical toolbar in wxMSW.

Use the width of the largest toolbar item as the toolbar width, not the width
of the first one. The implicit assumption that all items had the same width
was wrong and resulted in items wider than the first one being truncated.

Closes #3788.

Changed 6 months ago by awi

Main toolbar in vertical orientation.

Changed 6 months ago by awi

Additional patch to fix sizing of the tollbar.

comment:5 Changed 6 months ago by awi

  • Resolution fixed deleted
  • Status changed from closed to reopened

Unfortunately, fix enabling second vertical toolbar to be sized and displayed correctly introduced regression in sizing main toolbar from toolbar sample. If its orientation is changed to vertical then it occupies whole client area (screenshot attached).
Main toolbar in vertical orientation.
This happens because for separators inside vertical toolbar there is reported (via wxGetTBItemRect() and TB_GETITEMRECT mesasage) in some circumstances not the reasonable width but the width of the client area of the window. At the end this leads to the wrong calculation of the size of the toolbar in wxToolBar::HandleSize().
To fix the issue there is necessary to skip separators in calculation of the largest toolbar button in wxToolBar::HandleSize().
Patch attached.

Another option could be to create separators with TBSTYLE_AUTOSIZE style but in this case separators on vertical toolbar are a bit too short.

comment:6 Changed 6 months ago by vadz

Thanks a lot for testing this and noticing the bug! It would have been embarrassing to introduce it in a stable release, so finally my inability to make 3.0.1 this weekend almost looks like a good decision :-)

Thanks again!

comment:7 Changed 6 months ago by VZ

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [76079]) Fix bug in vertical toolbar size calculation in wxMSW.

Correct the changes of the r76034 to avoid using separators when calculating
the fitting width of the vertical toolbars as this doesn't always work
correctly.

Closes #3788.

comment:8 Changed 6 months ago by VZ

(In [76080]) Fix bug in vertical toolbar size calculation in wxMSW.

Correct the changes of the r76035 to avoid using separators when calculating
the fitting width of the vertical toolbars as this doesn't always work
correctly.

Closes #3788.

Note: See TracTickets for help on using tickets.