-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Inconsistent vertical spacing of trackbars in WinAPI HighGUI backend #22766
Copy link
Copy link
Closed
Labels
Milestone
Description
Windows 10, OpenCV 4.6.0 (and many more)
Once more than 2 trackbars are added, it becomes evident that the vertical spacing between them is not consistent:

In more detail (further rows also have 21 pixels):

The culprit is an off-by-one error on line 2434:
opencv/modules/highgui/src/window_w32.cpp
Lines 2431 to 2447 in 2aad039
| /* Retrieve current buttons count */ | |
| int bcount = (int)SendMessage(window.toolbar.toolbar, TB_BUTTONCOUNT, 0, 0); | |
| if (bcount > 1) | |
| { | |
| /* If this is not the first button then we need to | |
| separate it from the previous one */ | |
| tbs.iBitmap = 0; | |
| tbs.idCommand = bcount; // Set button id to it's number | |
| tbs.iString = 0; | |
| tbs.fsStyle = TBSTYLE_SEP; | |
| tbs.fsState = TBSTATE_ENABLED; | |
| SendMessage(window.toolbar.toolbar, TB_ADDBUTTONS, 1, (LPARAM)&tbs); | |
| // Retrieve current buttons count | |
| bcount = (int)SendMessage(window.toolbar.toolbar, TB_BUTTONCOUNT, 0, 0); | |
| } |
Once there is at least 1 button, a separator should be added, hence
if (bcount > 0).Reactions are currently unavailable